What is the difference between frequency modulation and phase modulation?

DSP, Plug-in and Host development discussion.
User avatar
DJ Warmonger
KVRAF
4392 posts since 7 Jun, 2012 from Warsaw

Post Sun Oct 17, 2021 4:07 am

Many plugin developers claim that their synths do "true" FM instead of PM, or else.

Now this article on WIkipedia reads that
For a single large sinusoidal signal, PM is similar to FM
This is my intuition as well. Phase and frequency are interchangeable. Or not? Please explain this to me.
Blog ------------- YouTube channel
Tricky-Loops wrote: (...)someone like Armin van Buuren who claims to make a track in half an hour and all his songs sound somewhat boring(...)

Z1202
KVRian
1383 posts since 12 Apr, 2002

Post Sun Oct 17, 2021 4:11 am

Phase is the integral of frequency over time. For sinusoidal signals integration changes the amplitude and phase, but preserves the sinusoidal shape otherwise. In that sense they are kinda interchangeable, up to the phase and amplitude adjustments. For other signals they are "less" interchangeable, because also the modulator waveform needs to be changed in order to keep the equivalence.

With FM there can be further variations: linear/exponential, thruzero/clipping etc. With phase its usually always linear and nonclipping, the variations are not as natural as for frequency.

Lorenzo90
KVRer
5 posts since 12 Oct, 2021 from Italy

Post Mon Oct 18, 2021 1:29 am

Z1202 wrote:
Sun Oct 17, 2021 4:11 am
Phase is the integral of frequency over time. For sinusoidal signals integration changes the amplitude and phase, but preserves the sinusoidal shape otherwise.
I second this. It took me a while to get a grasp on this as well. If you have a signal x(t) = sin(w*t) and a modulation signal f(t) then:

  • x(t) = sin(w*t + f(t)) is phase modulation
  • x(t) = sin(w*t + \int_0^t f(s)ds) is frequency modulation


Since frequency is the derivative of the phase, the instantaneous frequency of phase modulation will be w + f'(t), the instantaneous frequency of frequency modulation will be w + f(t). This is why it appear as more "natural" to us, because with FM the changes in the frequency of the signal reflect exactly the modulation signal (on the other hand, in PM the changes reflect the drivative of f!).


In a digital oscillator, the difference is simply where you add the modulation.

It can be seen by writing the single update of digital ramp oscillator:

PM:

Code: Select all

float phaseTick(float freq, float PM) // freq and PM both normalized in [0, 1], output is in [0, 1]
{
	phase = phase + freq; //phase is initialized at 0
	phase = frac(phase); //frac is the fractional part
	
	return frac(phase + PM);
}
FM:

Code: Select all

