fm matrix - questions

DSP, Plug-in and Host development discussion.
KVRist
73 posts since 18 Nov, 2017

Post Fri Feb 26, 2021 4:59 am

hi coders,

i'd like to recreate something like Sytrus FM matrix in a work I'm doing.
im trying to figure out the best way to do this.

the idea is:
for each op, take the signal from the prev sample (i.e. x-1) and sum it with current phase, if modulated.

so for this scenario:

Image

starting with outOP1 = outOP2 = outOP3 = outOP4 = outOP5 = outOP6 = 0

at phase0:
outOP1 = osc1(phase0 + outOP1)
outOP2 = osc2(phase0 + outOP2)
outOP3 = osc3(phase0)
...

at phase1:
outOP1 = osc1(phase1 + outOP2 + outOP3)
outOP2 = osc2(phase1 + outOP1 + outOP2)
outOP3 = osc3(phase1)

and so on.

questions are:
1. is this approch correct? it would be light on cpu and guarantee also fm feedback
2. what about the first sample processed (i.e. phase0)? it won't be fm modulated at all; fm will effectively starts at phase1. can be considered ok? should i skip it? smooth since can introduce clicks?

it looks good for me, but that first sample "ignored" make me worry about...

thanks

User avatar
KVRAF
4128 posts since 7 Jun, 2012 from Warsaw

Post Fri Feb 26, 2021 5:07 am

Either you'll have to take previous sample, or for the current sample solve 6 x 6 system of equations which is probably suboptimal.

Regardless of what you choose, FM will produce heavy aliasing by its nature. So "quality" might not be something to die for in this scenario.
http://djwarmonger.wordpress.com/
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(...)

KVRAF
6233 posts since 12 Feb, 2006 from Helsinki, Finland

Post Fri Feb 26, 2021 5:23 am

Derozer wrote:
Fri Feb 26, 2021 4:59 am
questions are:
1. is this approch correct? it would be light on cpu and guarantee also fm feedback
It this "correct"? Not necessarily, but it's how it's usually done. If you're computing the oscillators in order (eg. top to bottom) then it's also possible to use the current sample in one direction (ie. "feed forward" connections) and the previous sample for "feedback" connections, but it doesn't necessarily matter much in most cases.
2. what about the first sample processed (i.e. phase0)? it won't be fm modulated at all; fm will effectively starts at phase1. can be considered ok? should i skip it? smooth since can introduce clicks?
Just treat the initial state as zero. You should normally have a non-zero envelope attack time to avoid clicks anyway, so it's not really a practical concern.
Preferred pronouns would be "it/it" because according to this country, I'm a piece of human trash.

KVRAF
6233 posts since 12 Feb, 2006 from Helsinki, Finland

Post Fri Feb 26, 2021 5:25 am

DJ Warmonger wrote:
Fri Feb 26, 2021 5:07 am
Either you'll have to take previous sample, or for the current sample solve 6 x 6 system of equations which is probably suboptimal.
I highly doubt there's a single synth that actually solves the delay-free loops in this case, because for a non-linear system like this you'd have to use something like Newton-Raphson and just getting it to converge would be a huge pain.
Preferred pronouns would be "it/it" because according to this country, I'm a piece of human trash.

KVRist

Topic Starter

73 posts since 18 Nov, 2017

Post Mon Mar 01, 2021 2:32 am

thanks all for the replies :)
mystran wrote:
Fri Feb 26, 2021 5:23 am
If you're computing the oscillators in order (eg. top to bottom) then it's also possible to use the current sample in one direction (ie. "feed forward" connections) and the previous sample for "feedback" connections, but it doesn't necessarily matter much in most cases.
won't this create a total/different output?

maybe I can't elaborate it mentally, but it seems that if i use the "actual" sample of the op (instead of the previous) it will generate (at time phase0) a total different output from operators, not just the same "shifted" by 1 sample.

i mean: wouldn't (using the "crazy" 6 x 6 system of equations solved on place) sounds totally different than use the prev samples as fm amount? I don't think that will result just shifted...

not that I care about if they will be differents (probably a matter of tastes), but just curious scientifically in regards of results :?:

KVRAF
6233 posts since 12 Feb, 2006 from Helsinki, Finland

