diff options
| author | mick grierson <mickgrierson@gmail.com> | 2016-12-19 22:35:23 +0000 |
|---|---|---|
| committer | mick grierson <mickgrierson@gmail.com> | 2016-12-19 22:35:23 +0000 |
| commit | cfb9046eec768c76baa4c0711870bb255c86ef4a (patch) | |
| tree | 0fdfcc93fe645e3f54662bf59d3fefb7f337c60c /main.cpp | |
| parent | 17fd15bf2e9cf1163d40d98286abd60378fd9df9 (diff) | |
Fixing errors in new envelope functions. maxiEnvelope now has a ramp function, a ramps function that takes time / value pairs from a std::vector, an adsr and ar that all sync directly to the samplerate. They all take params in seconds. This makes it easier for javascript users when I transpile with emscripten. Wait what?
Diffstat (limited to 'main.cpp')
| -rwxr-xr-x | main.cpp | 76 |
1 files changed, 72 insertions, 4 deletions
@@ -3,20 +3,88 @@ maxiOsc myOsc; maxiEnvelope myEnv; int counter; -double tv[8] = {1,1,0,1,1,2,0,4}; +double vals[12]={1,0.1,0.5,0.0,1.5,0.0,0.1,1,1.0,0.15,1.0,0.1}; +std::vector<double> rampsA(vals, vals+12); + void setup() {//some inits - + + myEnv.note(true); + } void play(double *output) {//this is where the magic happens. Very slow magic. + counter++; + if (counter ==0 || counter % 330400==0) { + myEnv.note(true); + } - double out = myEnv.ramps(tv); - output[0]=myOsc.sinewave(440)*out; + double out = myEnv.ramps(rampsA); + output[0]=myOsc.sinewave(440)*out; + output[1]=output[0]; } + +//#include "maximilian.h" +// +//maxiOsc myOsc; +//maxiEnvelope myEnv; +//int counter; +// +//void setup() { +// cout << myEnv.trigger << endl; +//} +// +//void play(double *output) { +// +// +// if (counter ==0 || counter % 88201==0) { +// myEnv.note(true); +// } +// +// if (counter % 44100==0) { +// myEnv.note(false); +// } +// +// counter++; +// +// double out = myEnv.adsr(); +// +// output[0]=myOsc.sinewave(440)*out; +// +// output[1]=output[0]; +// +//} + +//#include "maximilian.h" +// +//maxiOsc myOsc; +//maxiEnvelope myEnv; +//int counter; +// +//void setup() { +// cout << myEnv.trigger << endl; +//} +// +//void play(double *output) { +// +// +// if (counter ==0 || counter % 88200==0) { +// myEnv.note(true); +// } +// +// +// counter++; +// +// double out = myEnv.ar(1,1); +// +// output[0]=myOsc.sinewave(440)*out; +// +// output[1]=output[0]; +// +//} |