float phaseTick(float freq, float FM) // freq and FM both normalized in [0, 1], output is in [0, 1]
{
	phase = phase + freq + FM; //phase is initialized at 0
	phase = frac(phase); //frac is the fractional part
	
	return phase;
}
So, in the case of PM the modulation does not get added permanently to the phase, but just to the current output, in the case of FM, the modulation is indeed added to the phase and stored in there, so that the next modulation will add to the previous one and so on (thus realizing the integral, aka the sum, of the modulating signal.
Lorenzo from Italy. Developer, Mathematician

imrae
KVRAF
1965 posts since 2 Jul, 2010

Post Mon Oct 18, 2021 1:52 am

In usage, a big practical difference is that any DC bias in the modulator (from an asymmetric waveform, say, or an imperfect analogue VCA) will lead to audible detuning as the FM depth is increased, whereas with PM the fundamental pitch should be unaffected.

Z1202
KVRian
1383 posts since 12 Apr, 2002

Post Mon Oct 18, 2021 2:35 am

Actually, just realized that the equivalence is probably also broken if connecting serially more than 2 sinusoidal oscillators, since the modulator waveform is no longer a sine then.

urosh
KVRist
339 posts since 4 Oct, 2002

Post Mon Oct 18, 2021 2:43 am

Z1202 wrote:
Mon Oct 18, 2021 2:35 am
Actually, just realized that the equivalence is probably also broken if connecting serially more than 2 sinusoidal oscillators, since the modulator waveform is no longer a sine then.
It is. It is also broken as soon as you apply envelope on modulator level. It's now integral of sine()*env(), not just sine(), fast/short env will produce additional modulation of the carrier (it might be roughly equivalent of differential of modulator's volume envelope as additional modulation of carrier's frequency).

So, PM != FM in practice.

mystran
KVRAF
6758 posts since 12 Feb, 2006 from Helsinki, Finland

Post Tue Oct 19, 2021 3:52 pm

If for "some reason" you happen to have an oscillator that cannot easily handle PM, but you would still like all the great advantages of PM, then there's a very easy solution: just pass the control signal through a differentiator. Now your oscillator can do FM and still produce the same results as a PM oscillator.

But wait, it gets better. After differentiating the signal you can (soft-)clip it, to limit the maximum instantaneous frequency. This can help combat aliasing, but it'll introduce some phase drift. This then can be avoided (over time) by doing error feedback (ie. feed back the difference between original and clipped control signal to the next sample).

But wait, it gets better. Why settle for just the choices between PM and FM when you could blend between these arbitrarily! See, instead of using a pure differentiator, design a highpass that's just a DC blocker (or even completely flat if you feel like it) with cutoff at minimum and a differentiator with cutoff at maximum. When set to minimum cutoff, you've got "true FM" (but without the fundamental shift if you let the filter DC block) and at maximum cutoff you've got PM.

Those are my 2 cents on FM, but feel free to experiment further.
Preferred pronouns would be "it/it" because according to this country, I'm a piece of human trash.

User avatar
Markus Krause
KVRian
1158 posts since 2 Jul, 2018

Post Fri Oct 22, 2021 12:41 am

Nemesis can do both. You can download the free demo and directly compare the results:

https://www.tone2.com/nemesis.html

"From a technical point of view, conventional 'FM synthesizers' actually use phase modulation to generate sound - but for historical marketing reasons they are advertised as 'FM synthesizers'. The traditional method, however, is limited to bell-like sounds and often produces an unpleasant, metallic sound.
Some analog synthesizers can do true FM. However, this suffers from the lack of precision of the oscillators, which creates an inharmonic sound that is not particularly useful musically.
The innovative NeoFM approach combines the advantages of both worlds without taking over the respective weaknesses. It is now easier than ever to get great sounding results."


It also goes one step further: neoFM is completely aliasfree and does not suffer from any drift.
Tone2 Audiosoftware https://www.tone2.com

User avatar
foosnark
KVRAF
6034 posts since 9 Jan, 2003 from Saint Louis MO

Post Wed Dec 01, 2021 7:05 pm

Markus Krause wrote:
Fri Oct 22, 2021 12:41 am
"From a technical point of view, conventional 'FM synthesizers' actually use phase modulation to generate sound - but for historical marketing reasons they are advertised as 'FM synthesizers'. The traditional method, however, is limited to bell-like sounds and often produces an unpleasant, metallic sound.
Markus Krause wrote:
Fri Oct 22, 2021 12:41 am
Some analog synthesizers can do true FM. However, this suffers from the lack of precision of the oscillators, which creates an inharmonic sound that is not particularly useful musically.
Weird generalizations there.

"Bell-like" or "metallic" or "unpleasant" depends entirely on the frequency ratio and modulation depth, whether it's FM or PM. You're not going to get "bell-like" at a 1:1 frequency ratio :hihi:

Any analog VCO can do "true FM," unless it's just a fixed frequency clock (like a divide-down organ maybe).

Of course in many cases it will be exponential FM, which isn't good for dynamic timbres as in Chowning/Yamaha FM synthesis. But it is great for some rich tones, which can be completely stable and clean and clear as long as the carrier and modulator track reasonably well. With oscillator sync or a PLL or other trickery you can get some form of dynamic and semi-stable FM working even this way, which is fun :D

Linear FM on analog oscillators typically has limited depth of modulation before it skews the tuning sharp. (Because an analog VCO's core is based on charging/discharging a capacitor, it can't go "backwards" if you push the core frequency below 0Hz.) TZFM (thru-zero linear FM) is available on a few analog VCOs, using some extra circuitry to invert the phase -- but in my experience is less than perfect. (Really badly less than perfect in the case of Doepfer A-110-4.) But both TZFM and PM are super easy on a digital oscillator.

If you hear Dr. John Chowning talk about FM, he won't mention exponential FM, TZFM etc. at all -- because he discovered FM using computers. It was all linear modulation, and negative frequencies just plain work. You can subtract from a phase accumulator just as well as you can add to it, no problem.

The DX7 does phase modulation because it's super simple. Take your phase accumulator output -- a rising sawtooth -- and just add the modulator output to it before doing the sine table lookup. And you can do the same in analog circuits; most wavefolders work approximately well enough, and this is how Happy Nerding FM Aid works.

I love FM, play with it all the time in many forms, in modular hardware and software... :D

mystran
KVRAF
6758 posts since 12 Feb, 2006 from Helsinki, Finland

Post Wed Dec 01, 2021 7:39 pm

foosnark wrote:
Wed Dec 01, 2021 7:05 pm

Linear FM on analog oscillators typically has limited depth of modulation before it skews the tuning sharp. (Because an analog VCO's core is based on charging/discharging a capacitor, it can't go "backwards" if you push the core frequency below 0Hz.) TZFM (thru-zero linear FM) is available on a few analog VCOs, using some extra circuitry to invert the phase -- but in my experience is less than perfect. (Really badly less than perfect in the case of Doepfer A-110-4.) But both TZFM and PM are super easy on a digital oscillator.
Right. The most common VCO is a "sawtooth core" that basically feed a capacitor from a voltage-controlled current-source (whether linear or 1V/oct) and a comparator that rapidly discharge the capacitor when it hits a certain threshold. This is a very simple design, but it's kinda hard to get it to run backwards.

As far as I'm aware, most of the "thru-zero" analog VCOs (at least the better ones) instead use a triangle core that always charges the same way, just swapping the direction twice per cycle, which apparently makes it easier to go into negative frequencies as well as you're already capable of charging in either direction, but such a triangle core is more complicated (and I guess more demanding on component tolerances; your basic saw-core can be pretty much trash and still sound fine as long as the 1V/oct tracking isn't too far off) to begin with.
Preferred pronouns would be "it/it" because according to this country, I'm a piece of human trash.

User avatar
S0lo
KVRian
976 posts since 31 Dec, 2008

Post Tue Dec 07, 2021 10:06 am

The problem (or advantage depending on your view) with exponential FM is that it immediately goes out of tune at the slightest of modulation depth. This happens at each and every harmonic in the spectrum. I think thats why it isn't easy to get musical results out of it without further processing. Though, It's easier to do percussive sounds with it.

You'd see it more often used in west coast synthesis. Producing say bongo sounds with LPGs and things. Less more often in bread and butter subtractive synthesis.

User avatar
karmafx
KVRist
102 posts since 21 Sep, 2004

Post Mon Dec 27, 2021 12:46 am

Excellent topic and question!

I recently wrote a paper on the different FM types, covering Linear FM, Phase Modulation and Exponential FM: https://karmafx.net/pubs#fm
Direct download: https://karmafx.net/docs/karmafx_DAFx2020_paper_61.pdf

The main take-away is that, while it is true that Linear FM and Phase Modulation sound the same, there are some advantages to Phase Modulation: Namely that it doesn't detune, and that it doesn't require through-zero (LTZ). Now Phase modulation on the other hand doesn't allow for Exponential FM, so this is where "true" FM might come in handy. The paper also dives into fixing the mentioned Exponential FM tuning problem, and touches on anti-aliasing.

imrae
KVRAF
1965 posts since 2 Jul, 2010

Post Mon Dec 27, 2021 1:44 am

Very helpful paper, thanks for sharing. The on-the-fly DC correction idea seems like it would be nice for modular systems :-)

User avatar
karmafx
KVRist
102 posts since 21 Sep, 2004

Post Mon Dec 27, 2021 2:13 am

imrae wrote:
Mon Dec 27, 2021 1:44 am
Very helpful paper, thanks for sharing. The on-the-fly DC correction idea seems like it would be nice for modular systems :-)
Thank you! Yes, exactly. The analytic DC correction was added to KarmaFX Synth Modular 2 last year, while adding true through-zero FM (TZFM). It's called Exponential Sync (EXS), and in many cases I prefer the sound of this Synced Exponential FM to Linear FM/Phase Modulation.

Shabdahbriah
KVRAF
7650 posts since 19 Jun, 2008 from Seattle

Post Mon Dec 27, 2021 2:44 am

karmafx wrote:
Mon Dec 27, 2021 2:13 am
imrae wrote:
Mon Dec 27, 2021 1:44 am
Very helpful paper, thanks for sharing. The on-the-fly DC correction idea seems like it would be nice for modular systems :-)
Thank you! Yes, exactly. The analytic DC correction was added to KarmaFX Synth Modular 2 last year, while adding true through-zero FM (TZFM). It's called Exponential Sync (EXS), and in many cases I prefer the sound of this Synced Exponential FM to Linear FM/Phase Modulation.
Very interesting paper. 8)

{glad you popped in here, as it reminded me to upgrade to v2} :party:
I'm not a musician, but I've designed sounds that others use to make music. http://soundcloud.com/obsidiananvil

Return to “DSP and Plug-in Development”