Linear FM with nonsinusoidal signals

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

When it comes to linear FM for nonsinusoidal signals, I wonder which formula is common and preferred.

Lets assume we have a modulator f(t) and a waveform function used as the carrier, g(phi) for normalized phase phi, 0 <= phi < 1.

Then applying real "linear FM" would read:

w(t) = w0 + f(t)*fm_gain

phi(t) = integral(w(t)dt) modulo 1

y(t) = g(w(t)*t)=g((w0*t+integral(f(t)dt)*fm_gain) modulo 1)

That is real linear frequency modulation, but it changes the shape with pitch, because the integrator is a lowpass.

The other solution is to use pm, just as classical linear FM (yamaha) can be regarded as PM (for sinusoidal signals).
In that case,

y(t) = g(phi(t)) = g(w0*t + pm_gain*f(t))

But just judging according to the outcome (listening), it is not so easy to tell which version would be regarded as "better sounding" linear FM as it used in modern synthesizers (Prophet12, Peak), (apart from exponential FM of course, which is a different story).

Does anyone know more about it?

Post

so sad nobody cares ...

there is another variant using a relative, but linear FM

y(t) = g(w(t)*t)=g(w0*(1+fm_gain*integral(f(t)dt)*t modulo 1)

I did some tests

The third variant is consistent for timbre over the range, since the frequency is changed in a relative manner (w0 is weighted with the modulator), but has some strange sporadic clicks if you use sawtooth as carrier and square as modulator, independent of sampling rate (high oversampling does not help).

The second version sounds more interesting, but has audible steps as the pitch is decreased. The first version, actually PM, is most consistent, but can sound quite boring at times.

Post

Phase modulation of complex waveforms (other than sines) by complex waveforms is much similar to distortion.
In fact in the case of a carrier with a zero frequency it is a distortion.

One interest for PM of complex waveforms rather than FM is that you can use Differentiated Polynomial WaveTables combined with oversampling to limit aliasing efficiently.
https://stash.reaper.fm/28384/Different ... Tables.pdf
See you here and there... Youtube, Google Play, SoundCloud...

Post

Smashed Transistors wrote:Phase modulation of complex waveforms (other than sines) by complex waveforms is much similar to distortion.
In fact in the case of a carrier with a zero frequency it is a distortion.

One interest for PM of complex waveforms rather than FM is that you can use Differentiated Polynomial WaveTables combined with oversampling to limit aliasing efficiently.
https://stash.reaper.fm/28384/Different ... Tables.pdf
Thx. Maybe I posted in the wrong subforum, focussing on DSP rather than on plugins. What I am doing is an FPGA synth. The sampling rate is way beyond 10 MHz to avoid any sort of aliasing problems.

I realized that simple PM is probably not what is actually used in a typical DX synth. To find out more, I am gonna compare Matlab output with PX7. As long as you have only one carrier, one modulator, the difference between PM and FM is marginal. But when you use something like Modulator -> Modulator -> Carrier, the difference between FM and PM should be obvious. And there is feedback! I checked PM-wise feedback in the past, which results in the typical transformation from a sine wave to a sawtooth wave. But I have to check FM-wise feedback as well. Sounds a bit like reverse engineering, but the final algrithm will have much more.

Post

Technically "FM" is really just equivalent to differentiated linear frequency modulation. Things break down completely once you factor in sampling and other issues though so examining the problem from a pure mathematical point of view is somewhat pointless.

Honestly speaking the perfect mathematical implementation is boring and that shouldn't be considered surprising. Most of the action that occurs in the "classic FM" sounds is due to all the imperfections. So if you take away all those imperfections and render a perfect implementation you're left with very little at all.

That brings to mind the real issue here: if you want to do "FM" you need to model all those imperfections accurately. Something like the DX7 is famous not just because of the general technique mathematically speaking but for the sum of all its parts. The keytracking, the odd envelope behavior, odd voice allocation strategy (different depending upon mono/poly and portamento modes) and odd as well as particular configurations involved such as the wavetable used which differs significantly between chips and various imperfect emulations.

Technically speaking "perfect FM" is possible by replacing samples with windowed sinc impulses and by computing modulation via windowed sinc integrals. Unfortunately and predictably: the result is rather uninteresting and not much of the "FM timbre" is left once you remove all the imperfections.

It's not far from emulating an "old sampler timbre" by simply sampling and reproducing the samples on modern equipment. Modern equipment is so close to perfect that even measuring the imperfections has become difficult on high quality devices which are commonplace today. That "old sampler timbre" is 100% about imperfections and 0% about sampling.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.

Post

aciddose wrote:Technically "FM" is really just equivalent to differentiated linear frequency modulation. Things break down completely once you factor in sampling and other issues though so examining the problem from a pure mathematical point of view is somewhat pointless.

Honestly speaking the perfect mathematical implementation is boring and that shouldn't be considered surprising. Most of the action that occurs in the "classic FM" sounds is due to all the imperfections. So if you take away all those imperfections and render a perfect implementation you're left with very little at all.

That brings to mind the real issue here: if you want to do "FM" you need to model all those imperfections accurately. Something like the DX7 is famous not just because of the general technique mathematically speaking but for the sum of all its parts. The keytracking, the odd envelope behavior, odd voice allocation strategy (different depending upon mono/poly and portamento modes) and odd as well as particular configurations involved such as the wavetable used which differs significantly between chips and various imperfect emulations.

Technically speaking "perfect FM" is possible by replacing samples with windowed sinc impulses and by computing modulation via windowed sinc integrals. Unfortunately and predictably: the result is rather uninteresting and not much of the "FM timbre" is left once you remove all the imperfections.

It's not far from emulating an "old sampler timbre" by simply sampling and reproducing the samples on modern equipment. Modern equipment is so close to perfect that even measuring the imperfections has become difficult on high quality devices which are commonplace today. That "old sampler timbre" is 100% about imperfections and 0% about sampling.
Well, from initial simulations (Matlab) I can assure you that it's not boring at all. Imagine you have sufficient sampling rate and processing power that you don't have to use BLEPs and all kind of tricks to overcome your bandlimited system, no sinc integrals of whatever. All not necessary. And a square wave remains a square wave. Plus a bit analog modelling and you get something new and exciting. I was just a bit unsure wheter yamaha did PM or FM. And the system breaks down into noise through FM feedback much later. I am not so much interested into modelling vintage gear, but exploring sound territories unheard before. ;) But backward compatibility would be a big plus, but I guess it would end up in hard work.

