I'm familiar with audio synthesis, oscillators etc. I'm now trying to implement my own software algorithm to do FM as described by https://en.wikipedia.org/wiki/Frequency_modulation.
What I have implemented outputs the following (spectrogram produced with sox
):
This was produced by my algorithm set with a property of: A 1200hz sine wave modulated by a 12hz sine wave.
However, I don't think this is actually 'correct' in what FM should do. I'm assuming I would see a 'signal' increasing and decreasing in frequency.
Is this correct? Or am I doing something wrong?
The way I am calculating the amplitude for each time point (code is written in Haskell):
fmSine :: Frequency -> Signal' -> Signal'
fmSine (Frequency hz) (Signal sng) = Signal (\t -> sin ( (sng t) + (hz* 2 * pi * t)))
Essentially I'm doing sin ((amplitudeOfModulationFrequency t) + hz * 2pi * t)
Where hz
is the frequency and amplitudeOfModulationFrequency t
is the amplitude at time t of the modulating frequency.