2
|
1 /***************************************************************
|
|
2 A.5 Test source code
|
|
3 ***************************************************************/
|
|
4
|
|
5 The microphone and loudspeaker signals have to be synchronized on a
|
|
6 sample-to-sample basis to make acoustic echo cancellation working.
|
|
7 An AC97 conformal on-board soundcard in a Personal Computer can be set
|
|
8 in a special stereo mode: The left channnel records microphone signal
|
|
9 and the right channel records loudspeaker signal.
|
|
10
|
|
11 To set-up a Linux PC with ALSA sound system, electret microphone like
|
|
12 Labtec Verse 333 connected to Mic in and loudspeaker connected to right
|
|
13 Line out enter:
|
|
14
|
|
15 amixer -q set 'Master',0 70% unmute
|
|
16 amixer -q set 'PCM',0 70% unmute
|
|
17 amixer -q set 'Line',0 0% mute
|
|
18 amixer -q set 'CD',0 0% mute
|
|
19 amixer -q set 'Mic',0 0% mute
|
|
20 amixer -q set 'Video',0 0% mute
|
|
21 amixer -q set 'Phone',0 0% mute
|
|
22 amixer -q set 'PC Speaker',0 0% mute
|
|
23 amixer -q set 'Aux',0 0% mute
|
|
24 amixer -q set 'Capture',0 50%,0%
|
|
25 amixer -q set 'Mic Boost (+20dB)',0 1
|
|
26 amixer -q cset iface=MIXER,name='Capture Source' 0,5
|
|
27 amixer -q cset iface=MIXER,name='Capture Switch' 1
|
|
28
|
|
29 To test the acoustic echo cancellation we simulate a real telephone
|
|
30 conversation in 5 steps:
|
|
31 (1) record far-end speaker,
|
|
32 (2) perform acoustic echo cancellation (this should change nothing)
|
|
33 (3) playback far-end speaker and at the same time record near-end speaker
|
|
34 (4) perform acoustic echo cancellation
|
|
35 (5) playback near-end speaker (far-end speech should be cancelled)
|
|
36
|
|
37 # To compile the test program aec_test read file aec_test.cpp.
|
|
38
|
|
39 # To record 10 seconds of speech into the file b.raw enter:
|
|
40 arecord -c 2 -t raw -f S16_LE -r 16000 -d 10 >b.raw
|
|
41
|
|
42 # To perform AEC at the far-end enter:
|
|
43 ./aec_test <b.raw >b1.raw
|
|
44
|
|
45 # To playback file b1.raw and simultaneously record b2.raw enter both
|
|
46 # commands in one go:
|
|
47 aplay -c 2 -t raw -f S16_LE -r 16000 b1.raw &
|
|
48 arecord -c 2 -t raw -f S16_LE -r 16000 -d 10 >b2.raw
|
|
49
|
|
50 # To perform AEC at the near-end enter:
|
|
51 ./aec_test <b2.raw >b3.raw
|
|
52
|
|
53 # To playback the echo-cancelled near-end enter:
|
|
54 aplay -c 2 -t raw -f S16_LE -r 16000 b3.raw
|