By the way, why is the envelope behavior odd? Because of the more complex curve? From what I understand, it's basically exponential. And the point is that they save a lot of envelopes by using one gain envelope for each operator, so there are 6 envelopes. But my approach goes a different direction. If you look at other products like Peak (Novation), there is a mod gain, not a NCO gain, leaving each NCO to be just mixed to output (or modulated with another envelope).

Post

The "curve" is linear but that gets passed through a table at multiple points to change the effect. You can find it modeled fairly well in Dexed I believe although I can't tell you whether they've attempted to model envelope behaviors beyond that.

What I'm referring to is for example the multiple stages and how timing is affected when the initial stage is used for delay for example. Most emulations *points sternly at FM8* fail completely here and this is an important aspect of the DX7 where as someone who owns the keyboard or its rack versions you'll quickly find the software doesn't accurately reproduce sounds given the same preset/parameter data.

For example there are a few sounds like "gongs" or "water chimes" where this delay effect is used that get played back without delay or remain completely silent on FM8. Since you can control individual operator pitches directly and you have six available, it means you can actually play six discrete "notes" by timing the delay and decay correctly for each operator. So it's possible for the DX7 to play a six note sequence using pure sine tones with a single voice for example.

The pitch envelope has some interesting applications due to this too where it's very important and I believe there are deeper differences based upon which envelope is used and whether it's a carrier or modulator operator.

I couldn't go into much detail without playing with the DX7 for a few weeks and that's something I'm just not interested in wasting my time on :)
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.

Post

Note that early Yamaha DX synths hardware did not used multipliers. They used logarithms and exponentials to get tricks done. That means that everything was non linearly quantized (control and audio signals). I think it substancially contributes to the particular noisy grain of the DX series.
See you here and there... Youtube, Google Play, SoundCloud...

Post

aciddose wrote:The "curve" is linear but that gets passed through a table at multiple points to change the effect. You can find it modeled fairly well in Dexed I believe although I can't tell you whether they've attempted to model envelope behaviors beyond that.

