Script for creating a frequency sweep

"I have to find a formula for a sinewave that sweeps from 1 kHz to 12 kHz in 60 seconds while ramping the amplitude from 1 to 12 volts in the same amount of time."

The absolute amplitude in volts cannot be handled, of course, but linear crescendo is easy:

Create Sound from formula: "sweep", 1, 0, 60, 44100,
... ~ 0.05 * (1 + 11 * x/60) * sin (2*pi * (1000 + 11000/2 * x/60) * x)

Note the "/2" in this formula. Here is the derivation of the formula:

frequency (t) = 1000 + 11000 t / 60
phase (t) = ∫ frequency (t) dt = 1000 t + 11000 (t2/2) / 60
signal (t) = sin (phase (t))

Links to this page


© ppgb, September 4, 2017