Post Mon Mar 01, 2021 3:10 am

Derozer wrote:
Mon Mar 01, 2021 2:32 am
thanks all for the replies :)
mystran wrote:
Fri Feb 26, 2021 5:23 am
If you're computing the oscillators in order (eg. top to bottom) then it's also possible to use the current sample in one direction (ie. "feed forward" connections) and the previous sample for "feedback" connections, but it doesn't necessarily matter much in most cases.
won't this create a total/different output?

maybe I can't elaborate it mentally, but it seems that if i use the "actual" sample of the op (instead of the previous) it will generate (at time phase0) a total different output from operators, not just the same "shifted" by 1 sample.
At sample step i, you can either use the outputs of all operators at sample step (i-1) for modulation, or you can first compute op1, then use sample i of op1 to modulate the others (rather than i-1), then compute op2, then use sample i (rather than i-1) of op1 and op2 to modulate ops3+ and so on. This is literally just a 1 sample shift and in fact takes less state variables to implement (ie. you just keep the "last" output for each oscillator, but whether this "last" output is previous sample or current sample varies based on which operators have already been computed for current sample).

For emphasis, neither of these strategies involves anything fancy. It's just a matter of do you update the "last" sample for the oscillators one at a time as they are processed or do you update them all in bulk. The former is likely preferable in your average 80-90s micro while the latter has better SIMD potential.

Now.. does this 1 sample shift drastically change the sound of FM? No, not really. The effect of changing the phase of a modulator is usually fairly minor (which is why you can add some animation to FM sounds by detuning the modulator slightly with regards to the carrier, so their relative phases drift slowly over time).
i mean: wouldn't (using the "crazy" 6 x 6 system of equations solved on place) sounds totally different than use the prev samples as fm amount? I don't think that will result just shifted...
For feedback configurations, possibly (at least for larger feedback amounts). For feedforward configurations, not really.
Preferred pronouns would be "it/it" because according to this country, I'm a piece of human trash.

KVRAF
7075 posts since 17 Feb, 2005

Post Mon Mar 01, 2021 5:58 pm

I think the 1 sample delay does cause issues. FMing two signals with correlated (in-phase) large deltas tends to results in massive bandwidth expansion. I don't know how to say that better, but oversampling has always helped in this regard.

KVRist

Topic Starter

73 posts since 18 Nov, 2017

Post Sat Mar 27, 2021 4:49 am

DJ Warmonger wrote:
Fri Feb 26, 2021 5:07 am
Regardless of what you choose, FM will produce heavy aliasing by its nature. So "quality" might not be something to die for in this scenario.
But we can fight aliasing with oversampling, right?
Or in FM aliasing is appreciated?

User avatar
KVRAF
4128 posts since 7 Jun, 2012 from Warsaw

Post Sun Mar 28, 2021 1:11 am

Derozer wrote:
Sat Mar 27, 2021 4:49 am
DJ Warmonger wrote:
Fri Feb 26, 2021 5:07 am
Regardless of what you choose, FM will produce heavy aliasing by its nature. So "quality" might not be something to die for in this scenario.
But we can fight aliasing with oversampling, right?
Or in FM aliasing is appreciated?
Yes, oversampling is important. But with heavy FM you can go into MHz range, where no oversampling can help ¯\_(ツ)_/¯

I demonstrated this here: https://youtu.be/jfgRDh29Nl8?t=325
http://djwarmonger.wordpress.com/
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(...)

KVRer
28 posts since 6 Sep, 2017 from Altenvoerde

Post Sun Mar 28, 2021 2:59 am

Hi,

are you aware of Oxe FM? It is open source and has this sort of matrix. Perhaps you will want to look into its code.
Regards, tf-drone

User avatar
Urs
u-he
25462 posts since 8 Aug, 2002 from Berlin

Post Fri Apr 02, 2021 1:54 am

DX synthesisers average the past two samples for feedback, to avoid fast build up of chaotic spectra. I guess a synth with a feedback matrix would compute each oscillator one by one and average each input that results from previous steps. I.e. in a 6x6 matrix I'd probably average Osc 1-6 as input for Osc 1, then for Osc 2 use the Osc 1 sample directly but average 2-6 and so on.

Return to “DSP and Plug-in Development”