On 03 Apr 2009, at 15:28, Ruud Klaver wrote: > Hi, > > After switching our software to the new sound device API, I've been > getting reports on a strange audio noise being heard sometimes when > the program starts up. In a normal case this is the sound part of > the log (on my system): > > 2009-04-03 15:19:24.605000 (5) pa_dev.c: Opened device Built- > in Microphone(Core Audio)/Built-in Output(Core Audio) for recording > and playback, sample rate=32000, ch=1, bits=16, 640 samples per > frame, input latency=0 ms, output latency=0 ms > 2009-04-03 15:19:24.605000 (5) ec0x157e430: Creating AEC > 2009-04-03 15:19:24.606000 (4) ec0x157e430: AEC created, > clock_rate=32000, channel=1, samples per frame=640, tail length=200 > ms, latency=20 ms > 2009-04-03 15:19:24.606000 (5) pa_dev.c: Starting Built-in > Microphone stream.. > 2009-04-03 15:19:24.608000 (5) pa_dev.c: Done, status=0 > 2009-04-03 15:19:24.622000 (5) pa_dev.c: Player thread started > 2009-04-03 15:19:24.636000 (5) ec0x157e430: Latency bufferring > complete > 2009-04-03 15:19:24.637000 (5) pa_dev.c: Recorder thread started > > In the case where the noise is heard, this is the log (on the > reported system): > > 2009-04-03 10:15:17.050000 (5) pa_dev.c: Opened device Built-in > Microphone(Core Audio)/Built-in Output(Core Audio) for recording and > playback, sample rate=32000, ch=1, bits=16, 640 samples per frame, > input latency=0 ms, output latency=0 ms > 2009-04-03 10:15:17.050000 (5) ec0x14f27f0: Creating AEC > 2009-04-03 10:15:17.051000 (4) ec0x14f27f0: AEC created, > clock_rate=32000, channel=1, samples per frame=640, tail length=200 > ms, latency=20 ms > 2009-04-03 10:15:17.051000 (5) pa_dev.c: Starting Built-in > Microphone stream.. > 2009-04-03 10:15:17.466000 (5) pa_dev.c: Player thread started > 2009-04-03 10:15:17.479000 (5) ec0x14f27f0: Latency bufferring > complete > 2009-04-03 10:15:17.626000 (5) ec0x14f27f0: 1279 samples reduced, > buf_cnt=3201 > 2009-04-03 10:15:17.639000 (5) ec0x14f27f0: 526 samples reduced, > buf_cnt=3315 > 2009-04-03 10:15:17.666000 (5) ec0x14f27f0: 274 samples reduced, > buf_cnt=3681 > 2009-04-03 10:15:17.679000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3521 > 2009-04-03 10:15:17.706000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3361 > 2009-04-03 10:15:17.719000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3201 > 2009-04-03 10:15:17.746000 (5) ec0x14f27f0: 526 samples reduced, > buf_cnt=3315 > 2009-04-03 10:15:17.759000 (5) ec0x14f27f0: 274 samples reduced, > buf_cnt=3681 > 2009-04-03 10:15:17.786000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3521 > 2009-04-03 10:15:17.799000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3361 > 2009-04-03 10:15:17.826000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3201 > 2009-04-03 10:15:17.839000 (5) ec0x14f27f0: 526 samples reduced, > buf_cnt=3315 > 2009-04-03 10:15:17.866000 (5) ec0x14f27f0: 274 samples reduced, > buf_cnt=3681 > 2009-04-03 10:15:17.879000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3521 > 2009-04-03 10:15:17.906000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3361 > 2009-04-03 10:15:17.919000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3201 > 2009-04-03 10:15:17.946000 (5) ec0x14f27f0: 526 samples reduced, > buf_cnt=3315 > 2009-04-03 10:15:17.959000 (5) ec0x14f27f0: 274 samples reduced, > buf_cnt=3681 > 2009-04-03 10:15:17.986000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3521 > 2009-04-03 10:15:17.999000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3361 > 2009-04-03 10:15:18.026000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3201 > 2009-04-03 10:15:18.039000 (5) ec0x14f27f0: 526 samples reduced, > buf_cnt=3315 > 2009-04-03 10:15:18.066000 (5) ec0x14f27f0: 274 samples reduced, > buf_cnt=3681 > 2009-04-03 10:15:18.079000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3521 > 2009-04-03 10:15:18.106000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3361 > 2009-04-03 10:15:18.119000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3201 > 2009-04-03 10:15:18.146000 (5) ec0x14f27f0: 526 samples reduced, > buf_cnt=3315 > 2009-04-03 10:15:18.159000 (5) ec0x14f27f0: 274 samples reduced, > buf_cnt=3681 > 2009-04-03 10:15:18.186000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3521 > 2009-04-03 10:15:18.199000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3361 > 2009-04-03 10:15:18.226000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3201 > 2009-04-03 10:15:18.239000 (5) ec0x14f27f0: 526 samples reduced, > buf_cnt=3315 > 2009-04-03 10:15:18.266000 (5) ec0x14f27f0: 274 samples reduced, > buf_cnt=3681 > 2009-04-03 10:15:18.279000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3521 > 2009-04-03 10:15:18.306000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3361 > 2009-04-03 10:15:18.319000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3201 > 2009-04-03 10:15:18.346000 (5) ec0x14f27f0: 526 samples reduced, > buf_cnt=3315 > 2009-04-03 10:15:18.359000 (5) ec0x14f27f0: 274 samples reduced, > buf_cnt=3681 > 2009-04-03 10:15:18.386000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3521 > 2009-04-03 10:15:18.399000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3361 > 2009-04-03 10:15:18.426000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3201 > 2009-04-03 10:15:18.439000 (5) ec0x14f27f0: 526 samples reduced, > buf_cnt=3315 > 2009-04-03 10:15:18.465000 (5) pa_dev.c: Done, status=0 > 2009-04-03 10:15:18.465000 (5) ec0x14f27f0: 274 samples reduced, > buf_cnt=3681 > 2009-04-03 10:15:18.479000 (5) ec0x14f27f0: 800 samples reduced, > buf_cnt=3521 > 2009-04-03 10:15:18.494000 (5) pa_dev.c: Recorder thread started > > It seems that the echo canceller is started before Portaudio is done > sometimes. According to the wiki page about the new audio device > API, I've done the following to setup the audio device with > (software) EC directly: > > param.flags = PJMEDIA_AUD_DEV_CAP_EC | > PJMEDIA_AUD_DEV_CAP_EC_TAIL > param.ec_enabled = 1 > > If I omit this and do pjmedia_snd_port_set_ec() later instead, the > echo cancellation is enabled at that point. Just as an update, doing this doesn't actually seem to help at all... > > According to the wiki I should be able to do the first though. Is > this correct? Maybe this is some sort of race condition, as it > doesn't always happen and only on some systems? > > Thanks in advance for the help and good work on the new API. ;) > > Ruud Klaver > AG Projects