diff options
| author | mick grierson <mickgrierson@gmail.com> | 2015-10-01 09:54:19 +0100 |
|---|---|---|
| committer | mick grierson <mickgrierson@gmail.com> | 2015-10-01 09:54:19 +0100 |
| commit | e4eb667af04304cbe9c0be5997ebea2049178590 (patch) | |
| tree | 5630e70df8199c9f53170c9ef4da1e4dac59e69c /maximilian_examples/5.FM1.cpp | |
| parent | 537a5a959f8ec9c4fcb5fd016f2a6be65ca99f3c (diff) | |
| parent | dfa3efd8495628d55f55ee8c8c8576095c2089e4 (diff) | |
resolving merge conflict
Diffstat (limited to 'maximilian_examples/5.FM1.cpp')
| -rwxr-xr-x | maximilian_examples/5.FM1.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/maximilian_examples/5.FM1.cpp b/maximilian_examples/5.FM1.cpp index c734dcf..266e11f 100755 --- a/maximilian_examples/5.FM1.cpp +++ b/maximilian_examples/5.FM1.cpp @@ -1,14 +1,35 @@ +// One way of thinking about FM synthesis is to see it as vibrato. +// You make a pitch, then vary it up and down at some rate. +// You can change the speed of the pitch variation (modulation frequency), and also the amount of variation (modulation index). +// In FM, usually only one of the waveforms - the carrier that provides the initial pitch - is sent to the output. +// The frequency of the the carrier wave is continually adjusted at a rate equal to the frequency of the second wave (the modulator). +// So at any given point in time, the frequency of the carrier can increase by an amount equal to the current amp of the modulator. +// This has some interesting effects. + #include "maximilian.h" maxiOsc mySine,myOtherSine;//Two oscillators void setup() {//some inits - //nothing to go here this time + //nothing to go here this time } void play(double *output) { - - *output=mySine.sinewave(myOtherSine.sinewave(1)*440); - + + // In this example, the 'myOtherSine.sinewave' is at an amplitude of 1, it's original amplitude. + // This is pretty simple and not too useful. + //output[0]=mySine.sinewave(440*myOtherSine.sinewave(1)); + + // Perhaps you should comment out the above line and uncomment the below one instead + // It shows how the frequency of the carrier is altered by ADDING a second waveform to its frequency value. + // The carrier frequency is 440, and the modulation frequency is 1. + // It also shows how the modulation index works. In this case the modulation index is 100 + // Try adjusting the modolation index. Also, try altering the modulation frequency. + output[0]=mySine.sinewave(440+(myOtherSine.sinewave(1)*100)); + output[1]=output[0]; + } + +// In complex FM systems you can have lots of modulators stacked together in interesting ways, and theoretically this can make any sound. +// John Chowning is the guy you probably want to talk to about that. |
