DSPRelated.com
Forums

Log sweep enveloppe coefs.

Started by Michel Rouzic February 16, 2006
I'm not sure the title is very explicit on what i'm trying to do, so
here goes the explanation

I have a log frequency sweep with a flat enveloppe. I am trying to
change its enveloppe in a way that would make higher frequencies louder
so that each frequency gets as much energy (or power, i dont know
which) so that when I autocorrelate it (i mean convolve it with its
timely reversed version) it results in a pure delta function.

The problem for me is to know how to calculate the enveloppe
coefficients in order to turn my log chirp into what i'm looking for.
I'm pretty sure it's a simple question, but I don't have the
mathematical knowledge to find out by myself.

Michel Rouzic wrote:
> I'm not sure the title is very explicit on what i'm trying to do, so > here goes the explanation > > I have a log frequency sweep with a flat enveloppe. I am trying to > change its enveloppe in a way that would make higher frequencies louder > so that each frequency gets as much energy (or power, i dont know > which) so that when I autocorrelate it (i mean convolve it with its > timely reversed version) it results in a pure delta function. > > The problem for me is to know how to calculate the enveloppe > coefficients in order to turn my log chirp into what i'm looking for. > I'm pretty sure it's a simple question, but I don't have the > mathematical knowledge to find out by myself.
The inverse of a log is an exponential; hard to use without unlimited dynamic range. You want the result of a linear sweep. Why not start with one? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Jerry Avins wrote:
> Michel Rouzic wrote: > > I'm not sure the title is very explicit on what i'm trying to do, so > > here goes the explanation > > > > I have a log frequency sweep with a flat enveloppe. I am trying to > > change its enveloppe in a way that would make higher frequencies louder > > so that each frequency gets as much energy (or power, i dont know > > which) so that when I autocorrelate it (i mean convolve it with its > > timely reversed version) it results in a pure delta function. > > > > The problem for me is to know how to calculate the enveloppe > > coefficients in order to turn my log chirp into what i'm looking for. > > I'm pretty sure it's a simple question, but I don't have the > > mathematical knowledge to find out by myself. > > The inverse of a log is an exponential; hard to use without unlimited > dynamic range.
Maybe, but i'm not going from frequency 0 to 0.5 or something, i'm going from 0.00045 to 0.5, which is way doable (if I had a log sweep ranging from 0 to 0.5 i'd be in trouble anyways, since it'd have to be infinite). I approched the solution by autocorrelation and deconvolution, but as you could guess the deconvolution introduced a load of crap, so I want to do it the simplest way by calculating what enveloppe to multiply it with to get to what I want. I thought about using a linear sweep, and I did it, but it's way unpractical. To get to a decent resolution in the low frequencies, I need to make it quite long, so long that it makes my program that processes it take about 20 minutes to make a one minute of CPU time calculation due to virtual memory issues. With a log sweep I can use a much shorter sweep while having a better resolution, without having the half of it dedicated to high frequencies that really don't need so much resolution, and then I could process the signal in about 20 seconds. I just need to know how to calculate that enveloppe so that autocorrelating the sweep would result in a delta function, and from what i tried before, I can tell that the lower frequencies wouldn't be so attenuated compared to the higher ones.
Michel Rouzic wrote:

   ...

