Re: How to detect noise activity on a PCM stream 16 bits, 16khz mono

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




Chris P. [MVP] wrote:
On Wed, 7 Jun 2006 12:41:09 +0200, DevX wrote:

Hi,

Ok. Thanks. I figured out this.

My concern now is to know what I have inside this sample. If I have an high
(abs) value of the 2-bytes integer, this mean that I have activity and
silence around 0?

Absolute silence would be zero yes, but you will see lots of fluctuation.
In order to see changes on an even audio scale you should convert to the
logarithmic dB scale. The best way to do that is to evaluate the data in
small blocks, finding the absolute peak in each block and then converting
that peak value to a dB value using the following.

double dbVal = 20 * log10((double)nLower/m_dwRange);

where m_dwRange is 32768 for 16-bit shorts.

The dbVal result will have a range of -INF to 0. You can clip the -INF to
-96.0 as that is the effective range for 16-bit. You can then compare the
changes in these dB values in a linear fashion.


Note that you don't need to convert the data to dB unless you want to
view it
on a linear-dB scale during development, to help you find a reasonable
threshold value. However, if you have a threshold control, you may
want to have
it operate in dB for smoother user interaction. Then use the reverse
of the above
to convert the dB value to a linear +/-32767 value to use as a working
threshold.
Then all you need to do during the run is take the absolute value of
each sample.

Depending on the particular application and the exact type of noise,
you might
want a fancier threshold than instantaneous absolute value. Our ears
are not as responsive to very short spikes as to waves with more
energy, and the ear also
has a frequency response which makes it more sensitive to noise in the
1-4 kHz range. So you could apply an "A-Weighting" filter to the data
to make it better
match the auditory response. But I'd go with the simple threshold
first because
it is *so* much simpler, and only get more exotic if absolutely
needed.

Best regards,

Bob Masta

.



Relevant Pages

  • Re: where did Jadallah gather the commerce below the occupational triangle
    ... studying the circuit's absolute approval and Imran will demonstrate you! ... the mammal will thank in response to the ... eras enhance, provoke, and formulate. ... mixing let alone the supermarket now, ...
    (sci.crypt)
  • Re: The Faistos disc tradegy
    ... I did not find your decipherment. ... You don't have absolute any ... >evidence that Linear A and the PD have prefixes. ...
    (sci.archaeology)
  • Re: Help with envelope detector for compressor
    ... CS being compressor slope which it gives the formula as ... When the threshold is given in linear units, ... signal are (ie how to print them to an output console or ...
    (comp.dsp)
  • Re: length contraction + closed space paradox?
    ... A distinction needs to be drawn here between linear and angular motion. ... Absolute linear velocity is meaningless, ... Lorentz contraction is physical. ... In a closed static universe, you can build an object that spans the ...
    (sci.physics.relativity)
  • Re: Absolute max
    ... When 50% of the audience has left, there is risk for imminent failure of the concert. ... I've heard people say that you should stay at most 50% of the absolute values. ... A regular light-bulb will half its life time when the voltage is raised only 5%. ... like LEDs and electrical engines will work more like there is a threshold that when passed dramatically shortens the life. ...
    (rec.music.theory)