Page 1 of 1

Expression for Log Scale Sweep Tone

Posted: Fri Oct 20, 2017 2:52 pm
by Dustin
I'm trying to develop an expression to produce a sweep tone that crawls along the logarithmic scale from frequency x to frequency f with an amplitude of y, based upon

sin(2*pi*f*t)

in which I substitute an exponential function for f to produce the sweep crawl. However, it doesn't seem to behave as I would expect.

Using x=20, f=20000, and y=1, and the epxression (so far):
y*sin(2*pi*(2^((log(x)/log(2))+((n/N)*((log(f)/log(2))-(log(x)/log(2))))))*t)

The following fragment of the expression produces 20Hz (value for x) sinewave (as I would expect)
y*sin(2*pi*(2^((log(x)/log(2))))*t)

The following modification of the expression produces 20kHz (value for f) sinewave (as I would expect)
y*sin(2*pi*(2^((log(x)/log(2))+((1)*((log(f)/log(2))-(log(x)/log(2))))))*t)

Yet if I substitute (n/N) for the (1) above, which I would expect to go from 0 to 1, causing the frequency to up the scale from x to f, the results crawl way beyond f, leaving me confused.

Can anybody offer any insight into what I am doing wrong?

Re: Expression for Log Scale Sweep Tone

Posted: Thu Oct 26, 2017 10:38 am
by GoldWave Inc.
The frequency varying function cannot be used directly. You need to use the integral of the frequency function.

Re: Expression for Log Scale Sweep Tone

Posted: Sat Dec 09, 2017 12:49 am
by Dustin
Thank you for the reply! I didn't receive notification that you had, but recently decided to revisit this project and found your reply.

I'll adjust the expression to use the integral variation and give it a shot. Thank you!

Re: Expression for Log Scale Sweep Tone

Posted: Wed Dec 12, 2018 9:21 pm
by Dustin
The following expression produces a sweep tone on log scale; x=duration in seconds, y=start frequency, f=end frequency. The first sample will be 0, the final sample may not (depending on how the end frequency lines up with axis crossing), so depending on how clean a transition is needed (for looping, etc...) may want to make the file a little longer and manually trim to zero-crossing.

sin(((2*pi*y*x)/(ln(f/y)))*(exp(((ln(f/y)*t)/x))-1))