Forums

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

Started by maxplanck October 18, 2007
maxplanck wrote:
> Thanks a lot for your responses guys, I really appreciate it. > > Can you recommend any software that can compute the amplitude envelope > using any of the better algorithms that you described? > > And/or can you recommend any software that can perform a crude amplitude > envelope approximation using the method that I described? > > > Right now I'm doing some experiments where the most accurate amplitude > envelope computation would be very useful. I'm trying to avoid getting > bogged down by having to learn complicated amplitude envelope calculation > methods... I just want to find software to perform the calculation as well > as possible. > > I understand that it's often important to understand the computational > algorithms that are being used in order to know what degree of accuracy > the results will have, but for the moment I don't need to do this... my > ears will tell me if the computational method is accurate enough.
I think you would find it hard even to define what the envelope of an audio waveform means. Can you say it in words without waving your arms or declaring, "You know, ..."? I guess that if you were to provide a description, I could find something that fulfilled it but would nevertheless not be what you want. Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
maxplanck wrote:
> Thanks a lot for this. > > I understand the logic, but I only program in Reaktor and Max/MSP so I > don't have knowledge of a computer language by which to implement this > program. I took a class in C++ in college, but that was 8 years ago. > > If I have to I'll learn a computer programming language and implement this > program that way, but I very much want to avoid getting bogged down by > this. > > Is there any software out there that can do this or a more > accurate/computationally expensive amplitude envelope calculation, to save > me from having to learn a programming language? > > Thanks again
I'd suggest looking into Scilab ( http://www.scilab.org/ ), it's a free and powerful system with a helpful group of users at comp.soft-sys.math.scilab I don't program much in anything beyond BASIC and last programing course I took use a computer with *discrete* transistors instead of vacuum tubes ;) I've found it useful. It has built in tools allowing you to demonstrate the points made in this thread.
>I think you would find it hard even to define what the envelope of an >audio waveform means. Can you say it in words without waving your arms >or declaring, "You know, ..."? I guess that if you were to provide a >description, I could find something that fulfilled it but would >nevertheless not be what you want. > >Jerry
I would define the "amplitude envelope" of a sine wave "wave1" of constant frequency "f" and time varying amplitude as the function which when multiplied by a sine wave of frequency "f" and amplitude=1, produces wave1. Make sense?
maxplanck wrote:
>> I think you would find it hard even to define what the envelope of an >> audio waveform means. Can you say it in words without waving your arms >> or declaring, "You know, ..."? I guess that if you were to provide a >> description, I could find something that fulfilled it but would >> nevertheless not be what you want. >> >> Jerry > > I would define the "amplitude envelope" of a sine wave "wave1" of constant > frequency "f" and time varying amplitude as the function which when > multiplied by a sine wave of frequency "f" and amplitude=1, produces > wave1. > > Make sense?
I know how to define the envelope of AM, which is what you just almost described. (The constant term is missing in your description. Your description is really of a double sideband suppressed carrier signal.) I don't know how do nail down the envelope of a full bandwidth audio signal. I can come close enough to design a decent compander, but that boils down to "what I get out of this circuit". Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
>maxplanck wrote: >>> I think you would find it hard even to define what the envelope of an
>>> audio waveform means. Can you say it in words without waving your arms
>>> or declaring, "You know, ..."? I guess that if you were to provide a >>> description, I could find something that fulfilled it but would >>> nevertheless not be what you want. >>> >>> Jerry >> >> I would define the "amplitude envelope" of a sine wave "wave1" of
constant
>> frequency "f" and time varying amplitude as the function which when >> multiplied by a sine wave of frequency "f" and amplitude=1, produces >> wave1. >> >> Make sense? > >I know how to define the envelope of AM, which is what you just almost >described. (The constant term is missing in your description. Your >description is really of a double sideband suppressed carrier signal.) I
>don't know how do nail down the envelope of a full bandwidth audio >signal. I can come close enough to design a decent compander, but that >boils down to "what I get out of this circuit". > >Jerry >-- >Engineering is the art of making what you want from things you can get. >¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ >
In that case, can you recommend any software that can calculate the envelope of AM for a narrow band audio signal? (the sidebands in the signals that i'm trying to analyze are within at most 10 hz from the carrier) The signals that i'm trying to analyze have sidebands that are not equidistant in frequency from the carrier. For example, say the carrier is at 100 hz. The upper sideband could be at 103.6 hz, whereas the lower sideband could be at 97 hz. Also, the amplitude of the lower sideband may not be equal to the amplitude of the upper sideband. Thanks again for responding
> > The signals that i'm trying to analyze have sidebands that are not > equidistant in frequency from the carrier. For example, say the carrier > is at 100 hz. The upper sideband could be at 103.6 hz, whereas the lower > sideband could be at 97 hz. Also, the amplitude of the lower sideband may > not be equal to the amplitude of the upper sideband. > > Thanks again for responding-
then what you have is not really pure AM but some combination of AM and PM (FM) i.e. angle modulation. are you trying to determine the envelope of this signal or to demodulate it?
maxplanck wrote:
>> maxplanck wrote: >>>> I think you would find it hard even to define what the envelope of an > >>>> audio waveform means. Can you say it in words without waving your arms > >>>> or declaring, "You know, ..."? I guess that if you were to provide a >>>> description, I could find something that fulfilled it but would >>>> nevertheless not be what you want. >>>> >>>> Jerry >>> I would define the "amplitude envelope" of a sine wave "wave1" of > constant >>> frequency "f" and time varying amplitude as the function which when >>> multiplied by a sine wave of frequency "f" and amplitude=1, produces >>> wave1. >>> >>> Make sense? >> I know how to define the envelope of AM, which is what you just almost >> described. (The constant term is missing in your description. Your >> description is really of a double sideband suppressed carrier signal.) I > >> don't know how do nail down the envelope of a full bandwidth audio >> signal. I can come close enough to design a decent compander, but that >> boils down to "what I get out of this circuit". >> >> Jerry >> -- >> Engineering is the art of making what you want from things you can get. >> ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ >> > > In that case, can you recommend any software that can calculate the > envelope of AM for a narrow band audio signal? (the sidebands in the > signals that i'm trying to analyze are within at most 10 hz from the > carrier) > > The signals that i'm trying to analyze have sidebands that are not > equidistant in frequency from the carrier. For example, say the carrier > is at 100 hz. The upper sideband could be at 103.6 hz, whereas the lower > sideband could be at 97 hz. Also, the amplitude of the lower sideband may > not be equal to the amplitude of the upper sideband. > > > Thanks again for responding
The simplest way to get a reasonably accurate envelope is upsampling the signal to the extent that none of the signal peaks are far from a sample, and then taking absolute value. Another way is using a Hilbert transformer with an odd number of taps (so the delay through it is a whole number of samples), delaying the original signal to match (the samples at the middle tap are so delayed) and computing the square root of the sum of the squares. (There are reasonable approximations for the square root of the sum of the squares, some of which are on http://www.dspguru.com. If you're approximating, though, you might as well upsample.) Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
> >> >> The signals that i'm trying to analyze have sidebands that are not >> equidistant in frequency from the carrier. For example, say the
carrier
>> is at 100 hz. The upper sideband could be at 103.6 hz, whereas the
lower
>> sideband could be at 97 hz. Also, the amplitude of the lower sideband
may
>> not be equal to the amplitude of the upper sideband. >> >> Thanks again for responding- > >then what you have is not really pure AM but some combination of AM >and PM (FM) i.e. angle modulation. > >are you trying to determine the envelope of this signal or to >demodulate it? > > >
i'm just trying to determine the envelope of the signal. i don't need to demodulate it thanks for responding
>maxplanck wrote: >>> maxplanck wrote: >>>>> I think you would find it hard even to define what the envelope of
an
>> >>>>> audio waveform means. Can you say it in words without waving your
arms
>> >>>>> or declaring, "You know, ..."? I guess that if you were to provide a
>>>>> description, I could find something that fulfilled it but would >>>>> nevertheless not be what you want. >>>>> >>>>> Jerry >>>> I would define the "amplitude envelope" of a sine wave "wave1" of >> constant >>>> frequency "f" and time varying amplitude as the function which when >>>> multiplied by a sine wave of frequency "f" and amplitude=1, produces >>>> wave1. >>>> >>>> Make sense? >>> I know how to define the envelope of AM, which is what you just almost
>>> described. (The constant term is missing in your description. Your >>> description is really of a double sideband suppressed carrier signal.)
I
>> >>> don't know how do nail down the envelope of a full bandwidth audio >>> signal. I can come close enough to design a decent compander, but that
>>> boils down to "what I get out of this circuit". >>> >>> Jerry >>> -- >>> Engineering is the art of making what you want from things you can
get.
>>>
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
>>> >> >> In that case, can you recommend any software that can calculate the >> envelope of AM for a narrow band audio signal? (the sidebands in the >> signals that i'm trying to analyze are within at most 10 hz from the >> carrier) >> >> The signals that i'm trying to analyze have sidebands that are not >> equidistant in frequency from the carrier. For example, say the
carrier
>> is at 100 hz. The upper sideband could be at 103.6 hz, whereas the
lower
>> sideband could be at 97 hz. Also, the amplitude of the lower sideband
may
>> not be equal to the amplitude of the upper sideband. >> >> >> Thanks again for responding > >The simplest way to get a reasonably accurate envelope is upsampling the
>signal to the extent that none of the signal peaks are far from a >sample, and then taking absolute value. Another way is using a Hilbert >transformer with an odd number of taps (so the delay through it is a >whole number of samples), delaying the original signal to match (the >samples at the middle tap are so delayed) and computing the square root >of the sum of the squares. (There are reasonable approximations for the >square root of the sum of the squares, some of which are on >http://www.dspguru.com. If you're approximating, though, you might as >well upsample.) > >Jerry
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?
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 -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