I\'m trying to Frequency modulate an audio signal. I can successfuly FM a sine wave (the carrier) with another sine wave (the modulator) by using the following equation y=co
Unfortunately I haven't been able to get Paul's method to work but I have a working solution for FM synthesis of audio signals. I did a lot of testing in Excel and realized how to do it. Here's the algorithm
for (i = 0; i < N; i++) {
// increase the frequency with increasing amlitudes (fc + fm)
if (input[i] < input[i+1])
out[i] = cos(acos(input[i]) + A * sin(2 * pi * mf * i));
else //decrease the frequency with decreasing amplitudes (fc - fm)
out[i] = cos(acos(input[i]) - A * sin(2 * pi * mf * i));
}
It works well but it does generate some undesirable harmonics (possibly due to rounding errors) so you may have to use some sort of a filter (a moving average might do a good job at reducing those unwanted harmonics). When applied to an audio signal, you will probably have to take the envelope of the audio and multiply it with the modulating signal so as not to apply FM on the quiet portions of the audio etc.