diff options
| author | Mick Grierson <mickgrierson@strangebook.lan> | 2011-10-18 19:05:02 +0100 |
|---|---|---|
| committer | Mick Grierson <mickgrierson@strangebook.lan> | 2011-10-18 19:05:02 +0100 |
| commit | 92af27026aa1aa72535e94bd8007d7066a3136e7 (patch) | |
| tree | b07dac5b9f137adc15d6b7a9f343ca18d5fef6c4 /main.cpp | |
| parent | c203258295902604f01adadb81a8fd0cb1933912 (diff) | |
hmm maxiDyn needs a bit more work
Diffstat (limited to 'main.cpp')
| -rwxr-xr-x | main.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
@@ -1,11 +1,14 @@ #include "maximilian.h" -maxiOsc sound,timer; -maxiEnv AR; -double out; -int trigger, lasttrigger; +maxiOsc sound,bass,timer,mod; +maxiEnv envelope; +double bassout,leadout; +int trigger; int currentCount,lastCount,playHead=0; int rhythm[8]={1,0,1,0,1,0,1,0}; +float pitch[8]={220,220,246.9,261.6}; +float currentPitch; + void setup() {//some inits @@ -13,20 +16,20 @@ void setup() {//some inits } void play(double *output) {//this is where the magic happens. Very slow magic. - currentCount=(int)timer.phasor(16);//this sets up a metronome that ticks every so often + currentCount=(int)timer.phasor(20);//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=rhythm[playHead];//read through the array + trigger=rhythm[playHead%8];//read through the array + currentPitch=pitch[(playHead%8)/2]; playHead++;//iterate the playhead - if (playHead>7) {//but not if it's too big.. - playHead=0;//in which case reset the playhead - } //cout << "tick\n";//the clock ticks lastCount=0;//set lastCount to 0 } - *output=AR.adsr(sound.pulse(440,0.5),1,0.999, 0.125, 0.9999, 1, trigger);//new, simple ADSR. + bassout=envelope.adsr(bass.saw(currentPitch*0.5)+sound.pulse(currentPitch*0.5,mod.phasor(1)),1,0.9995, 0.25, 0.9995, 1, trigger);//new, simple ADSR. + + *output=bassout; + |
