| View previous topic :: View next topic |
| Author |
How to implement FM in my handcrafted modular softsynth? |
pvdn Common Wiggler
Joined: 26 Feb 2011 Last Visit: 14 Jan 2013
  Posts: 70 Location: Utrecht, Netherlands
|
Posted: Mon Nov 21, 2011 5:59 am Post subject: How to implement FM in my handcrafted modular softsynth? |
 |
|
|
I'm working on a modular synthesizer in flash (here) and have been wondering how to implement fm properly. The question is not a technical one, it's the implementation, how the user can use it, i'm wondering about.
I think what i want is an oscillator with an fm input, and along with that an attenuate knob that affects the input on that (opposed to a construction where the user can precisely affect the frequency but has to use addition and multiply modules to do so). With the attenuator fully opened, what does the fm do exactly? Linear fm seems to be the most interesting method (from what i read), with the carrier frequency modulating in the range cf+x and cf-x. What value should i pick for x, or in other words: with two oscs, both running from -1 to 1, and one modulating the frequency of the other, what should the max resulting freqrange be with the att knob fully opened? |
|
| Back to top |
|
 |
governor blacksnake ant in the afterbirth
Joined: 01 Dec 2007 Last Visit: 20 May 2013
     Posts: 691 Location: seattle
|
Posted: Mon Nov 21, 2011 6:30 am Post subject: |
 |
|
|
| try some different values. use your ears and see what sounds best! |
|
| Back to top |
|
 |
bsmith Super Deluxe Wiggler
Joined: 07 Jan 2010 Last Visit: 21 May 2013
   Posts: 2342 Location: Dallas
|
Posted: Mon Nov 21, 2011 6:54 am Post subject: |
 |
|
|
wow man really neat thing you're working on there! bookmarked. i've got the fm sounding pretty good on it with 2 sines and simple amplifier sitting between them now. not sure why you'd want a limit to that top number other than as it 'organically' would be at unity. finer control on the simple amp for doing this would be useful for sure. _________________ Soundcloud | Twitter | epicurean.com |
|
| Back to top |
|
 |
pvdn Common Wiggler
Joined: 26 Feb 2011 Last Visit: 14 Jan 2013
  Posts: 70 Location: Utrecht, Netherlands
|
Posted: Mon Nov 21, 2011 7:16 am Post subject: |
 |
|
|
| bsmith wrote: | | wow man really neat thing you're working on there! bookmarked. i've got the fm sounding pretty good on it with 2 sines and simple amplifier sitting between them now. |
Thanks! It does sound ok, but from what i read is that exponential fm (in that since osc, an unamplified osc in the fm input results in modulating the carrier-freq with -1 to +1 octave) is more a curiosity than using linear-fm (which sounds odd to me, since adding +100 and -100 hz to a carrier of 200hz has a lot more effect than doing the same to 5000hz). Correct me if i'm wrong on that, but i thought inear fm was the regular (more 'usable') type of fm. (and by that i'm not saying that exponential is useless).
| Quote: | | not sure why you'd want a limit to that top number other than as it would be at unity. |
What do you mean exactly? What do you mean by unity?
| Quote: | | finer control on the simple amp for doing this would be useful for sure. |
Yeah, there's a lot to be improved. Not everything is working correctly and some controls are quite cumbersome. I'm currently in the process of rebuilding the whole application from the ground up but it's quite a lot of work
FYI: the result of this project is going to be twofold. First objective is to have a website where users can create, save and share patches. Not only to make nice sounds and music, but i think it's also very cool from an educational point of view: if someone is explaining some kind of synthesistechnique, you can directly link to an example to see how it works and play around with it.
Apart from that, these patches can run standalone (outside the editor) to give (flash) gamecreators the ability to have realtime sound within their games (and let gameparameters take control of the knobs and modules).
You'd better subscribe to my rss or twitter, since that page wont be updated. |
|
| Back to top |
|
 |
bsmith Super Deluxe Wiggler
Joined: 07 Jan 2010 Last Visit: 21 May 2013
   Posts: 2342 Location: Dallas
