Re: volume detection/monitoring of WAVE files
- From: NoSpam@xxxxxxxxxxx (Bob Masta)
- Date: Wed, 02 Nov 2005 13:02:43 GMT
On Tue, 1 Nov 2005 08:47:05 -0500, "Chris P. [MVP]"
<msdn@xxxxxxxxxxxx> wrote:
>On Mon, 31 Oct 2005 14:38:07 -0800, cas_angel wrote:
>
>> I'm new to windows programming and am in the process of learning visual
>> basic.net so I'd really appritiate any code samples or anything to be in vb
>> if possible.
>>
>> I want to write some code to monitor a wave file that has two channels to
>> see if there is any time when both channels are in use at the same time. I
>> think the best way to do this is to monitor the volume of each channel for
>> the duration of the WAVE. Can anyone give me any help how to monitor the
>> volumes of both channels of a wave file?
>
>This is a little harder than you might think depending on the purpose of
>the monitoring. For a simple peak meter style monitor it is easy enough.
>Scan the data in 25 or 50ms blocks, record the peak absolute value for each
>channel in the given block (yes the values are signed). Convert the peak
>sample value to the dB scale using
>20 * log10((double)nPeak/m_dwRange)
>where m_dwRange is max sample value (32768 for 16-bit). If you need more
>resolution decrease the block size.
>
<snip>
Since the OP just wants to detect activity, he could simplify
this by skipping the dB conversion and comparing the peak
absolute values to some threshold. If both are over the
threshold then in that given block both channels are in
use "at the same time". The threshold should be made
adjustable, so it can be set just higher than whatever
background noise is present.
The "same time" test will of course depend upon the
block size. If you have large blocks, then the simple
peak comparison will tend to give false positives:
The channels may be alternating within the block,
never active at the same time, but will both register
peaks within the same block. The block size should
thus be set to the minimum resolution needed.
Note that this block size need have nothing to do
with the waveIn buffer block size, etc.
Best regards,
Bob Masta
dqatechATdaqartaDOTcom
D A Q A R T A
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Home of DaqGen, the FREEWARE signal generator
.
- References:
- Re: volume detection/monitoring of WAVE files
- From: Chris P. [MVP]
- Re: volume detection/monitoring of WAVE files
- Prev by Date: Re: convert pcm to mp3
- Next by Date: Re: waveOutOpen with CALLBACK_EVENT example?
- Previous by thread: Re: volume detection/monitoring of WAVE files
- Next by thread: waveInOpen: buffers are always completely full or empty?
- Index(es):
Relevant Pages
|