Forums

Looking for an automated method for plotting the amplitude envelope of an audio signal

Started by maxplanck October 18, 2007
>maxplanck wrote: > > ... > >> For the method that you described consisting of upsampling then taking >> absolute value, do you then simply connect the local maxima with a line
to
>> produce the envelope? Or is there a method for calculating a curve to >> connect the local maxima points? > >If the upsampled points are close enough, straight lines will do. >(Doubling the number of samples reduces the area between the chords and >the true curve by a factor of about four, etc.) If you intend to >interpolate, you may not need to upsample at all. Quadratic or cubic >interpolation will let you keep the sample points further apart. I >suspect that upsampling to the extent that straight lines do will be the
>simplest to implement correctly. Interpolation may be faster once tou >work it out. > >Jerry
Do you know of any software that can do this? I understand the algorithm, but I don't have knowledge of a computer programming language by which to implement it.
maxplanck wrote:
>>maxplanck wrote: >> >> ... >> >> >>>For the method that you described consisting of upsampling then taking >>>absolute value, do you then simply connect the local maxima with a line > > to > >>>produce the envelope? Or is there a method for calculating a curve to >>>connect the local maxima points? >> >>If the upsampled points are close enough, straight lines will do. >>(Doubling the number of samples reduces the area between the chords and >>the true curve by a factor of about four, etc.) If you intend to >>interpolate, you may not need to upsample at all. Quadratic or cubic >>interpolation will let you keep the sample points further apart. I >>suspect that upsampling to the extent that straight lines do will be the > > >>simplest to implement correctly. Interpolation may be faster once tou >>work it out. >> >>Jerry > > > Do you know of any software that can do this? I understand the algorithm, > but I don't have knowledge of a computer programming language by which to > implement it.
Have you looked at Scilab ( http://www.scilab.org/ ) yet? I may have to dare you to try it ;)
Richard Owlett wrote:
> maxplanck wrote: > [snip] >> Do you know of any software that can do this? I understand the >> algorithm, >> but I don't have knowledge of a computer programming language by which to >> implement it. > > > Have you looked at Scilab ( http://www.scilab.org/ ) yet? > I may have to dare you to try it ;)
Guess I will have to dare you into getting your programming feet wet ;) Have just done envelope detection in 20 lines of Scilab. [ *INCLUDING* generating and proving test case] Most advanced programing concept used was a loop.
maxplanck wrote:
>> maxplanck wrote: >> >> ... >> >>> For the method that you described consisting of upsampling then taking >>> absolute value, do you then simply connect the local maxima with a line > to >>> produce the envelope? Or is there a method for calculating a curve to >>> connect the local maxima points? >> If the upsampled points are close enough, straight lines will do. >> (Doubling the number of samples reduces the area between the chords and >> the true curve by a factor of about four, etc.) If you intend to >> interpolate, you may not need to upsample at all. Quadratic or cubic >> interpolation will let you keep the sample points further apart. I >> suspect that upsampling to the extent that straight lines do will be the >> simplest to implement correctly. Interpolation may be faster once you >> work it out.
> Do you know of any software that can do this? I understand the algorithm, > but I don't have knowledge of a computer programming language by which to > implement it.
You have several choices. 1. Get a free download of Octave http://www.gnu.org/software/octave/ or Scilab http://www.scilab.org/. Read the documentation that comes with it and ask here for what to do or in the program-specific newsgroup for how to do it. 2. Find a colleague who can give you a boost up. OR 3. Hire a professional. To upsample, insert the requisite number of zeros between each pair of original samples, then low-pass filter the result. The original data had no information above half the original sample rate*, and the upsampled data must not have any either. Hence the filter. Jerry ____________________________________ * Even if you thought it did. Proper sampling requires that such information be removed *before sampling* to avoid corrupting the data with aliases. After sampling, it is too late. -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
>Richard Owlett wrote: >> maxplanck wrote: >> [snip] >>> Do you know of any software that can do this? I understand the >>> algorithm, >>> but I don't have knowledge of a computer programming language by which
to
>>> implement it. >> >> >> Have you looked at Scilab ( http://www.scilab.org/ ) yet? >> I may have to dare you to try it ;) > >Guess I will have to dare you into getting your programming feet wet ;) > >Have just done envelope detection in 20 lines of Scilab. >[ *INCLUDING* generating and proving test case] > >Most advanced programing concept used was a loop.
Richard, would you mind sharing your code?
maxplanck wrote:
>>Richard Owlett wrote: >> >>>maxplanck wrote: >>>[snip] >>> >>>>Do you know of any software that can do this? I understand the >>>>algorithm, >>>>but I don't have knowledge of a computer programming language by which > > to > >>>>implement it. >>> >>> >>>Have you looked at Scilab ( http://www.scilab.org/ ) yet? >>>I may have to dare you to try it ;) >> >>Guess I will have to dare you into getting your programming feet wet ;) >> >>Have just done envelope detection in 20 lines of Scilab. >>[ *INCLUDING* generating and proving test case] >> >>Most advanced programing concept used was a loop. > > > > Richard, would you mind sharing your code?
*WHEN* you've tried ;) I'll give a hint by listing the Help headings for ALL keywords I used: abs brackets colon comments comparison diff end equal for matrices parenthesis plot2d plus semicolon sin star PS I subscribe to "Give a man a fish, he eats for a day. Teach him to fish ..."
>maxplanck wrote: >>>Richard Owlett wrote: >>> >>>>maxplanck wrote: >>>>[snip] >>>> >>>>>Do you know of any software that can do this? I understand the >>>>>algorithm, >>>>>but I don't have knowledge of a computer programming language by
which
>> >> to >> >>>>>implement it. >>>> >>>> >>>>Have you looked at Scilab ( http://www.scilab.org/ ) yet? >>>>I may have to dare you to try it ;) >>> >>>Guess I will have to dare you into getting your programming feet wet
;)
>>> >>>Have just done envelope detection in 20 lines of Scilab. >>>[ *INCLUDING* generating and proving test case] >>> >>>Most advanced programing concept used was a loop. >> >> >> >> Richard, would you mind sharing your code? > >*WHEN* you've tried ;) > >I'll give a hint by listing the Help headings for ALL keywords I used: > >abs brackets colon comments comparison diff end equal >for matrices parenthesis plot2d plus semicolon sin star > >PS I subscribe to "Give a man a fish, he eats for a day. Teach him to >fish ..."
I'll give it a shot. I understand what you mean, but this may be the only dsp coding fish i'll ever need (so far i've been able to do everything i want to do with audio using the Reaktor software/visual programming language. This envelope calculation is the only thing so far that i've needed to do which Reaktor wasn't capable of (as far as i can tell)).
maxplanck wrote:

[ SNIP *MUCH* ;]
>>> >>>Richard, would you mind sharing your code? >> >>*WHEN* you've tried ;) >> >>I'll give a hint by listing the Help headings for ALL keywords I used: >> >>abs brackets colon comments comparison diff end equal >>for matrices parenthesis plot2d plus semicolon sin star >> >>PS I subscribe to "Give a man a fish, he eats for a day. Teach him to >>fish ..." > > > I'll give it a shot.
Right answer ;}
> > I understand what you mean, but this may be the only dsp coding fish i'll > ever need
*BUT* are there _other_ fish to be hooked?
> (so far i've been able to do everything i want to do with audio > using the Reaktor software/visual programming language. This envelope > calculation is the only thing so far that i've needed to do which Reaktor > wasn't capable of (as far as i can tell)).
Please understand that Jerry is a only few years older than I. AND he has held my feet to fire on occasion ;) *ROFL* ! I have not been following thread in detail. *BUT* I've noted Jerry's responses to you. My interpretation is that he thinks you are capable of solving your problem *AND* it's worthwhile to nudge you in "right" direction.
maxplanck wrote:

..
> I'll give it a shot. > > I understand what you mean, but this may be the only dsp coding fish i'll > ever need (so far i've been able to do everything i want to do with audio > using the Reaktor software/visual programming language. This envelope > calculation is the only thing so far that i've needed to do which Reaktor > wasn't capable of (as far as i can tell)).
I don't have Reaktor, but this is a little surprising. It might be called "envelope follower" or something similar; a necessary building block of any compressor/expander. There are three possible "standard" forms for an envelope follower or tracker based on the tracking method: peak, rms or average (all over some small sliding window of samples, perhaps 5msecs). And there is always Csound, of course! Richard Dobson
>maxplanck wrote: > >.. >> I'll give it a shot. >> >> I understand what you mean, but this may be the only dsp coding fish
i'll
>> ever need (so far i've been able to do everything i want to do with
audio
>> using the Reaktor software/visual programming language. This envelope >> calculation is the only thing so far that i've needed to do which
Reaktor
>> wasn't capable of (as far as i can tell)). > >I don't have Reaktor, but this is a little surprising. It might be >called "envelope follower" or something similar; a necessary building >block of any compressor/expander. There are three possible "standard" >forms for an envelope follower or tracker based on the tracking method: > peak, rms or average (all over some small sliding window of samples, >perhaps 5msecs).
Reaktor has an envelope follower, but the algorithm is a real time algorithm, which is the core reason why it's less accurate than the "absolute value then line between local maxima" method for the signals that i'm trying to analyze. A real time algorithm can't know when and where the next local maxima is going to be, it can only compute a guess for each successive sample based on the previous samples. The "absolute value then line between local maxima" method, being a non-real time method, knows where every local maxima occurs, and can draw a straight line between each one and its adjacent local maxima.