|
Posted: Mon Nov 21, 2011 7:24 am Post subject: |
 |
|
|
| pvdn wrote: |
| Quote: | | not sure why you'd want a limit to that top number other than as it would be at unity. |
What do you mean exactly? What do you mean by unity?
|
Sorry, talking out my ass and probably not using the proper nomenclature - I just meant unattenuated signal amplitude. Out of my depth here (very) - but have you maybe looked at the linear fm in on a schematic of an oscillator that has that to see what other folks are doing? _________________ Soundcloud | Twitter | epicurean.com |
|
| Back to top |
|
 |
speak_onion Common Wiggler
Joined: 11 Aug 2011 Last Visit: 20 May 2013
 Posts: 160 Location: Queens
|
Posted: Wed Nov 23, 2011 10:16 am Post subject: |
 |
|
|
| bsmith wrote: | | pvdn wrote: |
| Quote: | | not sure why you'd want a limit to that top number other than as it would be at unity. |
What do you mean exactly? What do you mean by unity?
|
Sorry, talking out my ass and probably not using the proper nomenclature - I just meant unattenuated signal amplitude. |
Yeah, but I think the question is how much should the frequency travel between peaks of the incoming unattenuated signal. When the carrier frequency is, say, 1kHz, and an unattenuated square wave is coming in on the linear FM input, what are the frequencies that come out? I don't know the answer to what that should be, but one idea is to check how it works in the nord G2. You could grab the free demo software and experiment with it a bit. Throw a slow square wave (or constant voltage, for that matter) into the linear FM input of one of the oscillators and see how far the frequency travels. I guess you'd need a tuner or similar for that. Try it for a few different values of the carrier frequency and see if that affects the results.
That's one way I can think of to approach the problem. _________________ http://wwww.speakonion.com for drum'n'noise
http://www.immigrantbreastnest.com for NYC's wreckedest sounds |
|
| Back to top |
|
 |
speak_onion Common Wiggler
Joined: 11 Aug 2011 Last Visit: 20 May 2013
 Posts: 160 Location: Queens
| |
| Back to top |
|
 |
General Electron Learning to Wiggle
Joined: 25 Nov 2010 Last Visit: 20 May 2013
  Posts: 48 Location: Boston
|
Posted: Wed Nov 23, 2011 1:25 pm Post subject: |
 |
|
|
| To approach the sound of a DX-7, you need to be able to drive the frequency negative, perhaps as far as -8 * original frequency. |
|
| Back to top |
|
 |
FetidEye demonic space drone
Joined: 06 Dec 2010 Last Visit: 21 May 2013
  Posts: 385 Location: the Netherlands
|
Posted: Wed Nov 23, 2011 2:32 pm Post subject: |
 |
|
|
wow nice software!
looks really smooth too. good interface |
|
| Back to top |
|
 |
pvdn Common Wiggler
Joined: 26 Feb 2011 Last Visit: 14 Jan 2013
  Posts: 70 Location: Utrecht, Netherlands
|
Posted: Wed Nov 23, 2011 7:17 pm Post subject: |
 |
|
|
| speak_onion wrote: | | one idea is to check how it works in the nord G2. You could grab the free demo software and experiment with it a bit. Throw a slow square wave (or constant voltage, for that matter) into the linear FM input of one of the oscillators and see how far the frequency travels. I guess you'd need a tuner or similar for that. Try it for a few different values of the carrier frequency and see if that affects |
Good idea, hadnt thought of that, even though i own a nord modular (first generation) and have been using the editor for inspiration here and there. |
|
| Back to top |
|
 |
Morley Super Deluxe Wiggler
Joined: 15 Oct 2008 Last Visit: 17 May 2013
    Posts: 2331 Location: Belgium
| |
| Back to top |
|
 |
widdly Wiggling with Experience
Joined: 21 Jan 2009 Last Visit: 21 May 2013
    Posts: 485 Location: singapore
|
Posted: Thu Nov 24, 2011 3:37 am Post subject: |
 |
