Re: How to detect noise activity on a PCM stream 16 bits, 16khz mono
- From: nospam@xxxxxxxxxxx
- Date: 8 Jun 2006 05:50:52 -0700
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
.
- References:
- How to detect noise activity on a PCM stream 16 bits, 16khz mono
- From: DevX
- Re: How to detect noise activity on a PCM stream 16 bits, 16khz mono
- From: Tsviatko Jongov
- Re: How to detect noise activity on a PCM stream 16 bits, 16khz mono
- From: DevX
- Re: How to detect noise activity on a PCM stream 16 bits, 16khz mono
- From: Chris P. [MVP]
- How to detect noise activity on a PCM stream 16 bits, 16khz mono
- Prev by Date: Re: MJPEG - Avi file
- Next by Date: Re: Determine WAV File Sample Rate in VB.NET
- Previous by thread: Re: How to detect noise activity on a PCM stream 16 bits, 16khz mono
- Next by thread: Re: How to detect noise activity on a PCM stream 16 bits, 16khz mono
- Index(es):
Relevant Pages
|