What I'm referring to is for example the multiple stages and how timing is affected when the initial stage is used for delay for example. Most emulations *points sternly at FM8* fail completely here and this is an important aspect of the DX7 where as someone who owns the keyboard or its rack versions you'll quickly find the software doesn't accurately reproduce sounds given the same preset/parameter data.

For example there are a few sounds like "gongs" or "water chimes" where this delay effect is used that get played back without delay or remain completely silent on FM8. Since you can control individual operator pitches directly and you have six available, it means you can actually play six discrete "notes" by timing the delay and decay correctly for each operator. So it's possible for the DX7 to play a six note sequence using pure sine tones with a single voice for example.

The pitch envelope has some interesting applications due to this too where it's very important and I believe there are deeper differences based upon which envelope is used and whether it's a carrier or modulator operator.

I couldn't go into much detail without playing with the DX7 for a few weeks and that's something I'm just not interested in wasting my time on :)
That is interesting. What kind of delay do you mean? I think the Env can produce a delay by having the first two levels of the curve at zero. Or do you mean processing delay of the hardware? I only understand that delay in the feedback path will destabilize your FM system you will get oscillation. So better to keep delay as low as possible. LP filter helps also.

Post

Smashed Transistors wrote:Note that early Yamaha DX synths hardware did not used multipliers. They used logarithms and exponentials to get tricks done. That means that everything was non linearly quantized (control and audio signals). I think it substancially contributes to the particular noisy grain of the DX series.
In better FPGAs you have hundreds of multipliers. If you don t use them, you have a badly balanced design wasting ressources. :wink: Such early digital synths are certainly cool but if somebody wants to have that sound he should either buy a software imitate or the original machine, a DX7. I have the reface DX, cool little synth. But the old DX7 sound is not far away from the reface.

Post

Check out MAME's source code for the Yamaha OPM/OPP (used in dx21/27/100/fb-01):
https://github.com/mamedev/mame/blob/ma ... d/ym2151.h
https://github.com/mamedev/mame/blob/ma ... ym2151.cpp

I can confirm that it's VERY CLOSE to the real thing (should sound the same but not bit perfect - contact us at Plogue if you want to license a bit perfect version).

All the Yamaha synths use PM, there is no frequency modulation whatsoever.

The process of calculating an operator goes as follows:
- Add all volume drop sources (op_vol = volume_reg + envelope + tremolo...).
- Advance oscillator phase (phase_reg += frequency)
- Add modulation in (phase_in = phase_reg + mod_in)
- Calculate the sine wave (sine = sine_table[phase_in])
- Amplify by the volume drop (op_out = exp_table[op_vol] * sine)

It's possible to use a log(sin) table instead of sin() to optimize out the multiplication (Yamaha does this), or to approximate sin() with a polynomial to remove all the lookup tables (the clone chip in the SoundBlaster awe64 does this).

Post

synthpark wrote:That is interesting. What kind of delay do you mean? I think the Env can produce a delay by having the first two levels of the curve at zero.
They don't need to be equal (at zero), the difference between them influences the time between them in a slightly complex way.

This is I think why so many emulations fail to match the envelope behavior. Someone could possibly go in and figure out the exact bitwise steps to reproduce the behavior but it would take a lot of effort. I've heard although not experienced it myself that the effect depends upon whether the operator is a carrier or modulator and whether the envelope is magnitude or pitch, too.

This is reputed to be due to the fact the DX7 is not a software implementation running on a general purpose CPU but rather a discrete bitwise logic implementation using two chips connected by a bus.

You can find schematics of the SID chip for example which is very much alike: it's a discrete logical circuit built in CMOS rather than processor using registers/operators.

The whole envelope is actually not an ADSR but is instead a four point envelope with {time, value} pairs. So you have 1 (A), 2 (D1), 3 (D2), 4 (S/hold, no data), 5 (R) but the application of each stage is fairly arbitrary. This is similar to the envelopes in the D50 that came out shortly afterward.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.

Post

If your modulator is non-sinusoidal, PM discontinuities obviously breed output discontinuities, whereas in FM it will be smoothed since the carrier phase integrates the frequency fluctuations

Is the third formula designed to ensure the correct mean f0?

Personally I thought most used the second formula you listed.

There's another way that only creates sidebands above f0, not a simple function though if I recall

What interests me about PM is how the phase of the modulator affects the resulting phase spectrum. I still haven't found an explanation for that.

Post Reply

Return to “DSP and Plugin Development”