|
|
Nice software.
For DX7 style Linear FM, the deviation (x in your equation) is dependent on the modulator frequency.
Modulation_Index = Deviation/Modulator_Frequency
Adjusting the level of a modulator in the DX7 varies the modulation index from 0 to 13. The mapping is exponential with more resolution for lower indices.
There is a very good explanation here...
http://www.angelfire.com/in2/yala/t2dx-fm.htm
It is usually easier to implement this as phase modulation. If your oscillator code uses an accumulator, each sample you can add the scaled modulator output to it and wrap the result. That should handle positive and negative frequencies. |
|
| Back to top |
|
 |
pvdn Common Wiggler
Joined: 26 Feb 2011 Last Visit: 14 Jan 2013
  Posts: 70 Location: Utrecht, Netherlands
|
Posted: Thu Nov 24, 2011 6:18 am Post subject: |
 |
|
|
Interesting read, this clarifies some stuff for me and i realize my current implementation (unattenuated osc as modulator results in a freq ranging from freq/2 to freq*2) is a little weird.
| rob hordijk wrote: | | It should be clear that to keep the modulation index constant the amplitude of the modulating waveform should be corrected for each pitch on the musical scale. Luckily the relation between the overall amplitude of the modulating waveform and the pitch of the carrier is very simple, it suffices to multiply the modulating waveform amplitude by the original linear frequency parameter on the carrier oscillator before it is added to the internal carrier frequency parameter |
Hmmmm, multiply each sample of the modulating oscillator by the basefrequency of the carrier? So that would mean multyplying with numbers like 1000? Sounds like quite a multiplication... |
|
| Back to top |
|
 |
pvdn Common Wiggler
Joined: 26 Feb 2011 Last Visit: 14 Jan 2013
  Posts: 70 Location: Utrecht, Netherlands
|
Posted: Thu Nov 24, 2011 6:46 am Post subject: |
 |
|
|
Thanks, that has a lot of math and numbers on there, but looks good.
Oh and if you any of you guys have other suggestions, criticism or comments: let me know. When the basics are done, i'm really looking forward to create some interesting modules (want to create some existing modules i like as well - 4ms SCM, z8000), so if you have ideas (or want to help out otherwise): let me know! |
|
| Back to top |
|
 |
jonah searching for "switch nipples"
Joined: 25 Oct 2010 Last Visit: 19 May 2013
  Posts: 1283
|
Posted: Thu Nov 24, 2011 2:17 pm Post subject: |
 |
|
|
I recently started building an FM synth in Five12 Numerology and was pointed towards this paper which was helpful:
https://ccrma.stanford.edu/sites/default/files/user/jc/fmsynthesispape rfinal_1.pdf
I found page 7 which describes uses of FM to create specific instruments sounds inspiring and I'm attempting to make the programming of the synth setup so that the user controls sound characteristics rather then abstractly working with operators and the like. I'm trying to increase the intuitiveness of FM while still keeping the powerful synthesis capabilities.
Anyway, your project looks very cool! Good luck! |
|
| Back to top |
|
 |
jimmyedgar Ultra Violet Vibrator
Joined: 02 Nov 2011 Last Visit: 19 Apr 2013
 Posts: 605
|
Posted: Tue Nov 29, 2011 11:07 am Post subject: Re: How to implement FM in my handcrafted modular softsynth? |
 |
|
|
| pvdn wrote: | | I'm working on a modular synthesizer in flash (here) and have been wondering how to implement fm properly. The question is not a technical one, it's the implementation, how the user can use it, i'm wondering about. |
this is a great project... can't wait to see more FFT programs, granular synthesis... check out my first patch, nothing spectacular but using what you have avail so far
let me know if you need a graphic designer, i know some people who would love to be a part of designing interface for this |
|
| Back to top |
|
 |
vlk Keeping it tender
Joined: 20 Jan 2010 Last Visit: 21 May 2013
   Posts: 621 Location: Cologne
|
Posted: Thu Dec 01, 2011 5:46 am Post subject: |
 |
