Author Topic: Thoughts about operator tuning  (Read 15316 times)

SirPrimalform

  • Team member
  • *
  • Posts: 47
    • View Profile
Thoughts about operator tuning
« on: March 22, 2016, 05:15:07 PM »
I noticed that some FM synths allow detuning in cents and Hz. I originally assumed that it was just to allow finer degrees of detuning, but now I understand more about synthesis and sound in general I realise the purpose

 Hz is of course a linear measurement whereas cents are a (very small) musical interval. So a detune in Hz is actually a different interval depending on what note you're playing. "How could that be useful!?" I hear you think. Well anyone who is familiar with detune by cents on a digital (therefore stable) synth may have noticed that the beat frequency is proportional to the note you're playing. A note an octave higher will beat twice as fast.

The beat frequency is the difference in Hz between the two oscillators, so the beating is changing frequency because when you play an octave higher you've doubled the frequency of both oscillators, so the difference between their frequencies has also doubled - doubling the rate of beating.

If you detune by a fixed number in Hz then you get the same beating rate on every note. This is particularly useful in FM where detune between modulators and carriers causes timbral changes and note just a 'chorusing' sound.

This isn't a feature request, just some thoughts.

I would propose it as a third "FTyp" parameter, maybe called KeHz or something. Freq would still be a ratio setting on this mode, but Ftun would be in Hz instead of cents. This would allow for sounds that have a cycling quality that is at a consistent rate across the keyboard. I think 2 decimal places (allowing for 0.01) is good as it allows incredibly slow phasing.

Đorđe Golubović

  • Team member
  • *
  • Posts: 19
    • View Profile
Re: Thoughts about operator tuning
« Reply #1 on: March 25, 2016, 04:09:28 PM »
That would be fun!

Or Hz based detune per timbre, for flanger-like effect when using same patch on different instrument slots.

I might actually try this, when I make me some more free time...

Computation-wise I suppose it wouldn't be to hard on cpu, just adding simple increment value (related to detune value) to phase increment :)
I haven't yet touched anything in preenfm2's UI code, so that might get a bit tricky there, I don't know...

SirPrimalform

  • Team member
  • *
  • Posts: 47
    • View Profile
Re: Thoughts about operator tuning
« Reply #2 on: March 29, 2016, 12:04:47 PM »
That would be fun!

Or Hz based detune per timbre, for flanger-like effect when using same patch on different instrument slots.

I might actually try this, when I make me some more free time...

Computation-wise I suppose it wouldn't be to hard on cpu, just adding simple increment value (related to detune value) to phase increment :)
I haven't yet touched anything in preenfm2's UI code, so that might get a bit tricky there, I don't know...

Yeah, I can't imagine it's difficult computationally - it's just adding an offset to the phase increment at a later stage (cent detune is obviously before the 12th root conversion).
« Last Edit: March 29, 2016, 12:21:21 PM by SirPrimalform »

Prints

  • Team member
  • *
  • Posts: 1
    • View Profile
Re: Thoughts about operator tuning
« Reply #3 on: April 29, 2016, 11:15:58 PM »
Can someone PLEASE make this happen. This would be so incredibly useful.

SirPrimalform

  • Team member
  • *
  • Posts: 47
    • View Profile
Re: Thoughts about operator tuning
« Reply #4 on: May 03, 2016, 11:57:40 AM »
It probably wouldn't be too hard, but I wouldn't know where to begin in terms of setting up the build environment because I'm not really a programmer. But you can get a linear tuning offset by adding directly to the phase increment.

lokki

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
Re: Thoughts about operator tuning
« Reply #5 on: August 12, 2017, 01:06:10 AM »
this is an old topic, but i would like to see this implemented as well!

Xavier

  • Administrator
  • Hero Member
  • *
  • Posts: 2259
    • View Profile
Re: Thoughts about operator tuning
« Reply #6 on: August 14, 2017, 03:56:28 PM »
this is an old topic, but i would like to see this implemented as well!

I don't have any plan to implement this.
But Lokki, now you know where the change would be  ;)
https://github.com/Ixox/preenfm2/blob/master/src/synth/Osc.cpp#L178

Ftype menu is defined here :
https://github.com/Ixox/preenfm2/blob/master/src/synth/SynthState.cpp#L204

Xavier

lokki

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
Re: Thoughts about operator tuning
« Reply #7 on: August 15, 2017, 12:58:18 AM »
the actual mod to Osc.cpp is very trivial indeed. the hard part (for me) is the UI, i don't understand how variables are named or even if they are created when i add a new parameterRow...

well i'm a noob, sorry...

Xavier

  • Administrator
  • Hero Member
  • *
  • Posts: 2259
    • View Profile
Re: Thoughts about operator tuning
« Reply #8 on: August 15, 2017, 03:03:51 PM »
I'm away from home for a couple of weeks still so i cannot try anything.

The suggestion from SirPrimalform in the first message of this thread sounds good to me.
Here are some clues.

I don't think you need new variables.
Add a new Constant here :
https://github.com/Ixox/preenfm2/blob/master/src/synth/SynthState.h#L250

Modify SynthState.cpp
https://github.com/Ixox/preenfm2/blob/master/src/synth/SynthState.cpp#L198
To add your UI string for this new "Frequency type" value.
Line 204 replace OSC_FT_FIXE by the new constat you added in SynthState.h.

At this point the value should show up in the UI.

Modify Osc.cpp and add a "case" in the switch to calculate your frequecy when the new Ftype is selected.
Use the variable detune for your Hertz detune calculation.

I don't think you need to modify FMDIsplay.cpp but you can search for "OSC_FT_" and see there are some hack there to have the display show/hide ftune depending on FType.

Make sense ?
« Last Edit: August 15, 2017, 03:05:43 PM by Xavier »

lokki

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
Re: Thoughts about operator tuning
« Reply #9 on: August 16, 2017, 12:04:27 AM »
actually that makes sense, it is more trivial then the change i tried to do with midi-offset.

but then again, i will first try and then say how easy it was :-)

lokki

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
Re: Thoughts about operator tuning
« Reply #10 on: August 16, 2017, 09:59:22 PM »
cool, i did it! it works, and it sounds nice.... i had to widen the detune range to -9.99 to 9.99 but that has no side effects i think.


i can share a compiled firmware if somebody is interested.

xavier, why is detune hidden when ftype is fixed but it still affects the fixed frequency in the osc.cpp?
« Last Edit: August 16, 2017, 10:22:50 PM by lokki »

54656f

  • Team member
  • *
  • Posts: 1
    • View Profile
Re: Thoughts about operator tuning
« Reply #11 on: August 18, 2017, 10:31:49 PM »
I'd be very interested indeed!

lokki

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
Re: Thoughts about operator tuning
« Reply #12 on: August 19, 2017, 12:28:45 PM »
i have a firmware with some other changes here, will make one with only the hertz change in the next days...

lokki

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
Re: Thoughts about operator tuning
« Reply #13 on: August 19, 2017, 05:36:23 PM »
there you go. did the mod on the stock firmware in the train, so i could not test, but it compiles, so should be fine...

let me know

Xavier

  • Administrator
  • Hero Member
  • *
  • Posts: 2259
    • View Profile
Re: Thoughts about operator tuning
« Reply #14 on: August 27, 2017, 07:05:48 PM »

Nice..   :)
I didn't try it, but if i have time to make a 2.08 it will be part of it.
Do you have the source available somewhere ?