[Freeswitch-users] mod_avmd false positives, ineffecient
davidjbrazier at gmail.com
Mon Apr 9 19:47:13 MSD 2012
I've been testing mod_avmd and got a lot of false positives - i.e. normal
speech detected as beep. As I understand it, the basic approach is to look
for audio with one very dominant frequency - the beep. It does this by
getting a frequency estimate and then calculats the amplitude of the audio
at that frequency, looking for a consistent run of high amplitudes. But
I've found a few things that are either not right or I have misunderstood:
1. The expensive desa2 frequency estimate is calculated on every sample,
and worse, as each frame arrives (say 160 samples) it calculates the desa2
for every sample in the circular buffer - 800 samples (rounded up to 1024 I
think?). So that is using excessive CPU, and anyway I don't think the
frequency estimate should be calculated on every sample, because in normal
speech, the frequency is changing and so successive samples might register
a high amplitude but with different frequencies, causing false positives.
2. The amplitude function doesn't appear to produce a constant result when
the input audio is a pure tone, although the deas2 frequency estimate is
3. The running mean sma_b is tested against zero - which basically means
any positive amplitude meeting the "valid" cases will count as a detected
I have re-worked mod_avmd.c to:
1. Calculate the frequency only once every 10ms (sine len).
2. Calculate the running variance of frequency over the required beep
length (100ms) - ie. last 10 estimates.
This is producing good results - would welcome comment & if anyone else can
try it that would be great. Could be further tided up as it doesn't really
require a circular buffer for samples at all - could just do the desa2
calculation direct from the sample buffer, at least once per frame (2 per
frame for 8000kHz, 20ms frames). Also, goertzel.c isn't used by the module
at all, and amplitude.c isn't used in my version and can be removed.
Raised as http://jira.freeswitch.org/browse/FS-4090 with proposed patch.
-------------- next part --------------
An HTML attachment was scrubbed...
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users