# How to calculate a sine sweep – the wrong way

This blog post has moved to https://matthewvaneerde.wordpress.com/2009/08/03/how-to-calculate-a-sine-sweep-the-wrong-way/

Tags

1. auddhav says:

Ramanujan the gifted mathematician once said with pride that he has invented —— (i don't remember) which will be of no practical use. But alas it did find uses elsewhere!

2. Aaron says:

First, I implemented this and it works just fine for "reasonable" lengths of time. I implemented in C# using (8-byte) doubles. Secondly, I think there's a better (easier to implement, easier to describe, and perhaps more "correct") approach :-)

Generally (regardless of the frequency function), the function s(t) can be expressed as

s(t) = a * sin(2 * pi * i(t));

where t is time, a is amplitude, sin is our favorite sine function, pi is … pi, i is the integral of the frequency function from 0 to t. So, if

f(t) = s(k^t)

where f is the frequency function, t is time, s is the starting frequency, and k is the konstant ((endfreq – startfreq)/length), i is

i(t) = s( ( k^t-1 )/( ln(k) ) )

(Sorry, I'm not sure how to typeset that better) where ^ is the power function, and ln is the natural log function.

How does this relate to your answer ? I have to go now, but plan on looking at this post more soon.

3. Aaron says:

"gets very big, very quickly." I don't think so. Although some term is brought to the "t" power, that term was already brought to the "1/t_end" power meaning that the resultant power is no bigger than 1.

It looks like we are at the same approach, although you've explored the special case of exponential frequency change.

4. Viktor Stolbovoy says:

First 2 members inside sin is const from t – it is initial phase.

The third member is just 2*pi*Wstart * Tend/ln(Wend/Wstart)

The fourth member if (Wend/Start)^(t/Tend) – exponent is always in (0, 1] interval