|
|
Wow. This is great. Lots of fun. Good stuff! _________________ vlksound |
|
| Back to top |
|
 |
Aroused by JarJar Learning to Wiggle
Joined: 19 Oct 2009 Last Visit: 15 Nov 2012
   Posts: 46
|
Posted: Thu Dec 01, 2011 7:50 am Post subject: |
 |
|
|
A modular synth in real time over the internet, very impressive!
It looks like you have implemented FM as simply adding an audio signal to a frequency argument, the most simple implementation, and the kind of thing that is natural to do with analog equipment (just plug an audio signal where you'd usually have a haptic rate control voltage).
This works great. But, after a certain amount of modulation, and when using feedback, this kind of most simple FM runs off the tracks- wild DC offsets, pitch changes. Even "dead spots" where it will go silent, in software at least (I have not run into these dead spots in analog and don't know if it happens in analog, it may be a digital-specific problem). So you'll have to implement it as phase modulation, like a DX, to get more options and control. To scale the modulator, multiply the modulator by the index and the index by 1/(2*pi). This will give you a typical range from 0 to about 13*, then ever more racous from there. A module scaling according to pitch (or MIDI note number) according to different curves would be nice, so you can insert it between the index input and the modulator.
And you'll want to modulate the index itself (by velocity, lfos, etc.), very important.
Anyway nice work, bravo!
* index range- the actual amplitude is about .159 of that. |
|
| Back to top |
|
 |
pvdn Common Wiggler
Joined: 26 Feb 2011 Last Visit: 14 Jan 2013
  Posts: 70 Location: Utrecht, Netherlands
|
Posted: Mon Feb 27, 2012 12:35 pm Post subject: |
 |
|
|
Thanks for all the advice, i'm working very hard for a new release-version. Quick preview: http://dl.dropbox.com/u/250155/patchwork.png
By the way, i've chosen the path of a fully modular thing with regards to handling notes, meaning i have a volt/oct setting for the system (in the previous version i had modules that sent out note-numbers) and all signals are now within -1 to 1. Oh, and if anyone has ideas on how to implement a fast note-quantizer: let me know  |
|
| Back to top |
|
 |
Morley Super Deluxe Wiggler
Joined: 15 Oct 2008 Last Visit: 17 May 2013
    Posts: 2331 Location: Belgium
| |
| Back to top |
|
 |
syntax_tn Learning to Wiggle
Joined: 28 Jan 2012 Last Visit: 15 Apr 2013
 Posts: 8
|
Posted: Wed Feb 29, 2012 3:23 pm Post subject: |
 |
|
|
Looks really sweet. I'm doing something similar in Csound (static modules, not dynamically loadable), the UI looks horrible due to fltk.
Good look for this.
As for fm: whether to choose linear or exponential fm: why not implement/offer both types? It's just one line of code that needs to be altered. Have a checkbox to choose fm type or 2 different modules.
Another UI question: how do you decide whether to use knobs, vertical sliders or horizontal sliders fot the separate controls, any particular reason behind this? |
|
| Back to top |
|
 |
pvdn Common Wiggler
Joined: 26 Feb 2011 Last Visit: 14 Jan 2013
  Posts: 70 Location: Utrecht, Netherlands
|
Posted: Thu Mar 01, 2012 4:21 am Post subject: |
 |
|
|
It wasnt my plan to choose only one of those, my question was regarding how to implement both of them exactly. But i think i know what to do now, so i will implements both soon.
Regarding your UI-question: i make the what-control-for-what-parameter-decision myself, based on aesthetics and usability. Some kind of volume will usually be a slider, the rest will be knobs... and there are more and different types. The vertical slider is there because a horizontal one had too much empty space in the module (the module already has a width because of stuff in the titlebar).
The modules all have a handcrafted view, in which i myself have to initialize controls with parameters from the module. My previous version did auto-layout all that, but i've quit that approach because it was too much of a hassle to change stuff to my likings.
Btw, you can play with the version on that screenshot here: http://dl.dropbox.com/u/250155/patchwork/main.swf |
|
| Back to top |
|
 |
|