aboutsummaryrefslogtreecommitdiffstats
path: root/maximilian_examples/5.FM1.cpp
diff options
context:
space:
mode:
authormick grierson <mickgrierson@gmail.com>2015-08-27 13:33:41 +0100
committermick grierson <mickgrierson@gmail.com>2015-08-27 13:33:41 +0100
commit5b37d13616c303538a61b520e6930b322e4ff378 (patch)
treea616325e9bdd71ba22fd22ad419963035322e8a0 /maximilian_examples/5.FM1.cpp
parentb155008277cbdba3534ca392d67e2db199d9c458 (diff)
redoing tutorials a bit
Diffstat (limited to 'maximilian_examples/5.FM1.cpp')
-rwxr-xr-xmaximilian_examples/5.FM1.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/maximilian_examples/5.FM1.cpp b/maximilian_examples/5.FM1.cpp
index c734dcf..14f6593 100755
--- a/maximilian_examples/5.FM1.cpp
+++ b/maximilian_examples/5.FM1.cpp
@@ -1,14 +1,34 @@
+// 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));
+
}
+
+// 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. \ No newline at end of file