preenfm Forum

PreenFM => preenfm2 and preenfm3 => Topic started by: SirPrimalform on March 22, 2016, 05:15:07 PM

Title: Thoughts about operator tuning
Post by: SirPrimalform 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.
Title: Re: Thoughts about operator tuning
Post by: Đorđe Golubović 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...
Title: Re: Thoughts about operator tuning
Post by: SirPrimalform 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).
Title: Re: Thoughts about operator tuning
Post by: Prints on April 29, 2016, 11:15:58 PM
Can someone PLEASE make this happen. This would be so incredibly useful.
Title: Re: Thoughts about operator tuning
Post by: SirPrimalform 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.
Title: Re: Thoughts about operator tuning
Post by: lokki on August 12, 2017, 01:06:10 AM
this is an old topic, but i would like to see this implemented as well!
Title: Re: Thoughts about operator tuning
Post by: Xavier 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
Title: Re: Thoughts about operator tuning
Post by: lokki 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...
Title: Re: Thoughts about operator tuning
Post by: Xavier 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 ?
Title: Re: Thoughts about operator tuning
Post by: lokki 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 :-)
Title: Re: Thoughts about operator tuning
Post by: lokki 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?
Title: Re: Thoughts about operator tuning
Post by: 54656f on August 18, 2017, 10:31:49 PM
I'd be very interested indeed!
Title: Re: Thoughts about operator tuning
Post by: lokki 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...
Title: Re: Thoughts about operator tuning
Post by: lokki 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
Title: Re: Thoughts about operator tuning
Post by: Xavier 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 ?
Title: Re: Thoughts about operator tuning
Post by: lokki on August 27, 2017, 11:12:15 PM
sure, i still have not figured out how to use GitHub correctly, i tried to fork your project and then tried to merge my changes but somehow it always says it is already in sync... but maybe i can upload the code like this to GitHub (but then you will have to go through the changes manually)
Title: Re: Thoughts about operator tuning
Post by: lokki on August 28, 2017, 04:54:52 PM
i think i figured it out, find the changed repo here:

https://github.com/lokkiikkol/preenfm2
Title: Re: Thoughts about operator tuning
Post by: Xavier on September 03, 2017, 08:42:47 PM

Thanks, that's small but very interesting inprovement and it keeps all compatibility with previous presets.
Nice :)

Title: Re: Thoughts about operator tuning
Post by: SirPrimalform on September 07, 2017, 11:46:12 PM
Hooray, thanks lokki for implementing it and thanks Xavier for the firmware being open source!
Title: Re: Thoughts about operator tuning
Post by: Đorđe Golubović on September 08, 2017, 11:38:29 AM
This is great news, I'll check it out as soon as I can!

Just took a glimpse at the changes, and I am very happy to have a reference for future fiddling with UI code (hope I find some time for that), thanks for that!
Title: Re: Thoughts about operator tuning
Post by: lokki on September 09, 2017, 12:26:28 PM
 
This is great news, I'll check it out as soon as I can!

Just took a glimpse at the changes, and I am very happy to have a reference for future fiddling with UI code (hope I find some time for that), thanks for that!

just be aware that you cannot simply add more ui elements to the preenfm2. you will have to change the preset file as well and make sure that old presets are loaded correctly and new presets are loaded correctly on older firmwares. it is a little messy. what i did involved no changes to the ui as such, i simply expanded a menu entry and used the same variables, that way the preset files stays the same.
Title: Re: Thoughts about operator tuning
Post by: opus.quatre on September 23, 2017, 09:28:39 PM
I like reading this thread.. This collaborative atmosphere, leading to an interesting improvement of the machine.. People having ideas, expectations, people having skills, people helping.. All this is a delight..