FM and phase modulation, quality issues (clicks and pops)

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

Post

Hi,

first post in this forum so if i'm in a wrong section or something, please let me know.

I'm trying to build a custom FM softsynth, involving phase modulation which is allegedly used in most available hard- and software FM synths on the market (NI's FM8, Yamaha DX etc...)
When applying envelopes to the modulation index, i tend to get a lot of clicks and pops. The lower the pitch, and the faster the rate of change of the index, the noisier it gets.
I compared it with a proper FM algorithm (modulating the freq. of the carrier instead of the phase) and it's a lot cleaner than phase modulation.
This is not very surprising considering the effect of a quick jump in phase on a sine osc. but it leaves me wondering how professional developers deal with this issue in commercial products.

I found out you can reduce the clicks by applying various kinds of smoothing to the envelopes or to the modulator output but this doesn't feel very satisfactory for sharp transients / percussive sounds.

If someone has knowledge on this subject i'd be happy to discuss it.
If more details are needed please let me know.

Thanks by advance

Post

Hi LN08,

https://soundcloud.com/thierry-rocheboi ... modulation

very fast attacks can cause discontinuities which effect is emphasized by phase modulation.
A good old trick consists in updating the amplitude of the modulator on the zero crossings of the modulator signal.
See you here and there... Youtube, Google Play, SoundCloud...

Post

Hi

thanks a lot for answering. I get the same sort of clicks as in your first example, seems like you've nailed it.
I've just tried it but couldn't make it work: could you please develop how you implemented the zero crossing detection ?

I've never used Axoloti but i make my patches in MAX/MSP's GEN environment, so i'm pretty sure i can replicate it.

Best regards

Post

I do not use Max. Thus i browsed some info on the web to get an idea of its syntax.

I think that you can implement a classic "DCA on zero crossings" with something like this:

Code: Select all


// DCA0X
// DCA on zero crossings
// in1 is the audio signal
// in2 is the envelope signal

History pastIn(0);
History gain(0);

// zero crossing
//if((in1 >= 0 && pastIn < 0) || (in1 < 0 && pastIn >= 0)){
// which is equivalent to the simpler form
if((in1 >= 0) != (pastIn >= 0)){
  gain = in2;
}
pastIn = in1;
out1 = in1 * gain;

The gain of the DCA is only updated on the zero crossings of the input signals.
This avoids discontinuities of the output.
See you here and there... Youtube, Google Play, SoundCloud...

Post

Hi

I found what i did wrong : it wasn't my zero-crossing detection, i misplaced a sample & hold module. Just one of those stupid mistakes...
While we're at it, since i don't use codeboxes, i do the zero crossing part as follows:
- take a 1 sample delay of in1 (History module)
- multiply it by current in1 value
- if result <= 0 then s&h gain value

The improvement in quality is spectacular, so loads of thanks for taking the time to answer !

Another thing i've tested in the meantime is to put a simple one pole lp just after the modulator signal: it sounds surprisingly close to "real FM", to the point where i can't hear any difference. The drawback is that it messes with mod. index values in a bad way.

Think i'll stick with your idea, PM gives a bit more bite to the sound on sharp transients, which is what i was after.

Post

Great !


That makes sense: The phase is the integral of the (angular) frequency and integration is a kind of low pass filter. So it is quite logical you get a result much similar to FM.
See you here and there... Youtube, Google Play, SoundCloud...

Post

That's right, with phase integration you don't have to worry about smoothing. That's why i tried it, but still i didn't expect it to look so close.

Attached are 5 sonograms showing some results. 1 to 4 coming from MAX MSP patch, with pitch set to 55 Hz, C:M ratio 1:1, modulation index coming from a fast looping envelope with sharp transients.
1 = naive PM without declicking: the clicks are very visible.
2 = PM with declicking.
3 = FM.
You do not have the required permissions to view the files attached to this post.

Post

...
4 = PM + 1 pole LP smoothing.

5 is a similar example using NI's FM8 with a very fast envelope. I'd say it looks very similar to PM with your declicking algo.

Best regards
You do not have the required permissions to view the files attached to this post.

Post

This old trick - updating some parameters on zero crossings - can be used in other circumstances. For example to avoid glitches in fast modulation of high pass filters (low pass filters are much less prone to glitches).
See you here and there... Youtube, Google Play, SoundCloud...

Post

Yes tbh i feel a bit stupid cause i already knew about it, been using it for various other things but didn't think of latching the envelope to the modulator in this context. Never did audio rate mod. of filters but i can see why it would be useful.
Thx

Post

Would that include updating the actual freq mod on zero crossing?

Post Reply

Return to “DSP and Plugin Development”