Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6737 Discussions

## Active Speech Level

Beginner
828 Views
Is there an IPP primitive to efficiently estimate the active speech level of a microphone input? Not necessarily only speech, but audio energy similar to how Windows Vista/7 displays a a logarithmic scale for the current volume of a speaker/microphone. I would like to distinguish an active G.711 source from an inactive one, and give a volume percentage for the active ones.
7 Replies
Employee
828 Views

Hi Martin,

Probably you are looking into some kind of Line Level functions, I dont think IPP has such type of function.

Thanks,

Naveen Gv

Employee
828 Views

Hi,

You can use following code to find audio signal level

{

Ipp32f tmpMinS,tmpMaxS;

Ipp32f m_PeakAmpdB;

ippsMinMax_32f(fileData, sizeSamples, &tmpMinS, &tmpMaxS);

Ipp32f maxAbsSample = IPP_MAX(fabs(tmpMinS),fabs(tmpMaxS));

if(maxAbsSample > 0) {

m_PeakAmpdB = 20.f * log10(maxAbsSample / 32768.f);

} else {

m_PeakAmpdB = -91.f;

}

}

Regards,

Naveen Gv

Beginner
828 Views
Thanks for the replies Naveen!

How does your code work? Could you explain where the 20.f and -91.f constants come from? Why do you measure dB negatively? I suppose -91dB represents silence whereas 0dB represents maximum volume; is that correct?
Employee
828 Views
Hi Martin,
You are right,

Amp(dB) = 20 lg(S/N), where S- random signal, N - noise

If S=1 then Amp(dB) = 20 lg(1/N) = -91 this is silence.

Thanks,
Naveen Gv

Beginner
828 Views
Hi,
What is mean of 32768.f here. Also this is you used for the 32 bit data. If I have 16 bit data what value we have to use.
Thanks,
Bharat Agarwal
Valued Contributor II
828 Views
>>...Why do you measure dB negatively?

A signal strength is measured in dB ( dBm in case of a radio signal, likeWi-Fi, etc )and it means that
a -50 dBsignal is stronger than a-70 dB signal.

Here is anexample for some abstract signal:

-10 dB could be considered as"Excellent"
-25 dB could be considered as"Very Good"
-50 dB could be considered as"Good"
-70 dB could be considered as"Poor"
-90 dB could be considered as"No Signal"

Best regards,
Sergey
Employee
828 Views
Hi,
Exactly, this is code for 16 bit data as32768.f is absolute maximum sample value for 16 bit sighned data.
You can change 32f function version to 16s to not doing data type convertion.

Igor S. Belyakov