aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmain.cpp7
-rw-r--r--maximilian_examples/16.Replicant.cpp17
-rw-r--r--maximilian_examples/17.Compressor.cpp29
3 files changed, 42 insertions, 11 deletions
diff --git a/main.cpp b/main.cpp
index be9831f..54b0063 100755
--- a/main.cpp
+++ b/main.cpp
@@ -1,7 +1,7 @@
#include "maximilian.h"
maxiSample beats; //We give our sample a name. It's called beats this time. We could have loads of them, but they have to have different names.
-maxiDyn compressor;
+maxiDyn compressor; //this is a compressor
double out;
void setup() {//some inits
@@ -13,7 +13,10 @@ void setup() {//some inits
void play(double *output) {//this is where the magic happens. Very slow magic.
- out=compressor.compressor(beats.play(),50,0.5,0.0005,0.995);//just play the file. Looping is default for all play functions.
+
+ //here, we're just compressing the file in real-time
+ //arguments are input,ratio,threshold,attack,release. a long attack is something like 0.0001 and a long release is like 0.9999.
+ out=compressor.compressor(beats.play(),20,0.25,0.0005,0.9999);
output[0]=out;
output[1]=out;
diff --git a/maximilian_examples/16.Replicant.cpp b/maximilian_examples/16.Replicant.cpp
index c03c909..ae166bd 100644
--- a/maximilian_examples/16.Replicant.cpp
+++ b/maximilian_examples/16.Replicant.cpp
@@ -21,13 +21,13 @@ int leadLinePitch[15]={69,67,65,64,67,66,64,62,65,64,62,57,55,60,57};
void setup() {//some inits
-
+
}
void play(double *output) {//this is where the magic happens. Very slow magic.
-
+
currentCount=(int)timer.phasor(9);//this sets up a metronome that ticks every so often
-
+
if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound
trigger=1;//play the arpeggiator line
trigger2=leadLineTrigger[playHead%256];//play the lead line
@@ -46,17 +46,16 @@ void play(double *output) {//this is where the magic happens. Very slow magic.
//cout << "tick\n";//the clock ticks
lastCount=0;//set lastCount to 0
}
-
+
bassout=filter2.lores(envelope.adsr(bass.saw(currentPitch*0.5)+sound.pulse(currentPitch*0.5,mod.phasor(1)),1,0.9995, 0.25, 0.9995, 1, trigger),9250,2);//new, simple ADSR.
leadout=filter.lores(leadenvelope.ar(lead2.saw(leadPitch*4)+lead.pulse(leadPitch+(leadmod.sinebuf(1.9)*1.5), 0.6), 0.00005, 0.999975, 50000, trigger2),5900,10);//leadline
-
+
delayout=(leadout+(delay.dl(leadout, 14000, 0.8)*0.5))/2;//add some delay
-
+
if(trigger!=0)trigger=0;//set the trigger to off if you want it to trigger immediately next time.
-
+
output[0]=(bassout+delayout)/2;//sum output
output[1]=(bassout+delayout)/2;
-}
-
+} \ No newline at end of file
diff --git a/maximilian_examples/17.Compressor.cpp b/maximilian_examples/17.Compressor.cpp
new file mode 100644
index 0000000..c6b7897
--- /dev/null
+++ b/maximilian_examples/17.Compressor.cpp
@@ -0,0 +1,29 @@
+#include "maximilian.h"
+
+maxiSample beats; //We give our sample a name. It's called beats this time. We could have loads of them, but they have to have different names.
+maxiDyn compressor; //this is a compressor
+double out;
+
+void setup() {//some inits
+
+ beats.load("/Users/yourusername/somewhere/schub.wav");//load in your samples. Provide the full path to a wav file.
+ printf("Summary:\n%s", beats.getSummary());//get info on samples if you like.
+
+}
+
+void play(double *output) {//this is where the magic happens. Very slow magic.
+
+
+ //here, we're just compressing the file in real-time
+ //arguments are input,ratio,threshold,attack,release
+ out=compressor.compressor(beats.play(),5,0.25,0.0001,0.9999);
+
+ output[0]=out;
+ output[1]=out;
+
+ // *output=beats.play(0.69);//play the file with a speed setting. 1. is normal speed.
+ // *output=beats.play(0.5,0,44100);//linear interpolationplay with a frequency input, start point and end point. Useful for syncing.
+ // *output=beats.play4(0.5,0,44100);//cubic interpolation play with a frequency input, start point and end point. Useful for syncing.
+
+}
+