signal-processingsound-synthesis

What is wrong with my FM synth implementation?


I'm trying to get an FM synth to work, the synth uses wavetable oscillators, I am adapting the formula for FM synthesis:

enter image description here

To use wavetable oscillators as carrier and modulator, so I am doing something like this pseudo-code:

freq = 220;
osc1.set_frequency(freq)
signal1 = osc1.process()

osc2.set_frequency(freq + signal1 * freq * 12) // where 12 is the modulator index
signal2 = osc2.process()

output = signal2

The result kinda works, for single chain modulation, eg A->B or A->B;C->B the results are the same as other vsts. However when doing chained modulation C->A->B the results are unexpected, besides feedback B<->B does not work.

With some research I get the impression its possible that other synths (FM8, Sytrus, Toxic, Dexed, Exakt etc..) implement PM instead of FM, nonetheless they all sound similar with the same modulations and I can't get a similar sound using my method (also tried setting the phase using the same method with the same results).

Here is a working JSFX demo of the method I'm using, with three oscillators and FM controls. It can be opened in Reaper DAW. https://stash.reaper.fm/v/47880/FmTest.zip


Solution

  • I think I've found the solution, I switched to phase modulation instead and the trick is to use a phaseOffset instead of modulating the phase directly. Found the trick on this sourcecode: https://github.com/victorzheleznov/p...on-synthesizer

    In this example I am able to apply signal feedback with the same result as other vsts.

    osc1.setfrequency(freq);
    osc1.setphase(phase1 + signal * 0.25);
    signal = osc1.process();
    phase1 += freq / srate;
    phase1 > 1 ? phase1 -= 1;
    

    Here is a demo of the modulation where results are very close to other vsts. https://stash.reaper.fm/v/47887/fmtest.zip