Detect and extract audio envelope programmatically

All suggestions and links to relevant information are welcome here. This is the scenario:

Say I have a .wav file for someone speaking (and therefore all the samples associated with it).

I would like to run a series of sampling algorithm to determine when an event will occur, i.e. the beginning and end of an envelope. Then I would use this start and end point to retrieve data that will be used elsewhere.

What would be the best way to handle this? Any pseudo code? Code example? Source?

In the end I will write this in C.

Thanks!


EDIT 1

Parsing a wav file is not a problem. But some pseudo code for detecting the envelope would be nice! :)

+6
c audio signal-processing
source share
5 answers

The usual method:

  • take the absolute value of the waveform, abs (x [t])
  • low pass filter (e.g. 10 Hz cutoff)
  • apply threshold
+7
source share

You can use the same method as the old-fashioned analog counter. Correct the sample vector, transmit the result of the absolute value, although a low-pass filter (FIR, IIR, moving average, etc.), than to compare with a certain threshold. For a more accurate event time, you will need to subtract the group delay time of the lowpass filter.

Added: You may also need to first remove the DC (say, using a high-pass filter or another DC blocker, equivalent to capacitive coupling).

+3
source share

The source code for simple envelope detectors can be found in the Music-DSP Source Code Archive .

+1
source share

I wrote an activity detection class in Java. This is part of my open Java DSP collection .

+1
source share

first order low pass filter C # Code :

double old_y = 0; double R1Filter(double x, double rct) { if (rct == 0.0) return 0; if (x > old_y) old_y = old_y-(old_y - x)*rct/256; else old_y = old_y + (x - old_y) * rct/256; return old_y; } 

When rct = 2, it works like this: enter image description here

Signal = (ucm + ucm * ma * Cos (big_omega * x)) * (Cos (small_omega1 * x) + Cos (small_omega2 * x)) where ucm = 3, big_omega = 200, small_omega1 = 4, small_omega2 = 12 and ma = 0.8

Please note that the filter may change the phase of the baseband signal.

0
source share

All Articles