The typical way FM synths (and for example function generators) generate a sine wave would be DDS (Direct digital synthesis).
You basically just have an array with all the values of a sine inside (or a quarter of a sine if you want to save memory) and then you jump through that array based on a phase accumulator (basically a counter). The amount by which you increment that phase accumulator (=phase step) determines the pitch of the resulting sine wave that this lookup gives you. So you basically add that phase step repeatedly and read out the current sine value at the current phase accumulator/index with a timer interrupt. Th
This operation is quite cheap, I once made a osciallator with 9 of these on an Arduino Nano (fixed point numbers tho).
Now the clou is that you could just add some amount of the result of another of those sine lookups to the phase accumulator, which results in the typical FM sound. Technically this is actually phase modulation, but hey technically the most famous FM synth uses also phase modulation.
FM is designed to be calculated digitally, and with a few hacks (like a lookup table for a function involving sin() and log()) can be calculated very cheaply.
In the DX7 it was done on custom digital circuitry, but modern CPUs are just as happy to do a few additions and a table lookup once in a while.
I think the reason the DX stuff broke out besides the different sound was they could do it on a cpu at the time and have a lot of voices without incurring the hardware transitor cost for each voice as much. I'm not an audio programmer but I've heard trying to emulate subtractive synthesis can be difficult.
In the github section the author somewhat alludes to this : "Next, there is "subtractive" synthesis (not really a surprise after "additive" synthesis, is it?). It involves taking a waveform with many harmonics (triangular wave, sawtooth wave, etc) and using a time-varying filter to remove the higher harmonics. I tried that too once, but it wasn't great either, at least for the effort involved in coding and tweaking the parameters."
The killer feature of FM synthesis is generation of inharmonic sounds. Classic analog waveforms (sawtooth/square/triangle/sine) are all perfectly harmonic, i.e. the frequencies of the higher harmonics are at integer multiples of the fundamental. Subtractive synthesis shapes the amplitudes of these harmonics but doesn't add any new ones.
Subtractive synthesis is still musically useful, because most musical instruments are harmonic or almost harmonic, but tuned percussion is a notable exception. It's very difficult to get a good bell sound out of subtractive synthesis. FM can produce inharmonic sounds, where the higher harmonics are at non-integer multiples of the fundamental. It's much easier to get good bell/chime sounds out of FM synthesis.
And the "almost harmonic" instruments are very popular (all plucked or hammered string instruments, with the inharmonicity more pronounced with thicker strings, so especially bass and piano). By adding a little inharmonicity, FM synthesis can produce more realistic versions of these sounds than subtractive synthesis.
Additive synthesis can also produce inharmonic sounds, but this requires an oscillator for each harmonic, so back when FM synthesis first hit the market this was unreasonably expensive.
I've certainly never been able to make a decent bell sound with a subtractive synth. As for FM synths, I rarely have to because there's so many good presets out there but I've accidentally made bell patches just messing around.
> I've heard trying to emulate subtractive synthesis can be difficult.
Just filtering frequencies isn't that difficult, but to get a digital filter sounding equivalent to a specific analog audio filter is an art.
There's an entire industry trying to recreate the 'character' of certain imperfections found in old synthesizers.
Some FM synthesizers also have subtractive filters. There are even analog synthesizers with FM so it's not an either/or.
It's funny, the whole analog vs digital thing I personally can't tell the difference that often with EXCEPT the filter.
I have a digital synth with a digital filter that's great but I feel like I have to put a lot more work into the filter parameters to make it sound good.
I also have a digital synth with an analog filter and I find I don't have to play with the filter much at all. It sounds pretty good in pretty much every case.
Sorry my mistake, I was trying to say that the individual oscillators/filters/etc add up in cost (at least that's often what analog synth companies say when people ask about low voice counts)
I'm assuming an ASIC has a similar cost savings to a CPU or FPGA?
Additive synthesis was a pain to configure. I had to model and estimate the behavior of each harmonic. It was too much effort.
Subtractive synthesis didn't work that well for me either. I believe my implementation of the variable cut off lowpass filter had something to do with it.
FM Synthesis worked reasonably well without much effort. Implementation was rather straightforward.
You basically just have an array with all the values of a sine inside (or a quarter of a sine if you want to save memory) and then you jump through that array based on a phase accumulator (basically a counter). The amount by which you increment that phase accumulator (=phase step) determines the pitch of the resulting sine wave that this lookup gives you. So you basically add that phase step repeatedly and read out the current sine value at the current phase accumulator/index with a timer interrupt. Th
This operation is quite cheap, I once made a osciallator with 9 of these on an Arduino Nano (fixed point numbers tho).
Now the clou is that you could just add some amount of the result of another of those sine lookups to the phase accumulator, which results in the typical FM sound. Technically this is actually phase modulation, but hey technically the most famous FM synth uses also phase modulation.