> Maybe, but i'm not going from frequency 0 to 0.5 or something, i'm > going from 0.00045 to 0.5, which is way doable (if I had a log sweep > ranging from 0 to 0.5 i'd be in trouble anyways, since it'd have to be > infinite).
Doable how? To bring the signal up on the high end you need 60 dB gain. How many bits to you have?
> I approched the solution by autocorrelation and > deconvolution, but as you could guess the deconvolution introduced a > load of crap, so I want to do it the simplest way by calculating what > enveloppe to multiply it with to get to what I want.
Not just guess: predict. But you have to learn the hard way. I applaud you for that.
> I thought about using a linear sweep, and I did it, but it's way > unpractical. To get to a decent resolution in the low frequencies, I > need to make it quite long, so long that it makes my program that > processes it take about 20 minutes to make a one minute of CPU time > calculation due to virtual memory issues. With a log sweep I can use a > much shorter sweep while having a better resolution, without having the > half of it dedicated to high frequencies that really don't need so much > resolution, and then I could process the signal in about 20 seconds.
So use a few linear sweeps at different rates for different bands. A piecewise-linear approximation to your log sweep. Actually, you call it a log sweep because you plot it on log paper. The sweep rate actually increases exponentially with time, and so must the gain needed to linearize the result to a per-Hertz basis.
> I just need to know how to calculate that enveloppe so that > autocorrelating the sweep would result in a delta function, and from > what i tried before, I can tell that the lower frequencies wouldn't be > so attenuated compared to the higher ones.
I just told you. Make the gain proportional to sweep rate in Hz/sec. (Gain High)/(Gain Low) = .5/.00045 = 10,000/9 ~= 10 bits. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Jerry Avins wrote:
> Michel Rouzic wrote: > > ... > > > Maybe, but i'm not going from frequency 0 to 0.5 or something, i'm > > going from 0.00045 to 0.5, which is way doable (if I had a log sweep > > ranging from 0 to 0.5 i'd be in trouble anyways, since it'd have to be > > infinite). > > Doable how? To bring the signal up on the high end you need 60 dB gain. > How many bits to you have?
IEEE-754 32 bits. However, I just looked at the DFT of my log sweep in the polar form, and in it, the magnitude around 0.5 is only 31 dB under the magnitude at 0.00045, so i thought that to compensate it would basically have to make -in the time domaine- the amplitude of the beginning of the sweep about 31 dB under the amplitude of the last part of it.
> > I approched the solution by autocorrelation and > > deconvolution, but as you could guess the deconvolution introduced a > > load of crap, so I want to do it the simplest way by calculating what > > enveloppe to multiply it with to get to what I want. > > Not just guess: predict. But you have to learn the hard way. I applaud > you for that.
Thx!
> > I thought about using a linear sweep, and I did it, but it's way > > unpractical. To get to a decent resolution in the low frequencies, I > > need to make it quite long, so long that it makes my program that > > processes it take about 20 minutes to make a one minute of CPU time > > calculation due to virtual memory issues. With a log sweep I can use a > > much shorter sweep while having a better resolution, without having the > > half of it dedicated to high frequencies that really don't need so much > > resolution, and then I could process the signal in about 20 seconds. > > So use a few linear sweeps at different rates for different bands.
Well i thought about that, and actually tried doing that with Adobe Audition, but I faced one of the weirdest bug I ever seen. Between two sweeps, meeting each other at 400 Hz (the samerate being 44,100 Hz), well the second sweep starts a bit faded, so I tried cutting it that short faded part to make the signal more continuous, only, once I cut that part, the wave before and the wave after the cut saw it's shape being modified, I mean the sample values actually changed, as they had no reason to. Weird. That's why i gave up that however nice idea and went for the log sweep.
> A > piecewise-linear approximation to your log sweep. Actually, you call it > a log sweep because you plot it on log paper. The sweep rate actually > increases exponentially with time, and so must the gain needed to > linearize the result to a per-Hertz basis. > > > I just need to know how to calculate that enveloppe so that > > autocorrelating the sweep would result in a delta function, and from > > what i tried before, I can tell that the lower frequencies wouldn't be > > so attenuated compared to the higher ones. > > I just told you. Make the gain proportional to sweep rate in Hz/sec. > (Gain High)/(Gain Low) = .5/.00045 = 10,000/9 ~= 10 bits.
So that's why you said that the low end would have to be about 60 dB lower than the high end, right? the 10 bits is for the min resolution I need I guess. Well I'll try generating the envelope according to that tomorrow and see if i can get my pure delta function by autocorrelating the resulting sweep. thanks alot for help!
Michel Rouzic wrote:

   ...

