Re: volume detection/monitoring of WAVE files



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
.



Relevant Pages

  • Re: volume detection/monitoring of WAVE files
    ... > basic.net so I'd really appritiate any code samples or anything to be in vb ... > 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. ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: Think I want a console (dorsey, rivers, et al, please respond!)
    ... Here's a link to the manual from Soundcraft: ... is normally what you monitor when you're tracking. ... pressing the TAPE buttons on the main channels routes the ... An in-line console has the monitor level ...
    (rec.audio.pro)
  • Re: Sum of three primaries < Monitor white?
    ... I never wrote that the digital counts of three channels ... that three digital counts are linear. ... exactly equal) to the native monitor white. ... This would be only the case if the intensity of a single channel, ...
    (sci.engr.color)
  • Load Question
    ... I am running Fedora Core 1 with Squid as a Caching Server for about 2000 ... It is an older Dell Server and I wanted to monitor the load on the ... During the peak hours, one will run maxed at around 99% while the ... on the 1 minute avg during normal usage, but in peak hours it has gotten as ...
    (linux.redhat)
  • Re: SRM 350
    ... Sherm wrote: ... little SRM150 monitor. ... of the pa head while the other 3 channels get the mics. ... there's a break point at four mic inputs. ...
    (rec.music.makers.guitar.acoustic)