aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Kiefer <chrisk13fer@gmail.com>2013-10-11 11:13:00 +0100
committerChris Kiefer <chrisk13fer@gmail.com>2013-10-11 11:13:00 +0100
commiteabb1855777c8451c8a35bae4309ee112ac4460e (patch)
treedc48774b326a80fd53b192f86f52ccb56055a786
parent7fc94b9f1860ee14aa03f4d235a75d63d02a6315 (diff)
additive example
-rwxr-xr-xmain.cpp12
-rw-r--r--maximilianTest_10.8.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstatebin35350 -> 35295 bytes
-rw-r--r--maximilian_examples/20.additive.cpp26
3 files changed, 35 insertions, 3 deletions
diff --git a/main.cpp b/main.cpp
index b835b67..bedbbae 100755
--- a/main.cpp
+++ b/main.cpp
@@ -1,14 +1,20 @@
#include "maximilian.h"
-maxiOsc mySine;//let's create an oscillator and give it a name.
+const int NUM = 200;
+maxiOsc sineBank[NUM];//let's create an oscillator and give it a name.
+maxiOsc modu;
void setup() {//some inits
//nothing to go here this time
}
+
+
+
void play(double *output) {//this is where the magic happens. Very slow magic.
+ double wave = modu.saw(100);
+ *output = wave;//simple as that!
- *output=mySine.sinewave(440);//simple as that!
-
+
}
diff --git a/maximilianTest_10.8.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate b/maximilianTest_10.8.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate
index b2f4153..d556c35 100644
--- a/maximilianTest_10.8.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate
+++ b/maximilianTest_10.8.xcodeproj/project.xcworkspace/xcuserdata/chris.xcuserdatad/UserInterfaceState.xcuserstate
Binary files differ
diff --git a/maximilian_examples/20.additive.cpp b/maximilian_examples/20.additive.cpp
new file mode 100644
index 0000000..753434d
--- /dev/null
+++ b/maximilian_examples/20.additive.cpp
@@ -0,0 +1,26 @@
+#include "maximilian.h"
+
+maxiOsc sineBank[10];//let's create an oscillator and give it a name.
+
+void setup() {//some inits
+ //nothing to go here this time
+}
+
+
+
+void play(double *output) {//this is where the magic happens. Very slow magic.
+
+ double wave=0;
+ double f0 = 100;
+ for(int i=0; i < 10; i++) {
+ double thisSine = wave + sineBank[i].sinewave(f0 + (i * f0));
+ double multiplier = 1.0 / (i+1.0);
+ thisSine = thisSine * multiplier;
+ wave = wave + thisSine;
+ }
+ wave *= 0.1;
+ *output = wave;//simple as that!
+
+
+}
+