diff options
| author | Mick Grierson <mickgrierson@gmail.com> | 2011-10-19 14:51:49 +0100 |
|---|---|---|
| committer | Mick Grierson <mickgrierson@gmail.com> | 2011-10-19 14:51:49 +0100 |
| commit | 06a73f45dcb6830777239ae86aacf019898e7a77 (patch) | |
| tree | ec3e3566a8e9fda1bcad7ac93cd9c1ebf7dfe2a8 /maximilian_examples/17.Compressor.cpp | |
| parent | c5882eaefa9b748f1364dbddde0cbc5994795bf1 (diff) | |
Added Compressor Example
Diffstat (limited to 'maximilian_examples/17.Compressor.cpp')
| -rw-r--r-- | maximilian_examples/17.Compressor.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
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. + +} + |