> So that's why you said that the low end would have to be about 60 dB > lower than the high end, right? the 10 bits is for the min resolution I > need I guess. Well I'll try generating the envelope according to that > tomorrow and see if i can get my pure delta function by autocorrelating > the resulting sweep. thanks alot for help!
I had the idea that this was for establishing speaker response. How will you get that range in a real room without overload and without getting swamped by noise? That's what makes the methods of correlating white noise and lock-in sweep (staircase for digital systems) so attractive. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Michel Rouzic wrote:
> I'm not sure the title is very explicit on what i'm trying to do, so > here goes the explanation > > I have a log frequency sweep with a flat enveloppe. I am trying to > change its enveloppe in a way that would make higher frequencies louder > so that each frequency gets as much energy (or power, i dont know > which) so that when I autocorrelate it (i mean convolve it with its > timely reversed version) it results in a pure delta function. > > The problem for me is to know how to calculate the enveloppe > coefficients in order to turn my log chirp into what i'm looking for. > I'm pretty sure it's a simple question, but I don't have the > mathematical knowledge to find out by myself.
You indicate that you have Adobe Audition. If it is the end result that you are most interested in rather than the learning exercise you should obtain Angelo Farina's Aurora package. Among the plugins provided is one that will generate a log or linear sweep of any length and bandwidth. It also generates the matching sweep and leaves it in either the clipboard or on one of a stereo track pair, I can't remember which. Aurora also has a convolution plug that can handle much larger sequences than the convolution function that is in Audition 1.0. If you choose to use Aurora for free, rather than completing an operation it randomly and not very frequently crashes Audition but it does so in a way that the error restart capability of Audition brings you back to exactly where you were. I used it for years and with considerable frequency this way and was not particularly hampered by the idiosyncrasy. Of course you can send him money for a key that removes the restriction. Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein
Jerry Avins wrote:
> Michel Rouzic wrote: > > ... > > > So that's why you said that the low end would have to be about 60 dB > > lower than the high end, right? the 10 bits is for the min resolution I > > need I guess. Well I'll try generating the envelope according to that > > tomorrow and see if i can get my pure delta function by autocorrelating > > the resulting sweep. thanks alot for help! > > I had the idea that this was for establishing speaker response. How will > you get that range in a real room without overload and without getting > swamped by noise? That's what makes the methods of correlating white > noise and lock-in sweep (staircase for digital systems) so attractive.
I know, that's a problem. That's why I think I should like play and record the log sweep unmodified, and then afterwards correlate it with the original log sweep with it's enveloppe modified so that the result of the correlation would result in a pure delta function provided that the recorded sweep is exactly like the original unmodified log sweep. Correlating white noise? sounds like a very good idea, didn't even get near to think about that possibility. So correlating the noise after it has passed through the linear system with the original white noise would give me directly the impulse response of my linear system, is that it? if so then I gotta go for it. Just wondering tho, what will I do with the kinda noise surrounding the central bins? chop it off at some point and window what's left? or keep it all?
Bob Cain wrote:
> Michel Rouzic wrote: > > I'm not sure the title is very explicit on what i'm trying to do, so > > here goes the explanation > > > > I have a log frequency sweep with a flat enveloppe. I am trying to > > change its enveloppe in a way that would make higher frequencies louder > > so that each frequency gets as much energy (or power, i dont know > > which) so that when I autocorrelate it (i mean convolve it with its > > timely reversed version) it results in a pure delta function. > > > > The problem for me is to know how to calculate the enveloppe > > coefficients in order to turn my log chirp into what i'm looking for. > > I'm pretty sure it's a simple question, but I don't have the > > mathematical knowledge to find out by myself. > > You indicate that you have Adobe Audition. If it is the end result that > you are most interested in rather than the learning exercise you should > obtain Angelo Farina's Aurora package. Among the plugins provided is > one that will generate a log or linear sweep of any length and > bandwidth. It also generates the matching sweep and leaves it in either > the clipboard or on one of a stereo track pair, I can't remember which.
I tried that, but then I found out you could make log sweep directly with Audition (u got a box to check on the second tab in the tone generator). What is the matching sweep tho?
> Aurora also has a convolution plug that can handle much larger sequences > than the convolution function that is in Audition 1.0.
Never tried any of both. I convolve with my own fast convolution C function, but having a couple of 10 million bins long double arrays in memory can result in quite a big load (although mine was just twice as much as I calculated, which is quite weird I admitt, I must have forgot to free() something but can't see what)
> If you choose to use Aurora for free, rather than completing an > operation it randomly and not very frequently crashes Audition but it > does so in a way that the error restart capability of Audition brings > you back to exactly where you were. I used it for years and with > considerable frequency this way and was not particularly hampered by the > idiosyncrasy. Of course you can send him money for a key that removes > the restriction.
Yeah, that thing about Aurora is weird, sometimes it would let me generate sweeps without bothering me, sometimes it would just shut Audition down. there's something I noticed about Aurora's sweep generation tho, i'm not sure (i'd have to check) but it seemed to me that it calculated the values for your sweep in 16 bits, as my file was in 32-bit float. Audition's built in generator doesn't seem to have this problem.
Jerry Avins wrote:
> Michel Rouzic wrote: > > ... > > > So that's why you said that the low end would have to be about 60 dB > > lower than the high end, right? the 10 bits is for the min resolution I > > need I guess. Well I'll try generating the envelope according to that > > tomorrow and see if i can get my pure delta function by autocorrelating > > the resulting sweep. thanks alot for help! > > I had the idea that this was for establishing speaker response. How will > you get that range in a real room without overload and without getting > swamped by noise? That's what makes the methods of correlating white > noise and lock-in sweep (staircase for digital systems) so attractive.
um... just tried correlating white noise, it just gives me noise. When self correlating the original white noise it gives me a clear delta function surrounded by white noise about 52 dB under, but when I correlate the recorded white noise with the original white noise, I can't even spot a bin that detaches itself from the rest of the noise. Correlating white noise isn't just about doing what I just did i hope?