diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2016-03-14 19:27:50 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2016-03-14 19:27:50 +0200 |
| commit | b791625011d2f1c6fa604a3ff67d7479fcffa7de (patch) | |
| tree | e35046626dcb22181f82f07d08df1288fb4552b1 | |
| parent | ca6cf59e549db308b305f1a7469536d37ff372e6 (diff) | |
Fork fakebitpolytechnic/cheapsynth
39 files changed, 7 insertions, 7771 deletions
diff --git a/CheapSynth_FM4osc2Poly_v0_5_6/ADSRslow.h b/CheapSynth_FM4osc2Poly_v0_5_6/ADSRslow.h deleted file mode 100644 index 760d136..0000000 --- a/CheapSynth_FM4osc2Poly_v0_5_6/ADSRslow.h +++ /dev/null @@ -1,307 +0,0 @@ -/* - * ADSR.h - * - * Copyright 2012 Tim Barrass. - * - * This file is part of Mozzi. - * - * Mozzi is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Mozzi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Mozzi. If not, see <http://www.gnu.org/licenses/>. - * - */ - -#ifndef ADSR_H_ -#define ADSR_H_ - -#include "Arduino.h" -//#include <util/atomic.h> -#include "Line.h" -#include "mozzi_fixmath.h" - -/** A simple ADSR envelope generator. -@todo Test whether using the template parameter makes any difference to speed, -and rationalise which units which do and don't need them. -Template objects are messy when you try to use pointers to them, -you have to include the whole template shebang in the pointer handling. -*/ -template <unsigned int CONTROL_UPDATE_RATE> -class ADSR -{ -private: - - const unsigned int AUDIO_TICKS_PER_CONTROL; - - unsigned int phase_control_step_counter; - unsigned int phase_num_control_steps; - - enum {ATTACK,DECAY,SUSTAIN,RELEASE,IDLE}; - - - struct phase{ - byte phase_type; - unsigned int control_steps; - unsigned long audio_steps; - Q8n0 level; - }attack,decay,sustain,release,idle; - - phase * current_phase; - - // Linear audio rate transitions for envelope - Line <unsigned long> transition; - - inline - unsigned int convertMsecToControlSteps(unsigned int msec){ - return (uint) (((ulong)msec*CONTROL_UPDATE_RATE)>>10); // approximate /1000 with shift - } - - inline - void setPhase(phase * next_phase) { - phase_control_step_counter = 0; - phase_num_control_steps = next_phase->control_steps; - transition.set(Q8n0_to_Q16n16(next_phase->level),next_phase-> control_steps); - current_phase = next_phase; - } - - - - inline - void checkForAndSetNextPhase(phase * next_phase) { - if (++phase_control_step_counter >= phase_num_control_steps){ - setPhase(next_phase); - } - } - - - inline - void checkForAndSetIdle() { - if (++phase_control_step_counter >= phase_num_control_steps){ - transition.set(0,0,1); - current_phase = &idle; - } - } - - - -inline - void setTime(phase * p, unsigned int msec) - { - p->control_steps=convertMsecToControlSteps(msec); - p->audio_steps = (ulong) p->control_steps * AUDIO_TICKS_PER_CONTROL; - } - - -public: - - /** Constructor. - */ - ADSR():AUDIO_TICKS_PER_CONTROL(AUDIO_RATE/CONTROL_UPDATE_RATE) - { - attack.phase_type = ATTACK; - decay.phase_type = DECAY; - sustain.phase_type = SUSTAIN; - release.phase_type = RELEASE; - idle.phase_type = IDLE; - release.level = 0; - } - - -/** Updates the internal controls of the ADSR. - Call this in updateControl(). - */ - void update(){ // control rate - - switch(current_phase->phase_type) { - - case ATTACK: - checkForAndSetNextPhase(&decay); - break; - - case DECAY: - checkForAndSetNextPhase(&sustain); - break; - - case SUSTAIN: - checkForAndSetNextPhase(&release); - break; - - case RELEASE: - checkForAndSetIdle(); - break; - - } - } - - /** Advances one audio step along the ADSR and returns the level. - Call this in updateAudio(). - @return the next value, as an unsigned int. - */ - inline - unsigned int next() - { - return Q16n16_to_Q16n0(transition.next()); - } - - - - /** Start the attack phase of the ADSR. THis will restart the ADSR no matter what phase it is up to. - */ - inline - void noteOn(){ - setPhase(&attack); - } - - - - /** Start the release phase of the ADSR. - @todo fix release for rate rather than steps (time), so it releases at the same rate whatever the current level. - */ - inline - void noteOff(){ - setPhase(&release); - } - - - - - - /** Set the attack level of the ADSR. - @param value the attack level. - */ - inline - void setAttackLevel(byte value) - { - attack.level=value; - } - - - - /** Set the decay level of the ADSR. - @param value the decay level. - */ - inline - void setDecayLevel(byte value) - { - decay.level=value; - } - - - /** Set the sustain level of the ADSR. - @param value the sustain level. Usually the same as the decay level, - for a steady sustained note. - */ - inline - void setSustainLevel(byte value) - { - sustain.level=value; - } - - /** Set the release level of the ADSR. Normally you'd make this 0, - but you have the option of some other value. - @param value the release level (normally 0). - */ - inline - void setReleaseLevel(byte value) - { - release.level=value; - } - - - - /** Set the attack and decay levels of the ADSR. This assumes a conventional - ADSR where the sustain continues at the same level as the decay, till the release ramps to 0. - @param attack the new attack level. - @param value the new sustain level. - */ - inline - void setADLevels(byte attack, byte decay) - { - setAttackLevel(attack); - setDecayLevel(decay); - setSustainLevel(decay); - setReleaseLevel(0); - } - - - - - - - - /** Set the attack time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - @param value the unsigned int attack time in milliseconds. - */ - inline - void setAttackTime(unsigned int msec) - { - setTime(&attack, msec); - } - - - /** Set the decay time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - @param value the unsigned int decay time in milliseconds. - */ - inline - void setDecayTime(unsigned int msec) - { - setTime(&decay, msec); - } - - - /** Set the sustain time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - The sustain phase will finish if the ADSR recieves a noteOff(). - @param value the unsigned int sustain time in milliseconds. - */ - inline - void setSustainTime(unsigned int msec) - { - setTime(&sustain, msec); - } - - - - /** Set the release time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - @param value the unsigned int release time in milliseconds. - */ - inline - void setReleaseTime(unsigned int msec) - { - setTime(&release, msec); - } - - - - /** Set the attack, decay and release times of the ADSR in milliseconds. - The actual times will be resolved within the resolution of CONTROL_RATE. - @param attack_ms the new attack time in milliseconds. - @param decay_ms the new decay time in milliseconds. - @param decay_ms the new sustain time in milliseconds. - @param release_ms the new release time in milliseconds. - */ - inline - void setTimes(unsigned int attack_ms, unsigned int decay_ms, unsigned int sustain_ms, unsigned int release_ms) - { - setAttackTime(attack_ms); - setDecayTime(decay_ms); - setSustainTime(sustain_ms); - setReleaseTime(release_ms); - } - - -}; - -#endif /* ADSR_H_ */ - diff --git a/CheapSynth_FM4osc2Poly_v0_5_6/CheapSynth_FM4osc2Poly_v0_5_6.ino b/CheapSynth_FM4osc2Poly_v0_5_6/CheapSynth_FM4osc2Poly_v0_5_6.ino deleted file mode 100644 index e5b705b..0000000 --- a/CheapSynth_FM4osc2Poly_v0_5_6/CheapSynth_FM4osc2Poly_v0_5_6.ino +++ /dev/null @@ -1,426 +0,0 @@ - -/* - * FM+LFO notes from Mozzi in response to MIDI input, - * using the standard Arduino MIDI library: - * http://playground.arduino.cc/Main/MIDILibrary - * - * Mozzi help/discussion/announcements: - * https://groups.google.com/forum/#!forum/mozzi-users - * - * Massively based on examples by Tim Barrass 2013nextenv - * This example code is in the public domain. - * - * sgreen/dpape/dgreen - modified to bring together harmonic FM, LFO, portamento, - * mono note priority, & Rock Band keytar controls - http://www.cheapsynth.com/ - * - * Audio output from pin 9 (pwm) - * Midi plug pin 2 (centre) to Arduino gnd, pin 5 to RX (0) - * http://www.philrees.co.uk/midiplug.htm - * - On Rock Band keytar, switch between patch modes using the big transparent button above -the LEDs, as follows... - -Mode 0 - monophonic FM lead sound with variable modulation harmonics, portamento, modulation depth -on modulation strip, low-frequency oscillator (LFO) speed on pitch bend strip (ie button held down) - -Mode 1 - (2-note polyphonic) Squarewave added to squared-off sinewave at variable harmonics, -pitch bend strip adjusts "duty cycle", ie how much the squared sine is On vs Off - -Mode 2 - (2-note polyphonic) Actually sawtooth wave, pitch bend strip gives chorus-y effect by -variably detuning one of the current notes - -Mode 3 - (2-note "polyphonic") Squarewave XOR'd with sinewaves at variable harmonics, similar fake-LFO -detuning on pitch bend strip, massive upwards zoom on both notes when no portamento! - -Mode 4 - intentionally left blank so you know where you are - -Standard controls: - -Different modulation freq harmonics on the right-hand corner up and down keys between octave up -and octave down (all modes except Mode 2). - -Portamento speed on Back arrow to the left of big transparent Mode button, toggles between no portamento -(ie 2-note polyphony in modes that support it), 10ms fast glide between notes, 400ms slow glide. - -[updated: this note decay now doesn't do anything as I've moved everything to "slow" ADSR..!] -Note decay length on forward arrow to the right of big transparent Mode button (currently applies -to less computationally demanding envelopes in Mode 0 and 2), toggles between short/medium/long -*/ - -#include <MIDI.h> -#include <MozziGuts.h> -#include <Oscil.h> /oscSaw/ oscillator template -#include <Line.h> // for envelope -#include <tables/cos2048_int8.h> // table for Oscils to play -#include <tables/saw1024_int8.h> // table for Oscils to play -#include <tables/smoothsquare8192_int8.h> // NB portamento requires table > 512 size? -#include <mozzi_midi.h> -#include <ADSRslow.h> -#include <mozzi_fixmath.h> -#include <LowPassFilter.h> -#include <Portamento.h> -#include <Ead.h> - -// use #define for CONTROL_RATE, not a constant -#define CONTROL_RATE 128 // powers of 2 please - -// Mozzi example uses COS waves for carrier and modulator -// DP: "gets brutal very fast" (esp in higher octaves) if you use a saw/square carrier -// gets subtly more brutal if you use smaller wavetables (fewer samples per cycle) -Oscil<SMOOTHSQUARE8192_NUM_CELLS, AUDIO_RATE> oscCarrier(SMOOTHSQUARE8192_DATA); // huge file :( -Oscil<SMOOTHSQUARE8192_NUM_CELLS, AUDIO_RATE> oscSquare2(SMOOTHSQUARE8192_DATA); // huge file :( -Oscil<COS2048_NUM_CELLS, AUDIO_RATE> oscModulator(COS2048_DATA); -Oscil<COS2048_NUM_CELLS, AUDIO_RATE> oscModulator2(COS2048_DATA); -Oscil<COS2048_NUM_CELLS, AUDIO_RATE> oscLFO(COS2048_DATA); -Oscil<SAW1024_NUM_CELLS, AUDIO_RATE> oscSaw1(SAW1024_DATA); -Oscil<SAW1024_NUM_CELLS, AUDIO_RATE> oscSaw2(SAW1024_DATA); - -// envelope generator -ADSR <CONTROL_RATE> envelope; -ADSR <CONTROL_RATE> envelope2; -Ead kEnvelopeGuitar1(CONTROL_RATE); //left in here for future use but currently not vital? -Ead kEnvelopeGuitar2(CONTROL_RATE); - -Portamento <CONTROL_RATE>aPortamento; -//LowPassFilter lpf; // LPF left over from earlier versions of code, may reinstate! -//int crushCtrl = 0; // ditto bitcrush - -#define LED 13 // to see if MIDI is being recieved - -long vibrato=0; -long vibrato2=0; -int chanGain1; -int chanGain2; -int LFO; -unsigned int carrierXmodDepth1; -unsigned int carrierXmodDepth2; - -// initialise globals (some eg amplitude no longer used) -int maxmode=4; -float carrierFreq = 10.f; -float carrier2 = 10.f; -float modFreq = 10.f; -float modFreq2 = 10.f; -float modDepth = 0; -float amplitude = 0.f; -float modOffset =1; -byte lastnote1=0; -byte lastnote2=0; -int nextenv=1; -byte portSpeed=0; -byte noteLength=1; -float shifted=0.1f; -byte mode=0; -unsigned long harmonic; -int squaredsin1; -int squaredsin2; -int bitmask=64; -int multiplier; - -float modOffsets[] = { -4,3.5,3,2.5,2,1.5,1,0.6666666,0.5,0.4,0.3333333,0.2857,0.25,0,0,0,0,0,0, -}; // harmonic ratios corresponding to DP's preferred intervals of 7, 12, 7, 19, 24, 0, 12, -12, etc - -void setup() { - pinMode(LED, OUTPUT); - - // Initiate MIDI communications, listen to all channels - MIDI.begin(MIDI_CHANNEL_OMNI); - - // Connect the HandleNoteOn function to the library, so it is called upon reception of a NoteOn. - MIDI.setHandleNoteOn(HandleNoteOn); // Put only the name of the function - MIDI.setHandleNoteOff(HandleNoteOff); // Put only the name of the function - MIDI.setHandleControlChange(HandleControlChange); - MIDI.setHandlePitchBend(HandlePitchBend); // Put only the name of the function - MIDI.setHandleProgramChange(HandleProgramChange); - MIDI.setHandleContinue(HandleContinue); - MIDI.setHandleStop(HandleStop); - MIDI.setHandleStart(HandleStart); - - envelope.setADLevels(127,100); - envelope.setTimes(20,20,20000,1200); // 20000 is so the note will sustain 20 seconds unless a noteOff comes - envelope2.setADLevels(127,100); - envelope2.setTimes(20,20,20000,1200); // 20000 is so the note will sustain 20 seconds unless a noteOff comes - - kEnvelopeGuitar1.set(20, 4000); - kEnvelopeGuitar2.set(20, 4000); - - aPortamento.setTime(0u); -// lpf.setResonance(200); -// lpf.setCutoffFreq(255); - oscLFO.setFreq(10); // default LFO frequency - - startMozzi(CONTROL_RATE); -} - - -void UpdateFreqs() -{ - oscCarrier.setFreq(carrierFreq); - oscSaw1.setFreq(carrierFreq); - carrierXmodDepth1=carrierFreq * modDepth; - modFreq=(carrierFreq * modOffset / (64/bitmask) ); - - oscSquare2.setFreq(carrier2); - oscSaw2.setFreq(carrier2 * (1.0f + ((shifted -0.1f) / 384)) ); - carrierXmodDepth2=carrier2 * modDepth; - modFreq2=(carrier2 * modOffset / (64/bitmask) ); - - oscModulator.setFreq( modFreq ); - oscModulator2.setFreq( modFreq2 ); -} - -void HandleProgramChange (byte channel, byte number) -{ - modOffset = modOffsets[number%15]; - UpdateFreqs(); -// modFreq=(carrierFreq * modOffset / (64/bitmask) ); -//dreadful hack as ProgramChange returns absolute prog number 0-127, "gets stuck" at upper/lower ends -} - -void HandleNoteOn(byte channel, byte note, byte velocity) { - aPortamento.start(note); -// carrierFreq=(mtof(note)); // simple but less accurate frequency -// osc.setFreq_Q16n16(Q16n16_mtof(Q8n0_to_Q16n16(note))); // accurate frequency -if ( portSpeed) - {nextenv=1; lastnote2=999;} - - if (nextenv==1) - { - lastnote1=note; - envelope.noteOn(); -kEnvelopeGuitar1.start(); - digitalWrite(LED,HIGH); - nextenv=2; // send next note to other envelope, unless overridden in the meantime - - carrierFreq = Q16n16_to_float (Q16n16_mtof(Q8n0_to_Q16n16(lastnote1))); - UpdateFreqs(); - } - else - { - lastnote2=note; - envelope2.noteOn(); -kEnvelopeGuitar2.start(); - digitalWrite(LED,HIGH); - nextenv=1; // send next note to other envelope, unless overridden in the meantime - - carrier2 = Q16n16_to_float (Q16n16_mtof(Q8n0_to_Q16n16(lastnote2))); - UpdateFreqs(); - } - -} - -void HandleStop () { //this is the Back button on the Xbox keyboard - portSpeed++; - {if (portSpeed>2) portSpeed = 0;} - aPortamento.setTime( (portSpeed*portSpeed*100) ); // values of 0,100,400 milliseconds? (next 900) -} - -void HandleStart () { //CURRENTLY NOT USED - noteLength=(noteLength+1)%3; // loop from 0-2 - kEnvelopeGuitar1.set(20, (noteLength+1)*(noteLength+1)*(noteLength+1)*500 ); - kEnvelopeGuitar2.set(20, (noteLength+1)*(noteLength+1)*(noteLength+1)*500 ); - //cube into values around 500, 4000, 13500 -} - -void HandleContinue () { // the big round button on all keytars - mode++; - {if (mode>maxmode) mode = 0;} //currently has a silent mode at the end so you know where you are : ) -} - -void HandleNoteOff(byte channel, byte note, byte velocity) { - digitalWrite(LED,LOW); // may as well switch LED off - - if ( (note == lastnote1) ) //kill envelope if prev note released - { - envelope.noteOff(); - if (chanGain2) {nextenv=1;} -} - - if ( (note == lastnote2) ) - {envelope2.noteOff(); - if (chanGain1) {nextenv=2;} - } - -} - - -void HandlePitchBend (byte channel, int bend) -{ -//bend value from +/-8192, translate to 0.1-8 Hz? -shifted= float ((bend+8500) /2048.f ) +0.1f; -if (mode==0) {oscLFO.setFreq(shifted); } -if (mode==1) - { - bitmask= 1 << (int (shifted)); multiplier=7-(int (shifted)); - UpdateFreqs(); - } - else {bitmask=64;} - -if (mode==2) { oscSaw2.setFreq(carrier2 * (1.0f + ((shifted -0.1f) / 384)) ); } -} - -void HandleControlChange (byte channel, byte number, byte value) -{ -// http://www.indiana.edu/~emusic/cntrlnumb.html - -/* -Serial.end(); // sample debug code to check values through (noisy) terminal interface -Serial.begin(38400); -Serial.print(" number:"); -Serial.print(number); -Serial.print(" value:"); -Serial.println( value ); -Serial.println(); -Serial.end(); -Serial.begin(31250); -*/ - - switch(number) { -// case 3: // could trap different controller IDs here - - case 1: // modulation wheel - //lpf.setResonance(value*2); - - //WORKING MODDEPTH CONTROLLER - float divided= float (value /46.f ); // values=0-127, map to 0-2.75 - modDepth = (divided * divided); // square to 0-8 - if (modDepth>7.5) {modDepth=7.5;} // sanity check (prob unnecessary) - if (modDepth<0.2) {modDepth=0;} // easier to get pure tone - UpdateFreqs(); - break; - } -} - -void updateControl(){ - MIDI.read(); - envelope.update(); - envelope2.update(); - - chanGain1 = envelope.next(); - chanGain2 = envelope2.next(); - -// chanGain1 = kEnvelopeGuitar1.next(); -// chanGain2 = kEnvelopeGuitar2.next(); - if(chanGain1 > 120) chanGain1 = 120; - if(chanGain2 > 120) chanGain2 = 120; - -if ( portSpeed ) - { - carrierFreq = Q16n16_to_float ( aPortamento.next() ); //NB presumably returns frequency as Q16n16 - UpdateFreqs(); - } - -if (mode==3) - { - modFreq *= 1.0f +(shifted / 384); // generates fake LFO via detuning mod osc - modFreq2*= 1.0f +(shifted / 384); // generates fake LFO via detuning mod osc -// modFreq2*= 1 + (shifted -0.1f) / 384); // generates fake LFO via detuning mod osc - oscModulator.setFreq( modFreq ); - oscModulator2.setFreq( modFreq2 ); - } - -} - -// strip the low bits off! - not used in current implementation -int bitCrush(int x, int a) -{ - return (x>>a)<<a; -} - -int updateAudio(){ - - switch(mode) - { - case 0: // FM with LFO -//NB this multiplication split into 2 chunks to preserve small precise values? -LFO=oscLFO.next(); -vibrato = ( LFO * oscModulator.next() ) >>7 ; -vibrato*= carrierXmodDepth1; -vibrato2 = ( LFO * oscModulator2.next() ) >>7 ; -vibrato2*= carrierXmodDepth2; -return (int) ( - (oscCarrier.phMod( vibrato >>3 ) * chanGain1 ) - + (oscSquare2.phMod( vibrato2>>3 ) * chanGain2 ) - ) >> 9; -// >> 9 = 9 fast binary divisions by 2 = divide by 512 - break; - - case 1: // ADDING square + "converted" sine -//squaredsin1= ( (oscModulator.next() & 0b0000000001000000)-1 ) <<1; -squaredsin1= ( (oscModulator.next() & bitmask) ) <<multiplier; -squaredsin2= ( (oscModulator2.next() & bitmask) ) <<multiplier; -return (int) -( - ( ( (oscCarrier.next() + squaredsin1 )>>1 )* chanGain1 ) -+ ( ( (oscSquare2.next() + squaredsin2 )>>1 )* chanGain2 ) -) >> 8; - break; - - case 2: // 2 tri poly -return (int)( - ( oscSaw1.next() *chanGain1 ) - + ( oscSaw2.next() *chanGain2 ) - ) >> 9; - break; - - case 3: // STARTED AS 2 sq poly XORd with respective sines, now big whoop -return (int)( - ( (oscCarrier.next()^oscModulator.next()) * chanGain1 ) - + ( (oscSquare2.next()^oscModulator2.next())* chanGain2 ) - ) >> 8; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; - - case 13: // 2 sq poly ORd with respective sines -return (int) ( ( (oscCarrier.next()|oscModulator.next() ) * envelope.next()) + ( (oscSquare2.next()|oscLFO.next() ) * envelope2.next()) ) >> 8; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; - - - case 6: // 2 sq poly -return (int) ( (oscCarrier.next() * envelope.next()) + (oscSquare2.next() * envelope2.next()) ) >> 8; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; - -//case 5 intentionally left blank - -/* - case 6: // ADDING squares -return (int) ( (oscCarrier.next() + oscSquare2.next() ) * (envelope.next() ) ) >> 8; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; -*/ -// case 1: // AND with fake LFO -//all this 'harmonic' stuff a failed attempt to use the same LFO as FM, causes massive beat f/x? -//harmonic = ( oscLFO.next() * oscModulator.next() ) >> 7; -//harmonic = ( harmonic * int (modDepth+1) ) >>3 ; -//return (int) ( (oscCarrier.next() ^ ( harmonic )) * (envelope.next() ) ) >> 7; -//return (int) ( (oscCarrier.next() & ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; -// break; - -/* case 3: // OR with fake LFO -//int harmonic = ( oscLFO.next() * oscModulator.next() ) >>7; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; -// break; - case 4: // XOR with fake LFO -//int harmonic = ( oscLFO.next() * oscModulator.next() ) >>7; -return (int) ( (oscCarrier.next() ^ ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; - */ - } - -// OLD CODE FROM BITCRUNCHED SINEWAVE, DIFF WAYS OF DOING THAT -// int x = (envelope.next() * lpf.next(osc.next()))>>8; -// x = bitCrush(x, crushCtrl>>4); -// x = (x * crushCtrl)>>4; // simple gain -// x = bitCrush(x, 6); -// x = lpf.next(x); -// return x; -} - - -void loop() { - audioHook(); // required here -} - diff --git a/CheapSynth_FM4osc2Poly_v0_6/CheapSynth_FM4osc2Poly_v0_6.ino b/CheapSynth_FM4osc2Poly_v0_6/CheapSynth_FM4osc2Poly_v0_6.ino deleted file mode 100644 index f718b32..0000000 --- a/CheapSynth_FM4osc2Poly_v0_6/CheapSynth_FM4osc2Poly_v0_6.ino +++ /dev/null @@ -1,431 +0,0 @@ - -/* - * FM+LFO notes from Mozzi in response to MIDI input, - * using the standard Arduino MIDI library: - * http://playground.arduino.cc/Main/MIDILibrary - * - * NOW COMPATIBLE WITH MOZZI v1.0.2, MIDI library 4.2 - * LESS COMPATIBLE WITH ARDUINO IDE 1.0.6 onwards - http://sensorium.github.io/Mozzi/blog/2015/04/08/use-arduino-1-dot-0-5/ - * - * Mozzi help/discussion/announcements: - * https://groups.google.com/forum/#!forum/mozzi-users - * - * Massively based on examples by Tim Barrass 2013nextenv - * This example code is in the public domain. - * - * sgreen/dpape/dgreen - modified to bring together harmonic FM, LFO, portamento, - * mono note priority, & Rock Band keytar controls - http://www.cheapsynth.com/ - * - * Audio output from pin 9 (pwm) - * Midi plug pin 2 (centre) to Arduino gnd, pin 5 to RX (0) - * http://www.philrees.co.uk/midiplug.htm - * - On Rock Band keytar, switch between patch modes using the big transparent button above -the LEDs, as follows... - -Mode 0 - monophonic FM lead sound with variable modulation harmonics, portamento, modulation depth -on modulation strip, low-frequency oscillator (LFO) speed on pitch bend strip (ie button held down) - -Mode 1 - (2-note polyphonic) Squarewave added to squared-off sinewave at variable harmonics, -pitch bend strip adjusts "duty cycle", ie how much the squared sine is On vs Off - -Mode 2 - (2-note polyphonic) Actually sawtooth wave, pitch bend strip gives chorus-y effect by -variably detuning one of the current notes - -Mode 3 - (2-note "polyphonic") Squarewave XOR'd with sinewaves at variable harmonics, similar fake-LFO -detuning on pitch bend strip, massive upwards zoom on both notes when no portamento! - -Mode 4 - intentionally left blank so you know where you are - -Standard controls: - -Different modulation freq harmonics on the right-hand corner up and down keys between octave up -and octave down (all modes except Mode 2). - -Portamento speed on Back arrow to the left of big transparent Mode button, toggles between no portamento -(ie 2-note polyphony in modes that support it), 10ms fast glide between notes, 400ms slow glide. - -[updated: this note decay now doesn't do anything as I've moved everything to "slow" ADSR..!] -Note decay length on forward arrow to the right of big transparent Mode button (currently applies -to less computationally demanding envelopes in Mode 0 and 2), toggles between short/medium/long -*/ - -#include <MIDI.h> -#include <MozziGuts.h> -#include <Oscil.h> /oscSaw/ oscillator template -#include <Line.h> // for envelope -#include <tables/cos2048_int8.h> // table for Oscils to play -#include <tables/saw1024_int8.h> // table for Oscils to play -#include <tables/smoothsquare8192_int8.h> // NB portamento requires table > 512 size? -#include <mozzi_midi.h> -#include <ADSR.h> -#include <mozzi_fixmath.h> -#include <LowPassFilter.h> -#include <Portamento.h> -#include <Ead.h> - - MIDI_CREATE_DEFAULT_INSTANCE(); - -// use #define for CONTROL_RATE, not a constant -#define CONTROL_RATE 128 // powers of 2 please - -// Mozzi example uses COS waves for carrier and modulator -// DP: "gets brutal very fast" (esp in higher octaves) if you use a saw/square carrier -// gets subtly more brutal if you use smaller wavetables (fewer samples per cycle) -Oscil<SMOOTHSQUARE8192_NUM_CELLS, AUDIO_RATE> oscCarrier(SMOOTHSQUARE8192_DATA); // huge file :( -Oscil<SMOOTHSQUARE8192_NUM_CELLS, AUDIO_RATE> oscSquare2(SMOOTHSQUARE8192_DATA); // huge file :( -Oscil<COS2048_NUM_CELLS, AUDIO_RATE> oscModulator(COS2048_DATA); -Oscil<COS2048_NUM_CELLS, AUDIO_RATE> oscModulator2(COS2048_DATA); -Oscil<COS2048_NUM_CELLS, AUDIO_RATE> oscLFO(COS2048_DATA); -Oscil<SAW1024_NUM_CELLS, AUDIO_RATE> oscSaw1(SAW1024_DATA); -Oscil<SAW1024_NUM_CELLS, AUDIO_RATE> oscSaw2(SAW1024_DATA); - -// envelope generator -ADSR <CONTROL_RATE,CONTROL_RATE> envelope; -ADSR <CONTROL_RATE,CONTROL_RATE> envelope2; -Ead kEnvelopeGuitar1(CONTROL_RATE); //left in here for future use but currently not vital? -Ead kEnvelopeGuitar2(CONTROL_RATE); - -Portamento <CONTROL_RATE>aPortamento; -//LowPassFilter lpf; // LPF left over from earlier versions of code, may reinstate! -//int crushCtrl = 0; // ditto bitcrush - -#define LED 13 // to see if MIDI is being recieved - -long vibrato=0; -long vibrato2=0; -int chanGain1; -int chanGain2; -int LFO; -unsigned int carrierXmodDepth1; -unsigned int carrierXmodDepth2; - -// initialise globals (some eg amplitude no longer used) -int maxmode=4; -float carrierFreq = 10.f; -float carrier2 = 10.f; -float modFreq = 10.f; -float modFreq2 = 10.f; -float modDepth = 0; -float amplitude = 0.f; -float modOffset =1; -byte lastnote1=0; -byte lastnote2=0; -int nextenv=1; -byte portSpeed=0; -byte noteLength=1; -float shifted=0.1f; -byte mode=0; -unsigned long harmonic; -int squaredsin1; -int squaredsin2; -int bitmask=64; -int multiplier; - -float modOffsets[] = { -4,3.5,3,2.5,2,1.5,1,0.6666666,0.5,0.4,0.3333333,0.2857,0.25,0,0,0,0,0,0, -}; // harmonic ratios corresponding to DP's preferred intervals of 7, 12, 7, 19, 24, 0, 12, -12, etc - -void setup() { - pinMode(LED, OUTPUT); - - // Initiate MIDI communications, listen to all channels - MIDI.begin(MIDI_CHANNEL_OMNI); - - // Connect the HandleNoteOn function to the library, so it is called upon reception of a NoteOn. - MIDI.setHandleNoteOn(HandleNoteOn); // Put only the name of the function - MIDI.setHandleNoteOff(HandleNoteOff); // Put only the name of the function - MIDI.setHandleControlChange(HandleControlChange); - MIDI.setHandlePitchBend(HandlePitchBend); // Put only the name of the function - MIDI.setHandleProgramChange(HandleProgramChange); - MIDI.setHandleContinue(HandleContinue); - MIDI.setHandleStop(HandleStop); - MIDI.setHandleStart(HandleStart); - - envelope.setADLevels(127,100); - envelope.setTimes(20,20,20000,1200); // 20000 is so the note will sustain 20 seconds unless a noteOff comes - envelope2.setADLevels(127,100); - envelope2.setTimes(20,20,20000,1200); // 20000 is so the note will sustain 20 seconds unless a noteOff comes - - kEnvelopeGuitar1.set(20, 4000); - kEnvelopeGuitar2.set(20, 4000); - - aPortamento.setTime(0u); -// lpf.setResonance(200); -// lpf.setCutoffFreq(255); - oscLFO.setFreq(10); // default LFO frequency - - startMozzi(CONTROL_RATE); -} - - -void UpdateFreqs() -{ - oscCarrier.setFreq(carrierFreq); - oscSaw1.setFreq(carrierFreq); - carrierXmodDepth1=carrierFreq * modDepth; - modFreq=(carrierFreq * modOffset / (64/bitmask) ); - - oscSquare2.setFreq(carrier2); - oscSaw2.setFreq(carrier2 * (1.0f + ((shifted -0.1f) / 384)) ); - carrierXmodDepth2=carrier2 * modDepth; - modFreq2=(carrier2 * modOffset / (64/bitmask) ); - - oscModulator.setFreq( modFreq ); - oscModulator2.setFreq( modFreq2 ); -} - -void HandleProgramChange (byte channel, byte number) -{ - modOffset = modOffsets[number%15]; - UpdateFreqs(); -// modFreq=(carrierFreq * modOffset / (64/bitmask) ); -//dreadful hack as ProgramChange returns absolute prog number 0-127, "gets stuck" at upper/lower ends -} - -void HandleNoteOn(byte channel, byte note, byte velocity) { - aPortamento.start(note); -// carrierFreq=(mtof(note)); // simple but less accurate frequency -// osc.setFreq_Q16n16(Q16n16_mtof(Q8n0_to_Q16n16(note))); // accurate frequency -if ( portSpeed) - {nextenv=1; lastnote2=999;} - - if (nextenv==1) - { - lastnote1=note; - envelope.noteOn(); -kEnvelopeGuitar1.start(); - digitalWrite(LED,HIGH); - nextenv=2; // send next note to other envelope, unless overridden in the meantime - - carrierFreq = Q16n16_to_float (Q16n16_mtof(Q8n0_to_Q16n16(lastnote1))); - UpdateFreqs(); - } - else - { - lastnote2=note; - envelope2.noteOn(); -kEnvelopeGuitar2.start(); - digitalWrite(LED,HIGH); - nextenv=1; // send next note to other envelope, unless overridden in the meantime - - carrier2 = Q16n16_to_float (Q16n16_mtof(Q8n0_to_Q16n16(lastnote2))); - UpdateFreqs(); - } - -} - -void HandleStop () { //this is the Back button on the Xbox keyboard - portSpeed++; - {if (portSpeed>2) portSpeed = 0;} - aPortamento.setTime( (portSpeed*portSpeed*100) ); // values of 0,100,400 milliseconds? (next 900) -} - -void HandleStart () { //CURRENTLY NOT USED - noteLength=(noteLength+1)%3; // loop from 0-2 - kEnvelopeGuitar1.set(20, (noteLength+1)*(noteLength+1)*(noteLength+1)*500 ); - kEnvelopeGuitar2.set(20, (noteLength+1)*(noteLength+1)*(noteLength+1)*500 ); - //cube into values around 500, 4000, 13500 -} - -void HandleContinue () { // the big round button on all keytars - mode++; - {if (mode>maxmode) mode = 0;} //currently has a silent mode at the end so you know where you are : ) -} - -void HandleNoteOff(byte channel, byte note, byte velocity) { - digitalWrite(LED,LOW); // may as well switch LED off - - if ( (note == lastnote1) ) //kill envelope if prev note released - { - envelope.noteOff(); - if (chanGain2) {nextenv=1;} -} - - if ( (note == lastnote2) ) - {envelope2.noteOff(); - if (chanGain1) {nextenv=2;} - } - -} - - -void HandlePitchBend (byte channel, int bend) -{ -//bend value from +/-8192, translate to 0.1-8 Hz? -shifted= float ((bend+8500) /2048.f ) +0.1f; -if (mode==0) {oscLFO.setFreq(shifted); } -if (mode==1) - { - bitmask= 1 << (int (shifted)); multiplier=7-(int (shifted)); - UpdateFreqs(); - } - else {bitmask=64;} - -if (mode==2) { oscSaw2.setFreq(carrier2 * (1.0f + ((shifted -0.1f) / 384)) ); } -} - -void HandleControlChange (byte channel, byte number, byte value) -{ -// http://www.indiana.edu/~emusic/cntrlnumb.html - -/* -Serial.end(); // sample debug code to check values through (noisy) terminal interface -Serial.begin(38400); -Serial.print(" number:"); -Serial.print(number); -Serial.print(" value:"); -Serial.println( value ); -Serial.println(); -Serial.end(); -Serial.begin(31250); -*/ - - switch(number) { -// case 3: // could trap different controller IDs here - - case 1: // modulation wheel - //lpf.setResonance(value*2); - - //WORKING MODDEPTH CONTROLLER - float divided= float (value /46.f ); // values=0-127, map to 0-2.75 - modDepth = (divided * divided); // square to 0-8 - if (modDepth>7.5) {modDepth=7.5;} // sanity check (prob unnecessary) - if (modDepth<0.2) {modDepth=0;} // easier to get pure tone - UpdateFreqs(); - break; - } -} - -void updateControl(){ - MIDI.read(); - envelope.update(); - envelope2.update(); - - chanGain1 = envelope.next(); - chanGain2 = envelope2.next(); - -// chanGain1 = kEnvelopeGuitar1.next(); -// chanGain2 = kEnvelopeGuitar2.next(); - if(chanGain1 > 120) chanGain1 = 120; - if(chanGain2 > 120) chanGain2 = 120; - -if ( portSpeed ) - { - carrierFreq = Q16n16_to_float ( aPortamento.next() ); //NB presumably returns frequency as Q16n16 - UpdateFreqs(); - } - -if (mode==3) - { - modFreq *= 1.0f +(shifted / 384); // generates fake LFO via detuning mod osc - modFreq2*= 1.0f +(shifted / 384); // generates fake LFO via detuning mod osc -// modFreq2*= 1 + (shifted -0.1f) / 384); // generates fake LFO via detuning mod osc - oscModulator.setFreq( modFreq ); - oscModulator2.setFreq( modFreq2 ); - } - -} - -// strip the low bits off! - not used in current implementation -int bitCrush(int x, int a) -{ - return (x>>a)<<a; -} - -int updateAudio(){ - - switch(mode) - { - case 0: // FM with LFO -//NB this multiplication split into 2 chunks to preserve small precise values? -LFO=oscLFO.next(); -vibrato = ( LFO * oscModulator.next() ) >>7 ; -vibrato*= carrierXmodDepth1; -vibrato2 = ( LFO * oscModulator2.next() ) >>7 ; -vibrato2*= carrierXmodDepth2; -return (int) ( - (oscCarrier.phMod( vibrato >>3 ) * chanGain1 ) - + (oscSquare2.phMod( vibrato2>>3 ) * chanGain2 ) - ) >> 9; -// >> 9 = 9 fast binary divisions by 2 = divide by 512 - break; - - case 1: // ADDING square + "converted" sine -//squaredsin1= ( (oscModulator.next() & 0b0000000001000000)-1 ) <<1; -squaredsin1= ( (oscModulator.next() & bitmask) ) <<multiplier; -squaredsin2= ( (oscModulator2.next() & bitmask) ) <<multiplier; -return (int) -( - ( ( (oscCarrier.next() + squaredsin1 )>>1 )* chanGain1 ) -+ ( ( (oscSquare2.next() + squaredsin2 )>>1 )* chanGain2 ) -) >> 8; - break; - - case 2: // 2 tri poly -return (int)( - ( oscSaw1.next() *chanGain1 ) - + ( oscSaw2.next() *chanGain2 ) - ) >> 9; - break; - - case 3: // STARTED AS 2 sq poly XORd with respective sines, now big whoop -return (int)( - ( (oscCarrier.next()^oscModulator.next()) * chanGain1 ) - + ( (oscSquare2.next()^oscModulator2.next())* chanGain2 ) - ) >> 8; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; - - case 13: // 2 sq poly ORd with respective sines -return (int) ( ( (oscCarrier.next()|oscModulator.next() ) * envelope.next()) + ( (oscSquare2.next()|oscLFO.next() ) * envelope2.next()) ) >> 8; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; - - - case 6: // 2 sq poly -return (int) ( (oscCarrier.next() * envelope.next()) + (oscSquare2.next() * envelope2.next()) ) >> 8; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; - -//case 5 intentionally left blank - -/* - case 6: // ADDING squares -return (int) ( (oscCarrier.next() + oscSquare2.next() ) * (envelope.next() ) ) >> 8; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; -*/ -// case 1: // AND with fake LFO -//all this 'harmonic' stuff a failed attempt to use the same LFO as FM, causes massive beat f/x? -//harmonic = ( oscLFO.next() * oscModulator.next() ) >> 7; -//harmonic = ( harmonic * int (modDepth+1) ) >>3 ; -//return (int) ( (oscCarrier.next() ^ ( harmonic )) * (envelope.next() ) ) >> 7; -//return (int) ( (oscCarrier.next() & ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; -// break; - -/* case 3: // OR with fake LFO -//int harmonic = ( oscLFO.next() * oscModulator.next() ) >>7; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; -// break; - case 4: // XOR with fake LFO -//int harmonic = ( oscLFO.next() * oscModulator.next() ) >>7; -return (int) ( (oscCarrier.next() ^ ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; - */ - } - -// OLD CODE FROM BITCRUNCHED SINEWAVE, DIFF WAYS OF DOING THAT -// int x = (envelope.next() * lpf.next(osc.next()))>>8; -// x = bitCrush(x, crushCtrl>>4); -// x = (x * crushCtrl)>>4; // simple gain -// x = bitCrush(x, 6); -// x = lpf.next(x); -// return x; -} - - -void loop() { - audioHook(); // required here -} - diff --git a/CheapSynth_FM4oscZoom_v0_5_5.ino b/CheapSynth_FM4oscZoom_v0_5_5.ino deleted file mode 100644 index 583d60b..0000000 --- a/CheapSynth_FM4oscZoom_v0_5_5.ino +++ /dev/null @@ -1,348 +0,0 @@ - -/* - * FM+LFO notes from Mozzi in response to MIDI input, - * using the standard Arduino MIDI library: - * http://playground.arduino.cc/Main/MIDILibrary - * - * Mozzi help/discussion/announcements: - * https://groups.google.com/forum/#!forum/mozzi-users - * - * Massively based on examples by Tim Barrass 2013nextenv - * This example code is in the public domain. - * - * sgreen/dpape/dgreen - modified to bring together harmonic FM, LFO, portamento, - * mono note priority, & Rock Band keytar controls - http://www.cheapsynth.com/ - * - * Audio output from pin 9 (pwm) - * Midi plug pin 2 (centre) to Arduino gnd, pin 5 to RX (0) - * http://www.philrees.co.uk/midiplug.htm - * - */ - -#include <MIDI.h> -#include <MozziGuts.h> -#include <Oscil.h> // oscillator template -#include <Line.h> // for envelope -#include <tables/cos2048_int8.h> // table for Oscils to play -#include <tables/saw1024_int8.h> // table for Oscils to play -#include <tables/smoothsquare8192_int8.h> // NB portamento requires table > 512 size? -#include <mozzi_midi.h> -#include <ADSR.h>384 -#include <mozzi_fixmath.h> -#include <LowPassFilter.h> -#include <Portamento.h> - -// use #define for CONTROL_RATE, not a constant -#define CONTROL_RATE 128 // powers of 2 please - -// Mozzi example uses COS waves for carrier and modulator -// DP: "gets brutal very fast" (esp in higher octaves) if you use a saw/square carrier -// gets subtly more brutal if you use smaller wavetables (fewer samples per cycle) -Oscil<SMOOTHSQUARE8192_NUM_CELLS, AUDIO_RATE> oscCarrier(SMOOTHSQUARE8192_DATA); // huge file :( -Oscil<SMOOTHSQUARE8192_NUM_CELLS, AUDIO_RATE> oscSquare2(SMOOTHSQUARE8192_DATA); // huge file :( -Oscil<COS2048_NUM_CELLS, AUDIO_RATE> oscModulator(COS2048_DATA); -Oscil<COS2048_NUM_CELLS, AUDIO_RATE> oscLFO(COS2048_DATA); -Oscil<SAW1024_NUM_CELLS, AUDIO_RATE> oscTri1(SAW1024_DATA); -Oscil<SAW1024_NUM_CELLS, AUDIO_RATE> oscTri2(SAW1024_DATA); - -// envelope generator -ADSR <CONTROL_RATE> envelope; -ADSR <CONTROL_RATE> envelope2; - -Portamento <CONTROL_RATE>aPortamento; -//LowPassFilter lpf; // LPF left over from earlier versions of code, may reinstate! -//int crushCtrl = 0; // ditto bitcrush - -#define LED 13 // to see if MIDI is being recieved - -unsigned long vibrato=0; - -// initialise globals (some eg amplitude no longer used) -int maxmode=4; -float carrierFreq = 10.f; -float carrier2 = 10.f; -float modFreq = 10.f; -float modDepth = 0; -float amplitude = 0.f; -float modOffset =1; -byte lastnote1=0; -byte lastnote2=0; -int nextenv=1; -int portSpeed=0; -float shifted=0.1f; -int mode=0; -unsigned long harmonic; -int squaredsin1; -int squaredsin2; -int bitmask=64; -int multiplier; - -float modOffsets[] = { -4,3.5,3,2.5,2,1.5,1,0.6666666,0.5,0.4,0.3333333,0.2857,0.25,0,0,0,0,0,0, -}; // harmonic ratios corresponding to DP's preferred intervals of 7, 12, 7, 19, 24, 0, 12, -12, etc - -void setup() { - pinMode(LED, OUTPUT); - - // Initiate MIDI communications, listen to all channels - MIDI.begin(MIDI_CHANNEL_OMNI); - - // Connect the HandleNoteOn function to the library, so it is called upon reception of a NoteOn. - MIDI.setHandleNoteOn(HandleNoteOn); // Put only the name of the function - MIDI.setHandleNoteOff(HandleNoteOff); // Put only the name of the function - MIDI.setHandleControlChange(HandleControlChange); - MIDI.setHandlePitchBend(HandlePitchBend); // Put only the name of the function - MIDI.setHandleProgramChange(HandleProgramChange); - MIDI.setHandleContinue(HandleContinue); - MIDI.setHandleStop(HandleStop); - - envelope.setADLevels(127,100); - envelope.setTimes(20,20,20000,850); // 20000 is so the note will sustain 20 seconds unless a noteOff comes - envelope2.setADLevels(127,100); - envelope2.setTimes(20,20,20000,850); // 20000 is so the note will sustain 20 seconds unless a noteOff comes - - aPortamento.setTime(0u); -// lpf.setResonance(200); -// lpf.setCutoffFreq(255); - oscLFO.setFreq(10); // default LFO frequency - - startMozzi(CONTROL_RATE); -} - - -void HandleProgramChange (byte channel, byte number) -{ - modOffset = modOffsets[number%15]; - modFreq=(carrierFreq * modOffset / (64/bitmask) ); - -//dreadful hack as ProgramChange returns absolute prog number 0-127, "gets stuck" at upper/lower ends -} - -void HandleNoteOn(byte channel, byte note, byte velocity) { - aPortamento.start(note); -// carrierFreq=(mtof(note)); // simple but less accurate frequency -// osc.setFreq_Q16n16(Q16n16_mtof(Q8n0_to_Q16n16(note))); // accurate frequency - -if ( (mode==0) || portSpeed) - {nextenv=1; lastnote2=999;} - - if (nextenv==1) - { - lastnote1=note; - envelope.noteOn(); - digitalWrite(LED,HIGH); - nextenv=2; // send next note to other envelope, unless overridden in the meantime - - carrierFreq = Q16n16_to_float (Q16n16_mtof(Q8n0_to_Q16n16(lastnote1))); - oscCarrier.setFreq(carrierFreq); - oscTri1.setFreq(carrierFreq); - modFreq=(carrierFreq * modOffset / (64/bitmask) ); - } - else - { - lastnote2=note; - envelope2.noteOn(); - digitalWrite(LED,HIGH); - nextenv=1; // send next note to other envelope, unless overridden in the meantime - - carrier2 = Q16n16_to_float (Q16n16_mtof(Q8n0_to_Q16n16(lastnote2))); - oscSquare2.setFreq(carrier2); - oscTri2.setFreq(carrier2 * (1.0f + ((shifted -0.1f) / 384)) ); - } - -} - -void HandleStop () { //this is the Back button on the Xbox keyboard - portSpeed++; - {if (portSpeed>2) portSpeed = 0;} - aPortamento.setTime( (portSpeed*portSpeed*100) ); // values of 0,100,400 milliseconds? (next 900) -} - -void HandleContinue () { // the big round button on all keytars - mode++; - {if (mode>maxmode) mode = 0;} //currently has a silent mode at the end so you know where you are : ) -} - -void HandleNoteOff(byte channel, byte note, byte velocity) { - digitalWrite(LED,LOW); // may as well switch LED off - - if ( (note == lastnote1) ) - { - envelope.noteOff(); nextenv=1;} //kill envelope if prev note released - - if ( (note == lastnote2) ) - {envelope2.noteOff(); nextenv=2;} //kill envelope if prev note released - -} - - -void HandlePitchBend (byte channel, int bend) -{ -//bend value from +/-8192, translate to 0.1-8 Hz? -shifted= float ((bend+8500) /2048.f ) +0.1f; -if (mode==0) {oscLFO.setFreq(shifted); } -if (mode==1) - { - bitmask= 1 << (int (shifted)); multiplier=7-(int (shifted)); - } - else {bitmask=64;} - -if (mode==2) { oscTri2.setFreq(carrier2 * (1.0f + ((shifted -0.1f) / 384)) ); } - -} - -void HandleControlChange (byte channel, byte number, byte value) -{ -// http://www.indiana.edu/~emusic/cntrlnumb.html - -/* -Serial.end(); // sample debug code to check values through (noisy) terminal interface -Serial.begin(38400); -Serial.print(" number:"); -Serial.print(number); -Serial.print(" value:"); -Serial.println( value ); -Serial.println(); -Serial.end(); -Serial.begin(31250); -*/ - - switch(number) { -// case 3: // could trap different controller IDs here - - case 1: // modulation wheel - //lpf.setResonance(value*2); - - //WORKING MODDEPTH CONTROLLER - float divided= float (value /46.f ); // values=0-127, map to 0-2.75 - modDepth = (divided * divided); // square to 0-8 - if (modDepth>7.5) {modDepth=7.5;} // sanity check (prob unnecessary) - if (modDepth<0.2) {modDepth=0;} // easier to get pure tone - break; - } -} - -void updateControl(){ - MIDI.read(); - envelope.update(); - envelope2.update(); - -if ( portSpeed ) - { - carrierFreq = Q16n16_to_float ( aPortamento.next() ); //NB presumably returns frequency as Q16n16 - oscCarrier.setFreq(carrierFreq); - oscTri1.setFreq(carrierFreq); - modFreq=(carrierFreq * modOffset / (64/bitmask) ); - } - -if (mode) - { - float modFreq2=(carrier2 * modOffset / (64/bitmask) ); //NB no longer LFO - - if (mode>1) - { - modFreq *= 1.0f + ((shifted -0.1f) / 384); // generates fake LFO via detuning mod osc - modFreq2 *= 1.0f + ((shifted -0.1f) / 384); // generates fake LFO via detuning mod osc - } - oscLFO.setFreq (modFreq2); - } -oscModulator.setFreq( modFreq ); - -} - -// strip the low bits off! - not used in current implementation -int bitCrush(int x, int a) -{ - return (x>>a)<<a; -} - -int updateAudio(){ - - switch(mode) - { - case 0: // FM with LFO -//NB this multiplication split into 2 chunks to preserve small precise values? -vibrato = (unsigned long) ( oscLFO.next() * oscModulator.next() ) >>7 ; -vibrato*= (unsigned long) (carrierFreq * modDepth)>>3; -return (int) ((oscCarrier.phMod( vibrato ) ) * (envelope.next() ) ) >> 8; -// >> 7 = 7 fast binary divisions by 2 = divide by 128 - break; - - case 1: // ADDING square + "converted" sine -//squaredsin1= ( (oscModulator.next() & 0b0000000001000000)-1 ) <<1; -squaredsin1= ( (oscModulator.next() & bitmask) ) <<multiplier; -squaredsin2= ( (oscLFO.next() & bitmask) ) <<multiplier; -return (int) -( - ( ( (oscCarrier.next() + squaredsin1 )>>1 )*envelope.next() ) -+ ( ( (oscSquare2.next() + squaredsin2 )>>1 )*envelope2.next() ) -) >> 8; - break; - - case 2: // 2 tri poly -return (int)( - ( oscTri1.next() *envelope.next() ) - + ( oscTri2.next() *envelope2.next() ) - ) >> 8; - break; - - case 3: // STARTED AS 2 sq poly ORd with matching sines, now big whoop -return (int)( - ( (oscCarrier.next()|oscModulator.next()) * envelope.next() ) - + ( (oscSquare2.next()|oscLFO.next()) * envelope2.next() ) - ) >> 8; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; - - case 13: // 2 sq poly XORd with matching sines -return (int) ( ( (oscCarrier.next()^oscModulator.next() ) * envelope.next()) + ( (oscSquare2.next()^oscLFO.next() ) * envelope2.next()) ) >> 8; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; - - - case 6: // 2 sq poly -return (int) ( (oscCarrier.next() * envelope.next()) + (oscSquare2.next() * envelope2.next()) ) >> 8; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; - -//case 5 intentionally left blank - -/* - case 6: // ADDING squares -return (int) ( (oscCarrier.next() + oscSquare2.next() ) * (envelope.next() ) ) >> 8; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; -*/ -// case 1: // AND with fake LFO -//all this 'harmonic' stuff a failed attempt to use the same LFO as FM, causes massive beat f/x? -//harmonic = ( oscLFO.next() * oscModulator.next() ) >> 7; -//harmonic = ( harmonic * int (modDepth+1) ) >>3 ; -//return (int) ( (oscCarrier.next() ^ ( harmonic )) * (envelope.next() ) ) >> 7; -//return (int) ( (oscCarrier.next() & ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; -// break; - -/* case 3: // OR with fake LFO -//int harmonic = ( oscLFO.next() * oscModulator.next() ) >>7; -//return (int) ( (oscCarrier.next() | ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; -// break; - case 4: // XOR with fake LFO -//int harmonic = ( oscLFO.next() * oscModulator.next() ) >>7; -return (int) ( (oscCarrier.next() ^ ( (oscModulator.next() * int (modDepth+1))>>3 ) ) * (envelope.next() ) ) >> 7; - break; - */ - } - -// OLD CODE FROM BITCRUNCHED SINEWAVE, DIFF WAYS OF DOING THAT -// int x = (envelope.next() * lpf.next(osc.next()))>>8; -// x = bitCrush(x, crushCtrl>>4); -// x = (x * crushCtrl)>>4; // simple gain -// x = bitCrush(x, 6); -// x = lpf.next(x); -// return x; -} - - -void loop() { - audioHook(); // required here -} - diff --git a/CheapSynth_SeqMode_v0_9_0.ino b/CheapSynth_SeqMode_v0_9_0.ino deleted file mode 100644 index b6bbbc2..0000000 --- a/CheapSynth_SeqMode_v0_9_0.ino +++ /dev/null @@ -1,300 +0,0 @@ -// CheapSynth "sequencer" mode 2013 - quite clumsily stuck (by Dave Green) on top of -// "A very simple MIDI synth." -// Greg Kennedy 2011 -// http://forum.arduino.cc/index.php?topic=79326.0 -// -// You should be able to spot the note arrays further down, and can use the modulation MIDI control -// to adjust the "modulation depth" (ie how grainy the notes sound) -// -// Other controls: Program Up + Down = change tempo -// Continue = "Pause" - -#include <avr/pgmspace.h> - -#include <MozziGuts.h> -#include <Oscil.h> -#include <tables/cos256_int8.h> // table for Oscils to play -#include <tables/saw256_int8.h> // table for Oscils to play -#include <tables/square_analogue512_int8.h> // table for Oscils to play -#include <mozzi_midi.h> // for mtof - -#define CONTROL_RATE 128 // powers of 2 please - -// Mozzi example uses COS waves for carrier and modulator -// gets brutal very fast if you use a saw/square carrier -// gets subtly more brutal if you use smaller wavetables (fewer samples per cycle) -Oscil<SQUARE_ANALOGUE512_NUM_CELLS, AUDIO_RATE> oscCarrier(SQUARE_ANALOGUE512_DATA); -Oscil<COS256_NUM_CELLS, AUDIO_RATE> oscModulator(COS256_DATA); - -int midiNotes[] = { -//these are MIDI note values, ie 12 = C, 24 = next C up -//NB note values of 25+ currently considered as absolute (ie don't change with keypress) -/* -16,16,28,28,16,16,26,28,//lee coombs -16,16,28,28,16,16,26,28, -16,16,28,28,16,16,26,28, -16,16,28,28,16,16,26,28, -*/ -//octaves - blue mon, hung up, erasure? etc -12,24,12,24,12,24,12,24,12,24,12,24,12,24,12,24, -12,24,12,24,12,24,12,24,12,24,12,24,12,24,12,24, - -//descending bass (eg Bowie's Heroes) -24,24,21,19,24,24,21,19,24,24,21,19,24,24,21,19, -24,24,21,19,24,24,21,19,24,24,21,19,24,24,21,19, - -//different accented octaves (similar to OMD's Enola Gay) -12,12,24,12,12,24,12,24, -12,12,24,12,12,24,12,24, -12,12,24,12,12,24,12,24, -12,12,24,12,12,24,12,24, - -/// 12/8 shuffle rhythm (eg Muse) -12,12,24,12,12,24,12,12,24,12,12,24, -12,12,24,12,12,24,12,12,24,12,12,24, -}; - -int modOffsets[] = { -/* -//lee C -12, 12, 12, 12, 12, 19, 12, 12, -12, 12, 12, 12, 12, 19, 12, 12, -12, 12, 12, 12, 12, 19, 12, 12, -12, 12, 12, 12, 12, 19, 12, 12, -*/ -12, 12, 12, 12, 12, 12, 12, 12, //octaves -12, 12, 12, 12, 12, 12, 12, 12, -12, 12, 12, 12, 12, 12, 12, 12, -12, 12, 12, 12, 12, 12, 12, 12, - -// here I'm using different modulation offsets to distinguish between adjacent notes -// (probably also easy to devise a system to play a rest (ie amplitude=0) if note value=0?? -0,12,0,0,12,0,0,0,0,12,0,0,12,0,0,0,//descending bass -0,12,0,0,12,0,0,0,0,12,0,0,12,0,0,0, - -0,12,0,0,12,0,0,0,0,12,0,0,12,0,0,0,//accented octaves -0,12,0,0,12,0,0,0,0,12,0,0,12,0,0,0, - -12, 12, 12, 12, 12, 12, 12, 12, // shuffle -12, 12, 12, 12, 12, 12, 12, 12, -12, 12, 12, 12, 12, 12, 12, 12, -12, 12, 12, 12, 12, 12, 12, 12, -}; - -//float modDepths[] = { -// 0, 1, 3, 0.5, 6, 2, 1, 2, -// 0.5, 8, 3, 0.5, 2, 2, 1, 0.125 -//}; - -float note = 24; -int lastByte; -float bendByte =50; - -int tuneOffset = 0; -int tickLengthConverter = 26; -int arraySize = 32; -int controlTick = 0; -int arrayIndex = 0; -int sequenced; -int playflag = 1; - -float carrierFreq = 10.f; -float modFreq = 10.f; -float bendRead = 10.f; -long modDepth = 1; - -float amplitude = 1.f; - -void setParams(){ - // mtof converts MIDI note range to Hz freq -sequenced=midiNotes[arrayIndex + (arraySize*tuneOffset)]; - -if (sequenced<25) {sequenced += note; } else {sequenced += 36; } -//if (tuneOffset >0) {sequenced -= 12; } - -carrierFreq = mtof(sequenced); - -// FM harmonics are most musical when modulator's @ simple musical offsets from carrier -// EG +12 semitones (1 oct), -24 semitones (-2 oct), +19 semitones (+1 octave and a fifth) -modFreq = mtof( ( sequenced + modOffsets[arrayIndex+ (arraySize*tuneOffset)] ) ); - -// I like to make modulation depth (in Hz) some ratio of the carrier's freq -// That way, the perceived intensity of the FM is the same throughout the note range -// modDepth = (long) 6; -bendRead=(bendByte / 30); -modDepth = (long) carrierFreq * bendRead * bendRead; // 7 was good - - // Set oscillator frequencies - oscCarrier.setFreq(carrierFreq); - oscModulator.setFreq(modFreq); -} - -// Move on to the next note -void incrementIndexes(){ - arrayIndex ++; - int sizelimit=arraySize-1; - -//Sample code on how to view what's going on -Serial.end(); -Serial.begin(115200); -Serial.print(" arrayIndex:"); -Serial.println( arrayIndex - ); -Serial.println(); -Serial.end(); -Serial.begin(31250); - -if (tuneOffset==3) {sizelimit = 23;} // hack to allow patterns of different length -if(arrayIndex>sizelimit){ - arrayIndex = 0; - } -} - -// NOW BACK TO YOUR REGULARLY SCHEDULED MIDI SCAN - comments by Greg Kennedy 2011 - -#define statusLed 13 -#define tonePin 8 - -// MIDI channel to answer to, 0x00 - 0x0F -#define myChannel 0x00 -// set to TRUE and the device will respond to all channels -#define respondAllChannels true - -// midi commands -#define MIDI_CMD_NOTE_OFF 0x80 -#define MIDI_CMD_NOTE_ON 0x90 -#define MIDI_CMD_KEY_PRESSURE 0xA0 -#define MIDI_CMD_CONTROLLER_CHANGE 0xB0 -#define MIDI_CMD_PROGRAM_CHANGE 0xC0 -#define MIDI_CMD_CHANNEL_PRESSURE 0xD0 -#define MIDI_CMD_PITCH_BEND 0xB0 - -// this is a placeholder: there are -// in fact real midi commands from F0-FF which -// are not channel specific. -// this simple synth will just ignore those though. -#define MIDI_CMD_SYSEX 0xF0 - -// a dummy "ignore" state for commands which -// we wish to ignore. -#define MIDI_IGNORE 0x00 - -// midi "state" - which data byte we are receiving -#define MIDI_STATE_BYTE1 0x00 -#define MIDI_STATE_BYTE2 0x01 - -// MIDI note to frequency -// This isn't exact and may sound a bit detuned at lower notes, because -// the floating point values have been rounded to uint16. -// Based on A440 tuning. - -// I would prefer to use the typedef for this (prog_uint16_t), but alas that triggers a gcc bug -// and does not put anything into the flash memory. - -// Also note the limitations of tone() which at 16mhz specifies a minimum frequency of 31hz - in other words, notes below -// B0 will play at the wrong frequency since the timer can't run that slowly! -uint16_t frequency[128] PROGMEM = {8, 9, 9, 10, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 19, 21, 22, 23, 24, 26, 28, 29, 31, 33, 35, 37, 39, 41, 44, 46, 49, 52, 55, 58, 62, 65, 69, 73, 78, 82, 87, 92, 98, 104, 110, 117, 123, 131, 139, 147, 156, 165, 175, 185, 196, 208, 220, 233, 247, 262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494, 523, 554, 587, 622, 659, 698, 740, 784, 831, 880, 932, 988, 1047, 1109, 1175, 1245, 1319, 1397, 1480, 1568, 1661, 1760, 1865, 1976, 2093, 2217, 2349, 2489, 2637, 2794, 2960, 3136, 3322, 3520, 3729, 3951, 4186, 4435, 4699, 4978, 5274, 5588, 5920, 5920, 6645, 7040, 7459, 7902, 8372, 8870, 9397, 9956, 10548, 11175, 11840, 12544}; - -//setup: declaring iputs and outputs and begin serial -void setup() { - startMozzi(CONTROL_RATE); - - pinMode(statusLed,OUTPUT); // declare the LED's pin as output - - pinMode(tonePin,OUTPUT); // setup tone output pin - - //start serial with midi baudrate 31250 - // or 38400 for debugging (eg MIDI over serial from PC) - Serial.begin(31250); - - // indicate we are ready to receive data! - digitalWrite(statusLed,HIGH); -} - -//loop: wait for serial data - DG: in hindsight, this should really go in updateControl() -// (impressed that it even works this way round!) -void loop () { - audioHook(); - static byte lastCommand = MIDI_IGNORE; - static byte state; - - while (Serial.available()) { - - // read the incoming byte: - byte incomingByte = Serial.read(); - - // Command byte? - if (incomingByte & 0b10000000) { - if (respondAllChannels || - (incomingByte & 0x0F) == myChannel) { // See if this is our channel - - if (incomingByte==0xFC) {tuneOffset--; {if (tuneOffset<0) tuneOffset=3;} } - if (incomingByte==0xFA) {tuneOffset++; {if (tuneOffset>3) tuneOffset=0;} } - if (incomingByte==0xFB) {playflag++; {if (playflag>1) playflag=0;} } - - lastCommand = incomingByte & 0xF0; - } else { // Not our channel. Ignore command. - lastCommand = MIDI_IGNORE; - } - state = MIDI_STATE_BYTE1; // Reset our state to byte1. - } else if (state == MIDI_STATE_BYTE1) { // process first data byte - if ( lastCommand==MIDI_CMD_NOTE_OFF ) - { // if we received a "note off", make sure that is what is currently playing - if (note == incomingByte) noTone(tonePin); - state = MIDI_STATE_BYTE2; // expect to receive a velocity byte - } else if ( lastCommand == MIDI_CMD_NOTE_ON ){ // if we received a "note on", we wait for the note (databyte) - lastByte=incomingByte; // save the current note - state = MIDI_STATE_BYTE2; // expect to receive a velocity byte - } - // implement whatever further commands you want here - else if ( lastCommand == MIDI_CMD_PITCH_BEND ){ - bendByte=incomingByte; // save the current note - state = MIDI_STATE_BYTE1; // expect to receive a velocity byte - } - - else if ( lastCommand == MIDI_CMD_PROGRAM_CHANGE ) - { -tickLengthConverter = 31 - (incomingByte % 32); - - // save the current note - state = MIDI_STATE_BYTE1; // expect to receive a velocity byte - } - - - } else { // process second data byte - if (lastCommand == MIDI_CMD_NOTE_ON) { - if (incomingByte != 0) { - note = lastByte; -// tone(tonePin,(unsigned int)pgm_read_word(&frequency[note])); -// NB ToneMIDISynth generally good for diagnosing MIDI activity -// setParams(); - } else if (note == lastByte) { - noTone(tonePin); - } - } - state = MIDI_STATE_BYTE1; // message data complete - // This should be changed for SysEx - } - } -} - -void updateControl(){ - if(controlTick == 0) - { - setParams(); - incrementIndexes(); - } - - // Update controlTick - controlTick +=playflag; - - if(controlTick > tickLengthConverter) - { - controlTick = 0; - } -} - -int updateAudio(){ - long vibrato = modDepth * oscModulator.next(); - return (int) (oscCarrier.phMod(vibrato)) * amplitude; -} diff --git a/Mozzi_drumsDG0_0_2BETA/Mozzi_drumsDG0_0_2BETA.ino b/Mozzi_drumsDG0_0_2BETA/Mozzi_drumsDG0_0_2BETA.ino deleted file mode 100644 index f1810c2..0000000 --- a/Mozzi_drumsDG0_0_2BETA/Mozzi_drumsDG0_0_2BETA.ino +++ /dev/null @@ -1,172 +0,0 @@ -/* Example of a sound being triggered by MIDI input. - * - * Demonstrates playing notes with Mozzi in response to MIDI input, - * using the standard Arduino MIDI library: - * http://playground.arduino.cc/Main/MIDILibrary - * - * Mozzi help/discussion/announcements: - * https://groups.google.com/forum/#!forum/mozzi-users - * - * Tim Barrass 2013. - * This example code is in the public domain. - * - * sgreen - modified to use standard Arduino midi library, added saw wave, lowpass filter - * Audio output from pin 9 (pwm) - * Midi plug pin 2 (centre) to Arduino gnd, pin 5 to RX (0) - * http://www.philrees.co.uk/midiplug.htm - * Now with drums! - */ - - -#include <MIDI.h> -#include <MozziGuts.h> -#include <Oscil.h> // oscillator template -#include <Line.h> // for envelope -#include <Sample.h> - -//#include <tables/sin2048_int8.h> // sine table for oscillator -#include <tables/saw2048_int8.h> -#include "kick909.h" -#include "snare909.h" -#include "hihatc909.h" -#include "hihato909.h" - -#include <mozzi_midi.h> -#include <ADSR.h> -#include <fixedMath.h> -#include <LowPassFilter.h> - -// use #define for CONTROL_RATE, not a constant -#define CONTROL_RATE 128 // powers of 2 please - -unsigned long ctrlCounter = 0; - -// audio sinewave oscillator -//Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> osc(SIN2048_DATA); -Oscil <SAW2048_NUM_CELLS, AUDIO_RATE> osc(SAW2048_DATA); - -// drums -Sample <kick909_NUM_CELLS, AUDIO_RATE> kickSamp(kick909_DATA); -Sample <snare909_NUM_CELLS, AUDIO_RATE> snareSamp(snare909_DATA); -Sample <hihatc909_NUM_CELLS, AUDIO_RATE> hihatcSamp(hihatc909_DATA); -Sample <hihato_NUM_CELLS, AUDIO_RATE> hihatoSamp(hihato_DATA); - -byte pattern[4][16] = { - //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 hhc - 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, // 1 hho - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, // 2 snare - 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1 // 3 kick -}; - -// envelope generator -ADSR <CONTROL_RATE> envelope; -LowPassFilter lpf; -int crushCtrl = 0; - -#define LED 13 // to see if MIDI is being recieved - -void HandleNoteOn(byte channel, byte note, byte velocity) { - //osc.setFreq(mtof(note)); // simple but less accurate frequency - osc.setFreq_Q16n16(Q16n16_mtof(Q8n0_to_Q16n16(note))); // accurate frequency - envelope.noteOn(); - digitalWrite(LED,HIGH); -} - -void HandleNoteOff(byte channel, byte note, byte velocity) { - envelope.noteOff(); - digitalWrite(LED,LOW); -} - -void HandleControlChange (byte channel, byte number, byte value) -{ - // http://www.indiana.edu/~emusic/cntrlnumb.html - switch(number) { - //case 1: // modulation wheel - case 105: - lpf.setCutoffFreq(value*2); // control messages are in [0, 127] range - break; - case 106: - //lpf.setResonance(value*2); - crushCtrl = value; - break; - } -} - -void setup() { - pinMode(LED, OUTPUT); - - // Initiate MIDI communications, listen to all channels - MIDI.begin(MIDI_CHANNEL_OMNI); - - // Connect the HandleNoteOn function to the library, so it is called upon reception of a NoteOn. - MIDI.setHandleNoteOn(HandleNoteOn); // Put only the name of the function - MIDI.setHandleNoteOff(HandleNoteOff); // Put only the name of the function - MIDI.setHandleControlChange(HandleControlChange); - - envelope.setADLevels(127,64); - envelope.setTimes(50,200,10000,200); // 10000 is so the note will sustain 10 seconds unless a noteOff comes - - lpf.setResonance(200); - lpf.setCutoffFreq(255); - - osc.setFreq(440); // default frequency - - kickSamp.setFreq((float) kick909_SAMPLERATE / (float) kick909_NUM_CELLS); - snareSamp.setFreq((float) snare909_SAMPLERATE / (float) snare909_NUM_CELLS); - hihatcSamp.setFreq((float) hihatc909_SAMPLERATE / (float) hihatc909_NUM_CELLS); - hihatoSamp.setFreq((float) hihato_SAMPLERATE / (float) hihato_NUM_CELLS); - - //snareSamp.start(); - - startMozzi(CONTROL_RATE); -} - -int beat = 0; -int oldBeat = 0; - -void updateControl(){ - MIDI.read(); - envelope.update(); - - // drums - ctrlCounter++; - // this is called at 128Hz -> 120bmp!? - beat = ((ctrlCounter*2*4)>>7); - if (beat != oldBeat) { - if (pattern[0][beat&0xf]) hihatcSamp.start(); - if (pattern[1][beat&0xf]) hihatoSamp.start(); - if (pattern[2][beat&0xf]) snareSamp.start(); - if (pattern[3][beat&0xf]) kickSamp.start(); - } - oldBeat = beat; -} - -// strip the low bits off! -int bitCrush(int x, int a) -{ - return (x>>a)<<a; -} - -int updateAudio(){ - //return (int) (envelope.next() * osc.next())>>8; -// return (int) (envelope.next() * lpf.next(osc.next()))>>8; - int x = (int) (envelope.next() * osc.next())>>8; - - //int x = (envelope.next() * lpf.next(osc.next()))>>8; - //x = bitCrush(x, crushCtrl>>4); - //x = (x * crushCtrl)>>4; // simple gain - //x = bitCrush(x, 6); - x = lpf.next(x); - - // drums please! - int drums = kickSamp.next() + snareSamp.next() + hihatcSamp.next() + hihatoSamp.next(); - x += drums<<1; - return x; -} - - -void loop() { - audioHook(); // required here -} - diff --git a/Mozzi_drumsDG0_0_2BETA/hihatc909.h b/Mozzi_drumsDG0_0_2BETA/hihatc909.h deleted file mode 100644 index d52992d..0000000 --- a/Mozzi_drumsDG0_0_2BETA/hihatc909.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef hihatc909_H_ -#define hihatc909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define hihatc909_NUM_CELLS 1024 -#define hihatc909_SAMPLERATE 16384 - -const char __attribute__((progmem)) hihatc909_DATA [] = {1, -2, 1, -2, 2, 0, -4, -13, -18, 2, 3, 3, -1, 4, -9, 7, -5, -2, 4, -22, 23, -7, -8, -2, 7, -5, -8, 12, --4, 7, 7, -21, 12, -3, -18, 8, 1, 4, -20, 4, -5, -4, -2, 0, -2, -7, 3, -3, -3, --4, 3, -9, 12, -5, 20, 2, -25, 19, 0, 8, -12, -6, 4, 0, 15, -7, 8, 19, -9, -6, -0, -1, 0, -3, 12, -12, 7, 9, -18, 2, 4, 1, -7, -4, 7, 2, -3, 0, -3, 1, -2, -4, --4, -11, 7, -8, -2, 11, 2, 8, -1, 4, -3, -1, -2, -9, -6, -3, 3, -9, -9, 4, 1, --5, 1, 5, 0, 2, 2, -3, 9, 6, -7, 3, 5, 0, -2, 0, 7, -3, -2, -2, -3, 4, -2, 2, --3, 2, 0, -14, 4, 3, -4, 0, -5, 3, -2, -9, 3, 0, -1, -1, -5, -1, 5, -4, -6, 7, -1, -2, 2, 0, 4, -1, -7, 1, 3, 3, -1, -1, 6, 1, -2, 0, 3, -5, -9, 1, -1, -2, 0, --2, -1, 2, -1, -7, -2, -1, 1, -1, -4, 7, -5, -4, 5, 1, 1, 1, -2, 3, 2, -4, 0, 1, -3, -3, 1, -2, 0, 2, -1, 2, -2, -2, 0, -4, -3, 3, -3, 0, -1, -3, 2, -3, -6, 6, --2, 0, 1, 2, 0, -2, 2, 1, 1, -5, 1, -3, -2, -4, 3, -2, -2, 0, -2, 2, -4, 1, 4, --4, -1, 1, -1, -1, -2, 2, 1, 1, -4, 5, -4, 0, 1, -4, 3, -2, -1, 3, 0, -3, 0, -1, --1, -1, 0, -4, 3, -1, -3, 2, -1, -1, 0, 0, 1, 1, -1, 1, -2, -1, -1, -4, -1, 4, --1, -2, 1, 0, 1, 0, 0, -1, 1, 0, 0, -1, 1, -3, 0, -1, -3, 2, -2, 1, 0, -2, -3, -1, -1, -3, 1, -1, -2, 1, 1, -2, -1, 0, 0, -2, 0, -1, -2, 2, -1, 0, -2, 1, -2, 0, -0, -4, 1, -1, -2, 1, 0, -2, 0, -2, 3, 0, -2, 1, 0, -1, -1, 1, -1, 0, 0, -1, 0, -0, 0, -2, -1, 0, -1, 0, 0, -2, 0, 0, -2, -2, 0, -1, -1, 1, 0, -2, 0, 1, -1, 1, --1, 0, -1, 0, -1, -1, -1, -2, 1, 0, 0, 0, 0, 0, 0, -2, 0, 0, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, 1, -3, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -2, 0, 0, 0, --2, -1, 1, -1, 0, 0, -1, 0, 0, 0, -1, -2, 0, -2, -1, 0, 0, -1, 0, 0, -2, 0, -1, --1, -1, 0, -1, 0, 0, 0, -1, -1, 0, -1, 0, 0, 0, -2, 0, -1, -1, 0, -1, -1, 0, -1, --1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, -1, 1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -0, -1, -1, 0, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, -0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, --1, 0, 0, -1, 0, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, --1, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, 0, 0, -1, -1, 0, -1, 0, 0, -1, -1, 0, --1, 0, 0, -1, 0, 0, 0, -1, -1, -1, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, 0, --1, 0, -1, 0, 0, -1, -1, 0, 0, -1, -1, -1, 0, 0, 0, -1, -1, -1, -1, 0, -1, 0, 0, --1, -1, 0, 0, 0, -1, 0, -1, -1, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, 0, 0, 0, -1, -1, 0, -1, -1, 0, -1, 0, 0, 0, 0, -1, 0, 0, -1, -0, -1, -1, 0, -1, -1, 0, -1, -1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, --1, 0, -1, -1, -1, 0, 0, 0, -1, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, -1, 0, -1, --1, 0, -1, 0, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, 0, 0, -1, 0, -1, 0, -0, -1, 0, -1, -1, 0, -1, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, --1, 0, 0, -1, -1, 0, -1, -1, 0, -1, 0, 0, -1, -1, -1, 0, -1, -1, 0, 0, 0, 0, 0, --1, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, 0, -1, -1, 0, -1, 0, -1, -1, 0, --1, 0, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, 0, -1, -1, 0, -1, -1, -0, -1, 0, -1, 0, -1, -1, -1, 0, 0, -1, -1, -1, 0, -1, 0, -1, -1, -1, 0, 0, -1, -0, 0, 0, -1, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, 0, -0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, --1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, -0, 0, -1, 0, -1, 0, -1, 0, 0, 0, -1, -1, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, -1, -0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, }; - - #endif /* hihatc909_H_ */ diff --git a/Mozzi_drumsDG0_0_2BETA/hihato909.h b/Mozzi_drumsDG0_0_2BETA/hihato909.h deleted file mode 100644 index a36f866..0000000 --- a/Mozzi_drumsDG0_0_2BETA/hihato909.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef hihato_H_ -#define hihato_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define hihato_NUM_CELLS 2048 -#define hihato_SAMPLERATE 16384 - -const char __attribute__((progmem)) hihato_DATA [] = {0, -1, 0, -1, 0, -1, 0, --1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -2, 4, -4, -1, 3, 1, -8, 7, -2, -9, 3, -1, -1, -3, 0, -2, 4, -3, -4, -1, -3, 3, -2, -5, -1, 2, -1, -3, -1, 4, -2, 4, -3, -2, -4, -1, 6, 0, 8, -5, -5, 2, -2, 2, -2, -2, 7, -4, 6, -11, -6, 11, -6, 1, 4, 0, --14, 11, -6, -1, -2, -8, 5, -13, 1, 0, -8, 2, 7, 3, 1, -8, 5, 2, 2, -2, -8, 11, --1, 0, 2, -1, -3, 2, -3, -9, 2, -4, 6, -3, 1, 9, -7, -3, 2, -2, -2, -13, 2, 9, --3, 4, -3, 4, -6, 3, -1, -7, 13, -5, 3, 1, 1, -5, -13, 1, -2, 8, 0, 2, -4, 6, --1, 2, 3, -12, 4, -16, 0, -7, 2, 0, -3, 10, -6, 6, -3, -9, -2, 11, -7, -7, 11, -9, -3, 1, -1, -5, -6, -4, 2, -11, 8, 2, -4, 14, 0, -9, 7, -4, 6, -2, -10, -3, 1, -4, -12, 10, -1, 1, 0, 2, -3, 0, 5, 0, 5, -6, 0, -1, 0, -8, -3, -1, -1, 1, -3, 3, --3, 4, 8, -12, 0, -2, -7, 9, 2, 3, -6, -1, -4, 2, -7, -5, 12, -4, 7, 0, -2, 3, --1, -2, -3, 1, -3, -1, 2, -1, 2, -8, 1, 7, -8, -3, 1, 5, 4, -3, -3, 1, -3, -13, -2, 0, 1, 2, -13, 4, 4, 4, 0, 6, 2, -6, -9, -5, 12, -3, 1, -10, 10, -1, -7, 3, --2, 9, -18, 0, -5, 11, -4, 0, 6, -13, 3, -13, 14, 3, -5, 0, -3, 3, 1, -2, 1, 7, -5, -8, 6, 0, -8, 2, -3, 4, -6, 1, -14, 7, 8, -10, 7, -11, 10, -8, -13, 13, -3, -1, -2, 4, -4, -2, 0, 0, 8, -8, 2, 3, 5, -2, -1, -1, 4, 1, -13, 2, 2, -3, -5, 2, --1, 2, -2, 0, 0, 4, -6, -5, 6, -1, 2, -5, 1, 10, -8, -7, 8, -6, 6, 3, -15, 2, 0, --8, 6, 5, -4, 2, 0, -6, 5, -2, -4, 2, -3, -1, 5, -2, -2, 0, 1, 4, -8, 2, 4, 0, -0, -2, -1, -3, -1, -5, -3, 6, -18, 5, 10, -6, 10, -3, -4, 3, 1, -11, 4, -3, 5, --2, -7, 7, -5, 3, -4, 4, -3, 3, -3, -2, 6, -2, 4, -5, 5, -3, -9, -3, -4, 1, -2, -5, 2, -2, 7, -4, -5, 3, 0, 2, 2, -5, -2, 6, 5, -11, 3, -6, 2, 0, -3, 5, -4, 5, --6, 7, -11, 4, -3, -5, 1, -8, 4, -11, 17, 1, -3, -6, -2, 7, -2, -1, -5, 13, -5, --8, 1, 5, 3, -10, 5, -5, -4, 7, -7, 8, 5, 1, -2, -8, 7, -8, -2, 2, 1, 4, -5, -5, --2, 10, -10, -2, 1, -8, 0, -2, 5, 8, -4, -2, -4, 0, 4, -4, 1, -2, 5, 0, 8, -2, -1, -2, -4, 3, -6, 3, 0, -2, 2, 2, -5, -1, -7, -3, 1, 2, -6, 3, 0, -5, 6, -6, -1, -4, -2, -9, 4, 1, 3, 3, -2, 2, -1, -5, -2, 8, -1, -4, -6, 7, 2, 0, -3, 1, 2, -2, -1, -7, 5, -9, -2, 3, -4, 3, -1, -8, -3, 1, 0, -7, 5, 3, -3, -7, 2, 6, -2, 3, -7, -8, -7, 2, 1, 3, 7, -6, -1, -1, -2, -3, 5, -6, 3, 1, 0, -2, -1, -6, -5, 1, 3, 2, --4, 2, -2, -1, 0, -1, -3, -2, -5, -3, 3, 4, -1, 8, 0, -2, 0, -5, 1, 2, -3, -2, -8, -4, 0, -5, -2, -1, -3, 0, 5, 3, -8, 0, 0, 7, -7, -2, -1, -3, -3, -1, 1, 7, 5, --7, 1, 1, 4, -4, -3, 2, 5, -2, -6, 1, 1, -3, -7, -1, 3, -8, 3, -1, 2, 6, -11, 4, -1, -2, 0, -2, -3, 6, 6, -6, -1, 1, 2, 1, -1, -2, -1, -1, -5, 3, 0, -1, -1, -7, -0, -5, -1, 4, 0, 6, 0, -3, 1, 6, -5, 0, -3, -7, 6, -2, -2, 1, 5, -4, 4, -7, -4, -6, -3, 1, 0, -1, -4, -5, 2, -2, -5, 3, 1, 4, -1, 0, 1, 4, -1, -5, -1, -6, 2, -4, --1, 2, -1, 1, -4, -2, 0, 1, 2, -1, 0, 2, -2, 0, 4, 0, -4, 1, -5, 1, -2, 1, 4, 0, -2, 1, -3, -9, 0, -1, 2, -6, -2, 4, 1, -1, -4, 1, -1, 0, -3, 1, 1, 1, 0, 0, 6, --1, -8, -2, 1, 0, -2, -2, 5, 1, -3, -2, 5, 0, -3, -5, -8, 2, 1, 1, 0, 2, 2, -4, --1, -2, 2, -5, 0, 6, -4, 5, 0, -4, 1, -4, -8, 6, -3, -4, 4, -3, 3, 0, -1, -2, 1, --2, -2, 1, -2, -1, 0, 3, 1, 2, -1, -2, 0, -5, -1, 0, 7, 2, -4, 0, -2, -1, -2, --1, 0, 1, -4, -3, 5, 2, -2, 2, -4, 2, -6, -6, 6, -1, 4, -2, 0, 1, -1, -1, -1, 2, --3, 2, -5, -1, 4, -2, -1, -2, 2, -4, -5, 1, 2, 3, -1, 4, 1, -3, -2, -2, -2, 0, -2, -5, -2, 2, -1, 4, -4, -5, 3, -7, 2, 3, -3, 1, 2, 1, 1, -2, -3, 2, -4, 1, 0, --1, 4, 1, -4, 2, -3, -3, 2, -7, 0, 4, -1, -2, 1, 1, -7, 4, -1, -1, -1, -6, 3, 4, -0, -1, 1, -4, 3, -5, -3, 4, -2, 1, 0, 0, 1, 0, -2, -2, -2, -3, -2, -1, 0, 3, -1, -0, 0, -1, -1, -4, 1, 1, 1, 2, -2, 2, 0, -2, 0, -3, -2, -2, 0, 2, 1, -1, 0, -1, --2, 0, -3, 1, 1, -2, -3, 1, 0, 0, 1, -1, 1, -4, -1, 1, 3, 0, -1, 0, -1, -1, -4, -1, -1, 1, -1, -1, 3, -3, 0, -1, 2, -3, -2, 1, -3, 2, 2, -2, 0, 1, -6, 1, -1, 0, -3, -2, 0, 2, -2, -4, 1, -2, -2, -2, 2, -2, 2, 0, 0, 3, -2, 1, -2, 0, -3, 0, 1, --1, 0, -1, 2, -4, -2, 1, -4, 2, 0, -2, 1, 3, -2, 0, -1, -2, -3, -2, 1, -1, 0, 1, -4, -2, 2, -2, -4, 1, -3, -2, 1, 0, -2, 0, 0, -1, 0, -2, -2, 1, 0, 1, 0, 2, 1, --4, -2, 0, 0, -4, 1, -2, 1, 1, -4, 5, -1, -1, -2, -3, -1, 0, -3, -1, 4, -2, 0, -1, -1, 0, -2, -1, 2, -2, 1, 2, -1, 2, -1, -2, -1, -2, -5, -1, 1, 0, 0, 1, -2, 0, --1, -2, -1, 1, 0, -4, 1, 0, 1, -1, 2, -2, -4, -1, -1, 4, 0, -2, 0, -1, 0, 0, -5, -1, 1, -3, 0, 0, -2, 3, -1, -2, 3, -5, 0, 2, 0, 0, -2, -2, 1, 2, -6, 0, 1, -1, 1, --3, -1, 3, -2, -3, 2, 0, -3, 0, -2, 2, 1, -4, 2, 1, -2, -2, 1, -1, 4, -4, -4, 2, -2, -1, -1, -1, -4, 2, -3, 2, 2, -2, 0, -1, 0, 2, -3, -2, 2, 0, -4, -1, 1, -2, 2, --2, -1, 0, -2, -1, 1, -1, -1, 3, 0, -1, -1, 0, -1, -2, 1, -1, 1, -1, 2, 1, -1, --2, -1, 0, -5, 1, 0, -1, 2, 0, -2, -3, -1, 1, -2, -1, 1, 0, 1, 1, -2, 2, 0, -3, --1, 0, -2, -1, 2, -1, -1, 2, -3, -1, 2, -3, -2, -1, -1, -1, 1, -2, 1, 1, -1, 0, --2, 0, -2, 1, -1, 1, 1, 0, 0, -2, 0, -2, -1, -4, 0, 1, 0, 1, -1, 0, -1, -4, -2, --1, -1, -1, 0, 1, 2, -1, -3, 1, 0, 0, -1, -1, 0, 1, -3, 0, 2, 0, -2, -4, -1, 1, --1, -2, 2, 2, -1, -1, 0, -2, 1, -3, -3, 2, 0, -1, -1, 2, 1, -1, -2, -1, 0, -1, --2, 0, 1, -1, -2, 0, 2, -3, -1, 0, -2, 1, -1, 0, 3, -1, 0, -1, 0, -1, -1, -2, --1, 1, -1, 1, -3, -1, -1, -1, -1, -1, -1, -3, 2, -2, -1, 1, -1, 1, -2, -2, 1, 1, -0, -1, 1, -1, 0, -2, 1, 2, -3, 0, 0, -1, 0, -1, -2, 1, 0, -4, -1, 1, 0, 2, -3, --1, 1, -1, -2, 1, -1, 2, -1, -2, 1, -2, 0, -2, 0, 1, -2, -1, 0, 2, 0, -2, -1, 0, --1, -2, -1, 1, 3, -3, -2, 0, 0, -1, 0, 0, -1, -1, -3, -1, 1, 0, -2, 0, -1, 0, --2, 0, 0, 1, -1, 0, 1, -1, 3, -2, 0, 0, -3, 0, 2, -2, -1, 2, -1, -1, -1, -2, 0, --2, -2, 0, -1, -3, 0, 0, 0, 0, -3, 0, -1, 0, 0, 0, 1, 1, -1, -3, 0, 0, 0, -1, --3, 0, 1, -2, -1, 2, -2, -1, 0, -4, 1, 0, -2, 1, -1, 1, -1, 0, 0, 0, -1, -1, 0, --1, 1, -1, -1, 1, -1, -1, -2, -1, -1, -2, 0, 1, 0, -1, 1, -1, 0, 1, -1, -2, 1, -0, -2, 3, 0, 0, 0, -2, 0, -1, -1, -1, 0, -1, -1, -2, -1, 0, -2, -1, 0, -1, 0, 0, -0, 1, -1, 0, 0, -3, 0, 0, -1, 0, -1, 1, -1, 0, -1, -1, 0, -2, -1, 0, -1, -2, -1, -2, -1, -1, -1, -1, 1, -2, 1, -1, 0, 1, 0, -2, 0, 0, -3, 2, -2, -1, 0, -1, 0, 1, -1, -3, 1, -1, -2, 1, -3, 0, 1, -1, 0, 0, -2, 1, 0, -2, 0, -1, -1, 0, -2, -1, -1, --1, 0, -1, -1, 0, 0, -2, 1, -1, -1, 0, -1, 1, -1, 0, -1, 1, -1, -3, 1, -1, 0, --1, 0, 0, 0, 0, -2, -1, -1, 1, -3, -1, 2, -1, 0, -1, 0, 0, -2, -1, 1, -1, 0, -1, --2, 1, -1, -2, 0, 0, -1, -2, -2, 1, 1, -1, -2, 1, 0, -2, 0, 0, 0, 0, -2, 0, 1, --1, 0, -1, 0, -2, -1, -1, 1, 0, -1, 0, -1, 0, -1, -2, 1, -1, -2, 1, 0, 1, 0, -1, -0, 0, -2, -1, 1, -1, 0, -1, 0, 0, -1, -1, -1, 1, -3, -1, 0, 0, 0, -1, 1, 1, 0, --3, 0, 0, -1, 0, -1, 1, -1, 0, -1, 1, 1, -3, -2, 0, 0, 0, -1, 0, 1, -2, -2, -1, -0, -1, -1, -1, 1, 0, -1, 1, -1, 0, -1, -1, -2, 1, -2, 0, 1, -1, 1, -1, 0, -1, 0, --1, 0, 0, -1, 1, -1, 1, 0, -1, -2, 0, 0, -3, 0, -1, 1, -1, -2, 0, -1, 0, -1, -1, -0, -1, 0, 0, 1, -1, 1, -1, -2, 1, -2, 0, 0, -1, 0, 0, -1, -1, 1, -2, -2, 0, -1, -0, -1, 0, -1, 0, -1, -1, -1, -1, 0, -1, 1, 0, 0, 0, -1, -1, 0, 1, -1, 0, 0, -1, -0, -1, 0, 0, -1, -2, 0, -1, -1, 0, -1, 1, 0, -1, 0, -1, -2, 0, 0, -1, 0, -1, -1, -0, -1, -1, -2, 0, 1, -1, -1, 0, 0, 0, -1, 0, 0, 0, -1, -1, 0, -1, 0, -1, -1, -1, --1, 0, 1, -1, -2, 1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -1, 1, 0, 0, 0, -1, -1, 0, --2, 0, -1, 0, 1, -2, -1, -1, 0, 0, -3, 1, 0, -1, 0, 0, 0, -2, 0, -2, 1, -1, -2, -1, 0, 0, -2, 0, 1, -2, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 0, -1, 0, -1, 0, 0, -1, -1, 0, 0, -1, 0, -2, 0, -1, 0, -1, 1, 0, -2, -2, 0, 0, -3, -1, 0, -1, 0, 0, --1, 0, }; - - #endif /* hihato_H_ */ diff --git a/Mozzi_drumsDG0_0_2BETA/kick909.h b/Mozzi_drumsDG0_0_2BETA/kick909.h deleted file mode 100644 index 3ddf8cd..0000000 --- a/Mozzi_drumsDG0_0_2BETA/kick909.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef kick909_H_ -#define kick909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define kick909_NUM_CELLS 2048 -#define kick909_SAMPLERATE 16384 - -const char __attribute__((progmem)) kick909_DATA [] = {-1, 0, -1, 0, -1, 0, 0, -0, 0, 0, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, -1, -2, -2, -3, -3, -2, -2, -2, -1, -1, --1, -1, 0, 0, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 8, 9, 9, 10, 14, 17, -20, 24, 29, 50, 57, 49, 53, 54, 53, 53, 54, 53, 53, 53, 52, 51, 50, 48, 46, 45, -44, 42, 40, 38, 35, 33, 30, 26, 23, 19, 15, 12, 8, 5, 1, -2, -6, -9, -11, -13, --16, -17, -18, -20, -22, -23, -24, -24, -25, -26, -27, -27, -27, -27, -28, -28, --28, -28, -27, -27, -27, -26, -25, -24, -24, -23, -21, -20, -19, -17, -15, -13, --12, -10, -8, -5, -3, -1, 1, 3, 6, 8, 10, 12, 14, 17, 19, 21, 24, 25, 28, 30, -32, 33, 35, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, -40, 40, 39, 38, 38, 37, 37, 36, 36, 35, 34, 33, 32, 32, 30, 29, 28, 26, 24, 22, -20, 18, 17, 15, 13, 11, 9, 8, 6, 5, 3, 1, -1, -2, -4, -5, -7, -8, -9, -11, -13, --14, -16, -17, -18, -19, -20, -21, -22, -24, -25, -25, -26, -27, -27, -28, -29, --29, -30, -30, -30, -30, -31, -31, -31, -31, -31, -32, -31, -32, -32, -32, -32, --32, -32, -32, -32, -32, -32, -32, -32, -31, -31, -31, -30, -30, -30, -29, -28, --28, -27, -27, -26, -26, -25, -25, -24, -23, -22, -21, -20, -20, -19, -18, -17, --16, -15, -14, -13, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, 0, 1, 2, 3, 4, 6, -6, 8, 9, 10, 11, 12, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 27, -28, 29, 30, 30, 31, 32, 33, 33, 34, 34, 34, 34, 35, 35, 35, 36, 36, 36, 36, 36, -36, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 36, -36, 35, 35, 35, 34, 34, 34, 33, 33, 32, 32, 32, 32, 31, 31, 30, 30, 29, 29, 28, -28, 27, 27, 26, 25, 25, 24, 23, 23, 21, 21, 20, 19, 18, 17, 16, 15, 14, 12, 11, -10, 9, 8, 7, 7, 6, 5, 4, 3, 2, 1, 0, -2, -3, -4, -4, -5, -6, -7, -8, -8, -9, --10, -11, -12, -12, -13, -14, -15, -16, -16, -17, -18, -19, -20, -20, -21, -22, --23, -23, -24, -25, -25, -26, -26, -27, -27, -28, -29, -29, -29, -30, -30, -31, --31, -32, -32, -32, -32, -33, -33, -33, -33, -33, -33, -34, -34, -34, -34, -34, --34, -34, -34, -34, -34, -34, -34, -34, -35, -35, -35, -35, -35, -35, -35, -35, --35, -35, -35, -35, -34, -34, -34, -34, -33, -33, -33, -33, -33, -32, -32, -32, --32, -31, -31, -31, -31, -31, -30, -30, -30, -29, -29, -29, -28, -28, -28, -27, --27, -26, -26, -25, -25, -24, -24, -23, -23, -22, -21, -21, -20, -19, -19, -18, --17, -17, -16, -15, -14, -14, -13, -12, -12, -11, -10, -9, -9, -8, -7, -6, -5, --5, -4, -3, -2, -1, -1, 0, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 12, 13, -14, 15, 16, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, -29, 29, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 32, 33, 33, 34, 34, 34, 34, -34, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, -35, 35, 35, 35, 35, 35, 35, 35, 35, 34, 34, 34, 34, 33, 33, 32, 33, 33, 32, 32, -32, 31, 31, 31, 31, 30, 30, 30, 29, 29, 29, 28, 28, 28, 27, 27, 26, 26, 26, 25, -25, 24, 24, 23, 22, 22, 21, 20, 20, 19, 18, 17, 17, 16, 15, 14, 13, 12, 11, 11, -10, 9, 8, 7, 6, 5, 4, 4, 3, 2, 1, 0, -1, -1, -2, -3, -4, -5, -5, -6, -7, -8, -9, --9, -10, -11, -12, -12, -13, -14, -14, -15, -16, -17, -17, -18, -19, -19, -20, --21, -21, -22, -23, -23, -24, -24, -25, -26, -26, -27, -27, -28, -28, -29, -30, --30, -30, -31, -31, -32, -32, -32, -33, -33, -33, -34, -34, -34, -34, -34, -35, --35, -35, -35, -35, -35, -35, -35, -36, -36, -36, -36, -36, -36, -36, -36, -36, --36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, --35, -35, -35, -35, -35, -34, -34, -34, -34, -34, -33, -33, -33, -33, -32, -32, --32, -32, -31, -31, -31, -31, -30, -30, -30, -29, -29, -29, -28, -28, -27, -27, --26, -26, -26, -25, -24, -24, -23, -23, -22, -21, -21, -20, -19, -19, -18, -17, --17, -16, -15, -15, -14, -13, -12, -12, -11, -10, -9, -9, -8, -7, -6, -6, -5, --4, -3, -3, -2, -1, 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 11, 11, 12, 13, -14, 15, 15, 16, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 25, 26, 26, 27, 28, -28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 33, 32, -33, 33, 34, 33, 33, 32, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, -34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 33, 33, 32, 33, 33, 32, 32, 32, 32, 31, -31, 31, 31, 30, 30, 30, 29, 29, 29, 29, 28, 28, 28, 27, 27, 26, 26, 26, 25, 25, -24, 24, 23, 23, 22, 22, 21, 20, 20, 19, 18, 18, 17, 16, 15, 14, 13, 12, 12, 11, -10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 0, -1, -2, -3, -3, -4, -5, -6, -7, -7, -8, -9, --10, -10, -11, -12, -12, -13, -14, -14, -15, -15, -16, -17, -17, -18, -18, -19, --19, -20, -20, -21, -21, -22, -22, -23, -23, -24, -24, -25, -25, -25, -26, -26, --27, -27, -27, -27, -28, -28, -28, -28, -29, -29, -29, -29, -29, -29, -29, -29, --29, -29, -29, -30, -30, -30, -30, -30, -29, -29, -29, -29, -29, -29, -29, -29, --29, -29, -29, -29, -29, -29, -29, -29, -29, -28, -28, -28, -28, -28, -28, -28, --28, -27, -27, -27, -27, -27, -26, -26, -26, -26, -26, -25, -25, -25, -25, -25, --24, -24, -24, -24, -23, -23, -23, -23, -23, -22, -22, -22, -21, -21, -21, -21, --20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -15, -15, --15, -14, -14, -13, -13, -13, -12, -12, -12, -11, -11, -10, -10, -10, -9, -9, --8, -8, -8, -7, -7, -7, -6, -6, -5, -5, -5, -4, -4, -4, -3, -3, -3, -2, -2, -1, --1, -1, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, -7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, -6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, -2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, -3, --4, -4, -4, -4, -4, -5, -5, -5, -5, -6, -6, -6, -6, -6, -6, -7, -7, -7, -7, -7, --8, -8, -8, -8, -8, -8, -8, -9, -9, -9, -9, -9, -9, -9, -9, -10, -10, -10, -10, --10, -10, -10, -10, -10, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -12, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -10, -10, --10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -9, -9, --9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -8, -8, -8, -8, -8, -8, -8, --8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -6, --6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, --3, -2, -3, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, }; - - #endif /* kick909_H_ */ diff --git a/Mozzi_drumsDG0_0_2BETA/snare909.h b/Mozzi_drumsDG0_0_2BETA/snare909.h deleted file mode 100644 index d42b2e3..0000000 --- a/Mozzi_drumsDG0_0_2BETA/snare909.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef snare909_H_ -#define snare909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define snare909_NUM_CELLS 2048 -#define snare909_SAMPLERATE 16384 - -const char __attribute__((progmem)) snare909_DATA [] = {0, -1, 0, -1, 0, -1, 0, --1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, --1, 0, 0, -2, -2, 0, -2, -1, -3, -2, 4, -3, -7, -2, 1, -7, 6, -3, -2, -6, -8, 8, --6, 0, -3, -1, -7, 0, -4, -11, -2, 3, -7, -9, 19, -1, 33, 43, 22, 60, 57, 49, -58, 55, 68, 65, 62, 60, 60, 69, 64, 61, 57, 58, 43, 50, 39, 37, 27, 17, 21, 15, -11, -2, -6, -12, -6, -23, -7, -22, -30, -22, -25, -27, -26, -31, -31, -21, -18, --8, -18, -4, 3, 1, 8, 12, 12, 19, 14, 42, 28, 21, 43, 45, 49, 46, 46, 43, 55, -44, 47, 44, 30, 46, 34, 38, 42, 24, 34, 27, 45, 23, 28, 38, 35, 36, 23, 30, 28, -40, 23, 32, 35, 29, 31, 31, 30, 28, 30, 30, 12, 13, 18, 8, 7, -2, 5, 6, -1, -7, --5, -9, -10, -11, -13, -17, -22, -25, -24, -24, -33, -28, -24, -30, -20, -28, --41, -28, -29, -26, -27, -37, -26, -29, -32, -20, -31, -26, -15, -20, -9, -14, --15, -12, -6, -7, -3, 8, 6, 15, 16, 12, 21, 30, 25, 35, 35, 29, 46, 44, 38, 49, -34, 48, 44, 44, 55, 38, 50, 41, 52, 43, 43, 53, 44, 56, 46, 39, 41, 44, 42, 42, -44, 41, 43, 35, 38, 39, 26, 30, 36, 31, 27, 26, 21, 20, 15, 9, 8, -2, 0, 10, --10, -13, -3, -17, -14, -14, -18, -7, -30, -24, -32, -26, -28, -37, -23, -35, --25, -40, -31, -34, -46, -30, -42, -38, -26, -37, -33, -32, -27, -32, -23, -23, --20, -13, -11, -10, -18, 0, -13, -3, -8, 3, -6, 4, 19, -1, 12, 14, 19, 10, 13, -9, 20, 19, 21, 23, 21, 34, 21, 24, 34, 20, 31, 28, 31, 36, 24, 33, 23, 31, 27, -30, 35, 37, 26, 17, 21, 19, 27, 21, 24, 17, 23, 19, 24, 19, 4, 23, 7, 15, 17, -14, 24, 8, 15, 10, 5, 6, 11, 12, -5, 9, 9, 10, 9, 1, 5, 0, -2, -2, 1, 1, -7, 0, -3, -2, -2, -8, -8, -19, -4, -18, -6, -4, -11, -5, -15, -1, -28, -12, -19, -10, --15, -23, -19, -23, -9, -25, -22, -21, -22, -18, -23, -18, -16, -31, -28, -23, --20, -27, -15, -26, -23, -22, -23, -16, -22, -29, -20, -11, -29, -12, -17, -14, --15, -12, -16, -22, -21, -8, -11, -16, -8, -13, -12, -8, -15, -14, -9, -14, -2, --13, 3, -9, -12, 9, 3, 0, 7, -3, 0, 9, 2, 9, 7, 5, 4, 18, 12, 3, 14, 17, 16, 19, -14, 6, 21, 24, 23, 18, 24, 18, 11, 25, 25, 20, 24, 22, 5, 27, 20, 13, 25, 28, -17, 19, 11, 14, 24, 10, 23, 10, 23, 19, 16, 9, 14, 9, 14, 17, 6, 13, 8, 11, -1, -17, 9, 0, 6, 4, -1, 3, -12, -10, -4, -12, -9, -14, -5, -24, -11, -14, -21, -16, --13, -18, -30, -17, -29, -25, -21, -21, -29, -30, -15, -34, -30, -21, -29, -25, --26, -28, -36, -27, -30, -28, -25, -21, -11, -31, -18, -21, -12, -12, -12, -13, --17, -15, -17, 0, -21, -9, 3, -3, -1, -7, 2, -3, 3, 3, -9, 13, 8, 5, -3, 9, 13, -3, 18, 6, 13, 13, 15, 12, 7, 10, 14, 12, 11, 3, 12, 15, 17, 6, 7, 26, -1, 16, -19, 8, 16, 12, 15, 1, 10, 20, 7, 7, 8, 17, 1, 3, 12, 8, 7, 10, 9, -4, 1, -3, 5, -1, 0, 1, 4, 3, -6, 1, -2, -2, -10, -7, -1, -3, -4, -19, 0, -10, -13, -4, -15, --8, -4, -13, -24, -10, -8, -13, -10, -11, -24, -14, -18, -6, -9, -24, -20, -10, --12, -18, -11, -14, -13, -18, -17, -28, -8, -27, -20, -14, -15, -11, -18, -9, --16, -15, -17, -16, -6, -13, -17, 3, -25, -1, -11, -4, -6, -8, -5, -14, 0, -11, -5, -3, 0, 0, -1, -12, 0, -2, -5, 6, 5, 4, 4, -11, 2, 3, -4, 12, 1, 5, -2, 3, -3, -0, 2, 6, 7, -7, 2, 1, 6, 5, -2, 0, 2, 1, 9, 1, 9, -5, -6, 7, -2, 5, -3, 16, -1, -1, 2, 4, 10, -3, 17, -2, 6, 7, 2, 9, -2, 1, -6, 10, -5, -1, 3, -8, 11, -6, 7, --1, -7, 2, -3, -6, 1, -3, -11, -3, -3, -7, -12, -4, -7, -10, -9, -18, -6, -11, --20, -3, -12, -6, -10, -24, -9, -16, -18, -9, -18, -20, -11, -9, -15, -24, -10, --20, -27, -13, -14, -13, -19, -18, -23, -21, -17, -14, -22, -15, -21, -19, -14, --19, -11, -15, -15, -17, -17, -18, -12, -12, -12, -8, -10, -17, -9, -14, -3, -5, --10, -9, -10, -8, -10, 7, -5, -3, 0, -2, 3, -3, 6, -6, -7, -1, 3, 5, 1, 4, -12, -8, 5, -1, 11, 6, -4, 3, 6, -1, 10, 1, 7, 2, 7, 6, -6, 2, 3, 3, 1, 6, 0, -3, 5, -5, 7, 1, -3, -2, -2, 6, 2, -3, 0, 3, 4, -4, 2, -5, -1, -2, -4, 0, -8, -8, -5, 2, --9, -6, -1, -2, -9, -6, -12, 1, -10, -14, -9, -13, -10, -10, -9, -10, -7, -17, --3, -13, -7, -12, -15, -16, -10, -9, -16, -7, -11, -11, -13, -14, -9, -11, -16, --17, -12, -10, -16, -10, -11, -14, -4, -14, -17, -7, -12, -6, -16, -2, -7, -9, --10, -9, -5, -18, 1, -8, 0, 1, -9, -16, -4, -3, -6, 4, -9, -2, -10, 0, 1, -10, -3, -1, -3, -2, -4, 0, 3, -3, 0, -1, 0, 2, -4, 2, -3, -8, 0, -5, 5, -7, -4, 3, --9, 6, -10, 5, 1, -4, 2, -8, 2, -6, 2, -1, 2, -2, -6, 1, -6, -5, -3, 7, -8, -5, -2, -7, -1, -8, 3, 0, 0, 1, -6, -3, -5, -3, -3, -9, -6, 1, -7, -5, -3, -3, -6, --11, -5, -1, -8, -15, -1, -8, -8, 0, -13, -9, 0, -14, -10, -9, -9, -11, -3, -11, --14, -7, -5, -4, -12, -18, -16, -2, -19, -7, -13, -5, -12, -10, -6, -23, -4, --10, -11, -8, -10, -14, -12, -5, -14, -13, -3, -8, -16, -10, -8, -15, -6, -13, --10, -11, -8, -6, -12, -9, -8, -10, -10, -8, -4, -13, -5, -6, -11, 2, -14, -2, --6, -7, -1, -11, 1, -4, -9, 3, -3, 2, -8, -1, -2, -7, -1, 0, 4, -3, 3, -7, 2, --3, -1, 1, -3, -2, -1, 7, -4, 1, -2, -2, -4, -3, 8, -9, 1, -1, -3, 4, -6, 3, 3, -0, -1, -5, -7, -2, 1, -4, 3, 0, -9, 0, -4, 4, -5, -4, 1, -3, -4, -5, -3, -7, -8, --7, 2, -9, -8, -2, -7, -3, -10, -6, -4, -12, -6, -10, -7, -10, -10, -5, -11, -3, --7, -13, -10, -8, -6, -15, -7, -7, -11, -9, -11, -8, -10, -11, -8, -6, -12, -8, --10, -8, -6, -10, -7, -8, -7, -8, -11, -3, -4, -5, -6, -12, -8, -6, -6, -3, -6, --6, -6, -2, 1, -12, -5, -4, -6, -1, -1, -7, -5, -4, -3, 1, -6, 2, -6, 0, -5, -9, -4, -7, -2, 2, -3, 1, -3, -4, -4, -1, -2, -4, 3, -5, -2, -3, -4, -1, -4, 1, -1, --10, 1, 0, -9, 2, -3, -6, -2, 6, -5, -6, -2, -3, -3, -4, -4, -6, -1, -5, -6, -1, --2, -9, -1, -2, -5, -3, 0, -5, -7, -5, -8, -1, -7, -6, -4, -2, -6, -7, -7, -8, --5, 0, -4, -12, -4, -10, -3, -4, -11, -3, -6, -6, -6, -9, -7, -9, -7, -5, -7, --2, -10, -10, -3, -10, -5, -7, -10, -6, -12, -6, -9, -4, -7, -8, -5, -12, -6, --5, -4, -9, -4, -7, -5, -5, -8, -7, -7, -9, -7, -5, -11, -3, -6, -3, -5, -8, -4, --3, -6, -8, -6, -5, -4, -5, -6, -2, -6, -6, -2, -5, -3, -4, -5, -7, -3, -2, -2, --2, -9, 1, -3, -8, 0, -3, 0, -5, -3, -2, -1, 0, -3, -3, -4, 1, -2, -8, 3, -1, --5, 1, 0, -3, -4, -4, -1, 0, -3, 2, -6, -1, -3, -6, 2, -4, -3, -3, -1, -1, -5, --3, 0, 0, -6, -1, -4, -5, -3, 0, -1, -4, -8, -4, 0, -9, 0, -4, -5, -4, -1, -5, --6, -4, -6, -3, -6, -6, -9, -4, -4, -7, -4, -3, -10, -6, -6, -5, -5, -8, -5, -9, --5, -6, -5, -6, -9, -8, -4, -5, -10, -3, -7, -6, -6, -4, -6, -9, -4, -6, -2, -7, --2, -3, -7, -4, -7, -3, -5, -3, -4, -7, -4, -3, -3, -2, -1, -5, -4, -3, -4, -3, --3, -2, -3, -1, -3, -7, 0, -3, 2, -1, -5, -3, -1, -3, -5, 1, -8, 2, -5, 0, -1, --6, -1, -2, 2, -5, -1, -1, -2, -2, -1, -6, 0, -5, -2, 0, -5, -2, -4, 1, -5, -4, --2, 0, -5, -3, 0, -5, -1, -2, -3, -3, -4, -2, -3, -3, -5, -4, -2, -6, -3, -6, --4, -3, -6, -3, -2, -5, -5, -5, -4, -5, -3, -3, -8, -2, -6, -3, -4, -9, -1, -8, --4, -4, -7, -2, -6, -3, -5, -4, -3, -5, -3, -8, -4, -8, -5, -3, -8, -1, -7, -2, --4, -6, -5, -3, -4, -3, -4, -4, -1, -5, -2, -5, -2, -3, -4, -3, -5, -2, -4, -1, --4, -4, -1, -3, -1, -4, -4, -3, -2, -3, -1, -3, -5, -2, -1, -3, -2, 0, -4, -2, --3, -4, -2, -3, -2, -2, -1, -3, -4, -2, -3, -2, -3, 0, -5, -2, -1, -3, -1, -2, --1, -5, -2, -1, -2, -2, -2, -1, -2, -2, -3, -2, -4, -2, -1, -3, -2, -2, -2, -2, --1, -4, -4, -1, -3, -2, -1, -6, -1, -4, -4, -2, -5, -1, -4, -1, -4, -4, -2, -3, --4, -2, -4, -4, -3, -4, -1, -5, -5, -3, -3, -4, -4, -5, -3, -3, -6, -4, -4, -3, --4, -4, -3, -4, -3, -5, -5, -4, -6, -2, -6, -3, -4, -4, -3, -5, -2, -5, -5, -3, --3, -4, -4, -4, -2, -3, -4, -4, -4, -2, -3, -3, -3, -3, -3, -2, -2, -4, -1, -2, --3, -1, -3, -1, -2, -3, -3, -1, -4, -3, -1, -2, -2, -1, -2, -2, -2, -3, -1, -2, --1, -1, -3, -2, -1, -2, -2, -2, -1, -1, -1, -2, -2, -1, -2, -1, -2, -2, -1, -2, --2, -2, -1, -2, -2, -1, -2, -2, -1, -2, -2, -2, -2, -1, -2, -3, -2, -2, -2, -2, --2, -2, -2, -2, -3, -3, -2, -2, -3, -2, -3, -3, -3, -3, -2, -3, -2, -3, -3, -3, --3, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -3, -3, -3, --3, -3, -3, -3, -3, -3, -2, -3, -3, -2, -3, -2, -2, -2, -2, -2, -3, -2, -2, -3, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --1, -2, -2, -2, -2, -1, -2, -1, -1, -2, -2, -1, -2, -1, -2, -2, -2, -2, -1, -2, --2, -2, -2, -1, -1, -2, -1, -2, -1, -2, -2, -1, -1, -1, -2, -1, -2, -1, -2, -1, --1, -2, -1, -1, -1, -1, -1, -1, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, }; - - #endif /* snare909_H_ */ diff --git a/PolyDrums_v0_1_3_DelayLPF/ADSRslow.h b/PolyDrums_v0_1_3_DelayLPF/ADSRslow.h deleted file mode 100644 index 760d136..0000000 --- a/PolyDrums_v0_1_3_DelayLPF/ADSRslow.h +++ /dev/null @@ -1,307 +0,0 @@ -/* - * ADSR.h - * - * Copyright 2012 Tim Barrass. - * - * This file is part of Mozzi. - * - * Mozzi is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Mozzi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Mozzi. If not, see <http://www.gnu.org/licenses/>. - * - */ - -#ifndef ADSR_H_ -#define ADSR_H_ - -#include "Arduino.h" -//#include <util/atomic.h> -#include "Line.h" -#include "mozzi_fixmath.h" - -/** A simple ADSR envelope generator. -@todo Test whether using the template parameter makes any difference to speed, -and rationalise which units which do and don't need them. -Template objects are messy when you try to use pointers to them, -you have to include the whole template shebang in the pointer handling. -*/ -template <unsigned int CONTROL_UPDATE_RATE> -class ADSR -{ -private: - - const unsigned int AUDIO_TICKS_PER_CONTROL; - - unsigned int phase_control_step_counter; - unsigned int phase_num_control_steps; - - enum {ATTACK,DECAY,SUSTAIN,RELEASE,IDLE}; - - - struct phase{ - byte phase_type; - unsigned int control_steps; - unsigned long audio_steps; - Q8n0 level; - }attack,decay,sustain,release,idle; - - phase * current_phase; - - // Linear audio rate transitions for envelope - Line <unsigned long> transition; - - inline - unsigned int convertMsecToControlSteps(unsigned int msec){ - return (uint) (((ulong)msec*CONTROL_UPDATE_RATE)>>10); // approximate /1000 with shift - } - - inline - void setPhase(phase * next_phase) { - phase_control_step_counter = 0; - phase_num_control_steps = next_phase->control_steps; - transition.set(Q8n0_to_Q16n16(next_phase->level),next_phase-> control_steps); - current_phase = next_phase; - } - - - - inline - void checkForAndSetNextPhase(phase * next_phase) { - if (++phase_control_step_counter >= phase_num_control_steps){ - setPhase(next_phase); - } - } - - - inline - void checkForAndSetIdle() { - if (++phase_control_step_counter >= phase_num_control_steps){ - transition.set(0,0,1); - current_phase = &idle; - } - } - - - -inline - void setTime(phase * p, unsigned int msec) - { - p->control_steps=convertMsecToControlSteps(msec); - p->audio_steps = (ulong) p->control_steps * AUDIO_TICKS_PER_CONTROL; - } - - -public: - - /** Constructor. - */ - ADSR():AUDIO_TICKS_PER_CONTROL(AUDIO_RATE/CONTROL_UPDATE_RATE) - { - attack.phase_type = ATTACK; - decay.phase_type = DECAY; - sustain.phase_type = SUSTAIN; - release.phase_type = RELEASE; - idle.phase_type = IDLE; - release.level = 0; - } - - -/** Updates the internal controls of the ADSR. - Call this in updateControl(). - */ - void update(){ // control rate - - switch(current_phase->phase_type) { - - case ATTACK: - checkForAndSetNextPhase(&decay); - break; - - case DECAY: - checkForAndSetNextPhase(&sustain); - break; - - case SUSTAIN: - checkForAndSetNextPhase(&release); - break; - - case RELEASE: - checkForAndSetIdle(); - break; - - } - } - - /** Advances one audio step along the ADSR and returns the level. - Call this in updateAudio(). - @return the next value, as an unsigned int. - */ - inline - unsigned int next() - { - return Q16n16_to_Q16n0(transition.next()); - } - - - - /** Start the attack phase of the ADSR. THis will restart the ADSR no matter what phase it is up to. - */ - inline - void noteOn(){ - setPhase(&attack); - } - - - - /** Start the release phase of the ADSR. - @todo fix release for rate rather than steps (time), so it releases at the same rate whatever the current level. - */ - inline - void noteOff(){ - setPhase(&release); - } - - - - - - /** Set the attack level of the ADSR. - @param value the attack level. - */ - inline - void setAttackLevel(byte value) - { - attack.level=value; - } - - - - /** Set the decay level of the ADSR. - @param value the decay level. - */ - inline - void setDecayLevel(byte value) - { - decay.level=value; - } - - - /** Set the sustain level of the ADSR. - @param value the sustain level. Usually the same as the decay level, - for a steady sustained note. - */ - inline - void setSustainLevel(byte value) - { - sustain.level=value; - } - - /** Set the release level of the ADSR. Normally you'd make this 0, - but you have the option of some other value. - @param value the release level (normally 0). - */ - inline - void setReleaseLevel(byte value) - { - release.level=value; - } - - - - /** Set the attack and decay levels of the ADSR. This assumes a conventional - ADSR where the sustain continues at the same level as the decay, till the release ramps to 0. - @param attack the new attack level. - @param value the new sustain level. - */ - inline - void setADLevels(byte attack, byte decay) - { - setAttackLevel(attack); - setDecayLevel(decay); - setSustainLevel(decay); - setReleaseLevel(0); - } - - - - - - - - /** Set the attack time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - @param value the unsigned int attack time in milliseconds. - */ - inline - void setAttackTime(unsigned int msec) - { - setTime(&attack, msec); - } - - - /** Set the decay time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - @param value the unsigned int decay time in milliseconds. - */ - inline - void setDecayTime(unsigned int msec) - { - setTime(&decay, msec); - } - - - /** Set the sustain time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - The sustain phase will finish if the ADSR recieves a noteOff(). - @param value the unsigned int sustain time in milliseconds. - */ - inline - void setSustainTime(unsigned int msec) - { - setTime(&sustain, msec); - } - - - - /** Set the release time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - @param value the unsigned int release time in milliseconds. - */ - inline - void setReleaseTime(unsigned int msec) - { - setTime(&release, msec); - } - - - - /** Set the attack, decay and release times of the ADSR in milliseconds. - The actual times will be resolved within the resolution of CONTROL_RATE. - @param attack_ms the new attack time in milliseconds. - @param decay_ms the new decay time in milliseconds. - @param decay_ms the new sustain time in milliseconds. - @param release_ms the new release time in milliseconds. - */ - inline - void setTimes(unsigned int attack_ms, unsigned int decay_ms, unsigned int sustain_ms, unsigned int release_ms) - { - setAttackTime(attack_ms); - setDecayTime(decay_ms); - setSustainTime(sustain_ms); - setReleaseTime(release_ms); - } - - -}; - -#endif /* ADSR_H_ */ - diff --git a/PolyDrums_v0_1_3_DelayLPF/PolyDrums_v0_1_3_DelayLPF.ino b/PolyDrums_v0_1_3_DelayLPF/PolyDrums_v0_1_3_DelayLPF.ino deleted file mode 100644 index 2b612f4..0000000 --- a/PolyDrums_v0_1_3_DelayLPF/PolyDrums_v0_1_3_DelayLPF.ino +++ /dev/null @@ -1,495 +0,0 @@ - -/* Example of a sound being triggered by MIDI input. - * - * Demonstrates playing notes with Mozzi in response to MIDI input, - * using the standard Arduino MIDI library: - * http://playground.arduino.cc/Main/MIDILibrary - * - * Mozzi help/discussion/announcements: - * https://groups.google.com/forum/#!forum/mozzi-users - * - * Tim Barrass 2013. - * This example code is in the public domain. - * - * sgreen - modified to use standard Arduino midi library, added saw wave, lowpass filter - * Audio output from pin 9 (pwm) - * Midi plug pin 2 (centre) to Arduino gnd, pin 5 to RX (0) - * http://www.philrees.co.uk/midiplug.htm - * Now with drums! (still has all this code in there, commented out : ) - -S Green: -mod controller/ribbon is low pass filter cut-off -big button switches between tri/rectangle/noise/saw -(noise is at constant frequency) - -NB think mostly fixed, but may still be possible to crash filter with loud sounds, hit reset! - - */ - - -#include <MIDI.h> -#include <MozziGuts.h> -#include <Oscil.h> // oscillator template -#include <Line.h> // for envelope -#include <Sample.h> -#include <mozzi_utils.h> -#include <mozzi_analog.h> - -#include <tables/sin2048_int8.h> // sine table for oscillator -//#include <tables/saw2048_int8.h> -//#include <tables/triangle2048_int8.h> - -#include <mozzi_midi.h> -#include <ADSRslow.h> -#include <fixedMath.h> -#include <LowPassFilter.h> -#include "Wave.h" -#include <WaveShaper.h> -#include <tables/waveshape_compress_512_to_488_int16.h> - -#define MAX_NOTES 3 -//Dave G: now seems to do 2+ note polyphony without clicking (higher notes are a bit grainy) -int threshold=255/(MAX_NOTES); - -#define DRUM_SAMPLES 1 - -#if DRUM_SAMPLES -#include "kick909.h" -#include "snare909.h" -#include "hihatc909.h" -#include "hihato909.h" -#endif - -// use #define for CONTROL_RATE, not a constant -#define CONTROL_RATE 128 // powers of 2 please - -#define ENABLE_MIDI 1 -#define DEBUG 0 -#define BPM 120 -#define STEPS_PER_BEAT 4 - -unsigned long stepCounter = 0; -unsigned long ticksPerStep = (60*CONTROL_RATE) / (BPM*STEPS_PER_BEAT); - -// audio sinewave oscillator -//Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> osc(SIN2048_DATA); -//Oscil <SAW2048_NUM_CELLS, AUDIO_RATE> osc(SAW2048_DATA); -//Oscil <TRIANGLE2048_NUM_CELLS, AUDIO_RATE> osc(TRIANGLE2048_DATA); -//Wave myosc; -//Wave lfo; -Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> lfo(SIN2048_DATA); -WaveShaper <int> aCompress(WAVESHAPE_COMPRESS_512_TO_488_DATA); // to compress instead of dividing by 2 after adding signals - -struct Channel { - Wave osc; - //Oscil <TRIANGLE2048_NUM_CELLS, AUDIO_RATE> osc; - ADSR <CONTROL_RATE> env; - ADSR <CONTROL_RATE> fxenv; - byte note; - byte gain; -}; -Channel chan[MAX_NOTES]; -byte currentChan = 0; - -// envelope generator -//ADSR <CONTROL_RATE> envelope; -LowPassFilter lpf; -int crushCtrl = 0; -int gain = 32; -float octave = 1.0f; - -boolean enableDrums = true; - -int freeChan=0; -int step = 0; -int waveType = 0; - -byte kickOn=1; -byte snareOn=1; -byte hatsOn=1; - -int button0_old = 0; -int button1_old = 0; - -#if DRUM_SAMPLES -// drums -Sample <kick909_NUM_CELLS, AUDIO_RATE> kickSamp(kick909_DATA); -Sample <snare909_NUM_CELLS, AUDIO_RATE> snareSamp(snare909_DATA); -Sample <hihatc909_NUM_CELLS, AUDIO_RATE> hihatcSamp(hihatc909_DATA); -Sample <hihato_NUM_CELLS, AUDIO_RATE> hihatoSamp(hihato_DATA); -#endif - -byte pattern[4][16] = { - //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 hhc - 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, // 1 hho - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, // 2 snare - 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, // 3 kick -}; - -// pin defines -#define LED 13 // to see if MIDI is being recieved -#define BUTTON0_PIN 2 -#define BUTTON1_PIN 3 - -// forward declarations -void HandleNoteOn(byte channel, byte note, byte velocity); -void HandleNoteOff(byte channel, byte note, byte velocity); -void HandleControlChange (byte channel, byte number, byte value); -void HandlePitchBend (byte channel, int bend); - -void setup() { - // init IO pins - pinMode(LED, OUTPUT); - -#if 0 - pinMode(BUTTON0_PIN, INPUT); - digitalWrite(BUTTON0_PIN, HIGH); // turn on pull-up resistor - - pinMode(BUTTON1_PIN, INPUT); - digitalWrite(BUTTON1_PIN, HIGH); // turn on pull-up resistor -#endif - -#if DEBUG - Serial.begin(57600); // for debugging -#endif - -#if ENABLE_MIDI - // Initiate MIDI communications, listen to all channels - MIDI.begin(MIDI_CHANNEL_OMNI); - - // Connect the HandleNoteOn function to the library, so it is called upon reception of a NoteOn. - MIDI.setHandleNoteOn(HandleNoteOn); // Put only the name of the function - MIDI.setHandleNoteOff(HandleNoteOff); // Put only the name of the function - MIDI.setHandleControlChange(HandleControlChange); - MIDI.setHandlePitchBend(HandlePitchBend); - MIDI.setHandleContinue(HandleContinue); - MIDI.setHandleStop(HandleStop); - MIDI.setHandleStart(HandleStart); - MIDI.setHandleProgramChange(HandleProgramChange); - -#endif - -#if 0 - //osc.setFreq(440u); // default frequency - //myosc.setFreq(440.0f); - myosc.setFreq(440.0f*4.0f); - myosc.setPulseWidth(32); - - envelope.setADLevels(255, 200); - envelope.setTimes(50, 200, 65535, 5000); -#endif - - for(int i=0; i<MAX_NOTES; i++) - { - chan[i].osc.setType(WAVE_TRI); - //chan[i].osc.setTable(TRIANGLE2048_DATA); - chan[i].osc.setPulseWidth(16); - chan[i].note=128; - chan[i].env.setADLevels(127,127); - chan[i].env.setTimes(10, 10, 0, 1020); -// chan[i].fxenv.setADLevels(255,255); -// chan[i].fxenv.setTimes(10, 10, 0, 2000); - } - - //lfo.setType(WAVE_TRI); - lfo.setFreq(10.0f); - - lpf.setResonance(128); - lpf.setCutoffFreq(190); - -#if DRUM_SAMPLES - kickSamp.setFreq((float) kick909_SAMPLERATE / (float) kick909_NUM_CELLS); - snareSamp.setFreq((float) snare909_SAMPLERATE / (float) snare909_NUM_CELLS); - hihatcSamp.setFreq((float) hihatc909_SAMPLERATE / (float) hihatc909_NUM_CELLS); - hihatoSamp.setFreq((float) hihato_SAMPLERATE / (float) hihato_NUM_CELLS); - //snareSamp.start(); -#endif - - //setupFastAnalogRead(); // optional - adcEnableInterrupt(); // for analog reads - - startMozzi(CONTROL_RATE); -} - -void HandleProgramChange (byte channel, byte number) -{ - - // change wave - waveType = (number) & 3; - - for(int i=0; i<MAX_NOTES; i++) - { -#if 0 - switch(waveType) { - case 0: - chan[i].osc.setTable(TRIANGLE2048_DATA); - break; - case 1: - chan[i].osc.setTable(SAW2048_DATA); - break; - case 2: - chan[i].osc.setTable(SIN2048_DATA); - break; - } -#else - for(int i=0; i<MAX_NOTES; i++) - { - chan[i].osc.setType((WaveType) waveType); - } -#endif - } -} - - -void HandleNoteOn(byte channel, byte note, byte velocity) { - //osc.setFreq(mtof(note)); // simple but less accurate frequency - //osc.setFreq_Q16n16(Q16n16_mtof(Q8n0_to_Q16n16(note))); // accurate frequency - //myosc.setFreq(mtof(note)); // accurate frequency - //envelope.noteOn(); - - // start note on next channel - now with v basic "note priority"! -int index; -int empty=99; - for(int i=0; i<MAX_NOTES; i++) - { - index=(currentChan+i)%MAX_NOTES; - if (chan[index].gain==0) {empty=index; break;} - } - -if (empty==99) // ie all no empty channels found so far? - { - for(int i=0; i<MAX_NOTES; i++) - { - index=(currentChan+i)%MAX_NOTES; - if (chan[index].note==128) {empty=index; break;} - } - } - -if (empty<99) {currentChan=empty;} else - { - currentChan = (currentChan + 1) % MAX_NOTES; // add 1, wrap around - } - - chan[currentChan].note = note; - chan[currentChan].osc.setFreq(mtof(note)); // accurate frequency? - if (waveType==1) {chan[currentChan].osc.setFreq(mtof(note+24));} //high triangle - chan[currentChan].env.noteOn(); -// chan[currentChan].fxenv.noteOn(); - - digitalWrite(LED,HIGH); -} - -void HandleNoteOff(byte channel, byte note, byte velocity) { - //envelope.noteOff(); - - // find which channel was playing this note - for(int i=0; i<MAX_NOTES; i++) { - if (chan[i].note == note) { - // kill it - chan[i].env.noteOff(); - chan[i].note=128; - } - } - - digitalWrite(LED,LOW); -} - -void HandleControlChange (byte channel, byte number, byte value) -{ - // http://www.indiana.edu/~emusic/cntrlnumb.html - switch(number) { - case 1: // modulation wheel - //gain = value*2; - lpf.setCutoffFreq( int(value*1.5f) ); // control messages are in [0, 127] range - lpf.setResonance( int(value*1.4f) ); -// for(int i=0; i<MAX_NOTES; i++) {chan[i].env.setTimes(10, 10, 0, 900+value); } - break; -/* - case 105: - lpf.setCutoffFreq(value*2); // control messages are in [0, 127] range - break; -*/ - case 106: - //lpf.setResonance(value*2); - crushCtrl = value; - break; - } -} - -// pitchbend = control strip + button on Keytar -void HandlePitchBend (byte channel, int bend) -{ - //bend value from +/-8192 - //lfo.setFreq((unsigned int) (bend+8192)>>7); - for(int i=0; i<MAX_NOTES; i++) { - chan[i].osc.setPulseWidth((bend+8192) >> 8); - } - -} - -void HandleStop () { //this is the Back button on the Xbox keyboard -// octave *= 2.0f; -// if (octave > 16.0f) octave = 1.0f; -//Dave G: no longer used : ) -kickOn=(! kickOn); -} - -void HandleStart () { //this is the Back button on the Xbox keyboard -// octave *= 2.0f; -// if (octave > 16.0f) octave = 1.0f; -//Dave G: no longer used : ) -hatsOn=(! hatsOn); -} - -void HandleContinue () { // the big round button on all keytars -snareOn=(! snareOn); -} - -void updateControl(){ -#if ENABLE_MIDI - MIDI.read(); -#endif - - //envelope.update(); - - // update playing envelopes - for(int i=0; i<MAX_NOTES; i++) { - chan[i].env.update(); -// chan[i].fxenv.update(); - //int tremolo=( chan[i].fxenv.next() & 0b00111111 ); - int tremolo=chan[i].env.next(); - chan[i].gain=(tremolo * (tremolo&0b00011111) )>>5; - if (chan[i].gain>threshold) {chan[i].gain=threshold;} - // threshold=255/MAX_NOTES, genuinely not sure if this is best approach but stops crashes :) - } - -#if 0 - // push buttons - int button0 = !digitalRead(BUTTON0_PIN); // active low - int button1 = !digitalRead(BUTTON1_PIN); - - /* - if (button0) { - // trigger - //envelope.noteOn(); - //lpf.reset(); - digitalWrite(LED, HIGH); - } else { - digitalWrite(LED, LOW); - } - */ - - if (button0 && !button0_old) { - lfo.setType((WaveType) ((((int) lfo.getType()) + 1) % 3)); - } - button0_old = button0; - - if (button1 & !button1_old) { - waveType = (waveType + 1) & 3; - //myosc.setType((WaveType) waveType); - for(int i=0; i<MAX_NOTES; i++) - { - chan[i].osc.setType((WaveType) waveType); - } - } - button1_old = button1; -#endif - -#if DRUM_SAMPLES - if (enableDrums) { - // drums - stepCounter++; - if (stepCounter > ticksPerStep) { - step = (step+1) & 0xf; - stepCounter = 0; - -//if (step==0 || step==8) {HandleNoteOn(1, 48, 128); } - - //semi-perceptible BPM-locked phaser - int filterlevel=step; if (step>7) {filterlevel=15-step;} - lpf.setCutoffFreq( (filterlevel+11) <<3 ); //maps to 72-192 - lpf.setResonance( (filterlevel+10) <<3); - if (pattern[0][step] && hatsOn) hihatcSamp.start(); - if (pattern[1][step] && hatsOn) hihatoSamp.start(); - if (pattern[2][step] && snareOn) snareSamp.start(); - if (pattern[3][step] && kickOn) kickSamp.start(); - } - } -#endif - -#if 0 - // knobs - int knob0 = adcGetResult(0); // [0, 1023] - int knob1 = adcGetResult(1); - //lpf.setCutoffFreq(knob0>>2); - //lpf.setResonance(knob1>>2); - - //crushCtrl = knob1>>7; - lfo.setFreq((float) knob0); - //myosc.setFreq((float) knob1); - //myosc.setFreq((unsigned int) knob0*20); - //myosc.setPulseWidth((unsigned char) (knob1>>2)); - - // start the next read cycle in the background - adcReadAllChannels(); -#endif - -#if DEBUG - Serial.println(knob0); -#endif -} - -// strip the low bits off! -int bitCrush(int x, int a) -{ - return (x>>a)<<a; -} - -int updateAudio() -{ - //int x = (int) (envelope.next() * osc.next())>>8; - //int x = (int) (envelope.next() * myosc.next())>>8; - //int x = (int) (envelope.next() * (lfo.next() * myosc.next())>>8)>>8; - //int x = (int) lfo.next(); - //int x = (int) (lfo.next() * myosc.next())>>8; - //int x = (int) (envelope.next() * lpf.next(myosc.next()))>>8; - //int x = (envelope.next() * lpf.next(osc.next()))>>8; - //x = bitCrush(x, crushCtrl>>4); - //x = bitCrush(x, crushCtrl); - //x = (x * crushCtrl)>>4; // simple gain - //x = x>>2; - //x = lpf.next(x); - - // sum up channels - int x = 0; - for(int i=0; i<MAX_NOTES; i++) { - x += (int) (chan[i].gain * chan[i].osc.next())>>8; - } - -//Dave G: helps crash less if goes through some sort of waveshaper here? - x = aCompress.next(256u + x); - - //x = (x*gain)>>8; - //x = (x * lfo.next())>>8; - x = lpf.next(x); - -#if DRUM_SAMPLES - if (enableDrums) { - // drums please! - int drums = kickSamp.next() + snareSamp.next() + hihatcSamp.next() + hihatoSamp.next(); - //drums = (drums>>4)<<4; - x += drums; - } -#endif - - return x; -} - - -void loop() { - audioHook(); // required here -} - - - diff --git a/PolyDrums_v0_1_3_DelayLPF/Wave.h b/PolyDrums_v0_1_3_DelayLPF/Wave.h deleted file mode 100644 index a9afd72..0000000 --- a/PolyDrums_v0_1_3_DelayLPF/Wave.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Wave.h - * - * Simon Green 2013. - * - * Based on Mozzi "Oscil.h" - */ - -#ifndef WAVE_H_ -#define WAVE_H_ - -#include "Arduino.h" -#include "mozzi_fixmath.h" -#include <util/atomic.h> - -// fractional bits for oscillator index precision -#define OSCIL_F_BITS 16 -#define OSCIL_F_BITS_AS_MULTIPLIER 65536 -#define NUM_TABLE_CELLS 256 -#define ADJUST_FOR_NUM_TABLE_CELLS 8 -#define UPDATE_RATE AUDIO_RATE - -/** Generate waveform -*/ - -enum WaveType { WAVE_SAW=0, WAVE_TRI, WAVE_RECT, WAVE_NOISE }; - -class Wave -{ -public: - /** Constructor. "Wave mywave;" makes a Wave oscillator - */ - Wave () { - phase_fractional = 0; - phase_increment_fractional = 0; - wavetype = WAVE_SAW; - noise = 0xACE1; - pulse_width = 128; - } - - /** Increments one step along the phase. - @return the next value. - */ - inline - char next() - { - incrementPhase(); - - char w; - //ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - int n = (phase_fractional >> OSCIL_F_BITS) & (NUM_TABLE_CELLS-1); - switch(wavetype) { - case WAVE_SAW: - w = n - 128; - break; - case WAVE_TRI: - if (n & 0x80) // >= 128 - w = ((n^0xFF)<<1)-128; - else - w = (n<<1)-128; - break; - case WAVE_RECT: - if (n > pulse_width) - w = 127; - else - w = -127; - break; - case WAVE_NOISE: - noise = (noise >> 1) ^ (-(noise & 1) & 0xB400u); - w = noise>>8; - break; - } - } - return w; - } - - /** Set the wave type - */ - inline - void setType(WaveType x) - { - wavetype = x; - } - - WaveType getType() { return wavetype; } - - /** Set the pulse width for rectangle wave - */ - inline - void setPulseWidth(unsigned char x) - { - pulse_width = x; - } - - /** Set the oscillator frequency with an unsigned int. This is faster than using a - float, so it's useful when processor time is tight, but it can be tricky with - low and high frequencies, depending on the size of the wavetable being used. If - you're not getting the results you expect, try explicitly using a float, or try - setFreq_Q24n8() or or setFreq_Q16n16(). - @param frequency to play the wave table. - */ - inline - void setFreq (unsigned int frequency) { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - phase_increment_fractional = ((((unsigned long)NUM_TABLE_CELLS<<ADJUST_FOR_NUM_TABLE_CELLS)*frequency)/UPDATE_RATE) << (OSCIL_F_BITS - ADJUST_FOR_NUM_TABLE_CELLS); - } - } - - - /** Set the oscillator frequency with a float. Using a float is the most reliable - way to set frequencies, -Might- be slower than using an int but you need either - this, setFreq_Q24n8() or setFreq_Q16n16() for fractional frequencies. - @param frequency to play the wave table. - */ - inline - void setFreq(float frequency) - { // 1 us - using float doesn't seem to incur measurable overhead with the oscilloscope - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - phase_increment_fractional = (unsigned long)((((float)NUM_TABLE_CELLS * frequency)/UPDATE_RATE) * OSCIL_F_BITS_AS_MULTIPLIER); - } - } - - - /** Set the frequency using Q24n8 fixed-point number format. - This might be faster than the float version for setting low frequencies such as - 1.5 Hz, or other values which may not work well with your table size. A Q24n8 - representation of 1.5 is 384 (ie. 1.5 * 256). Can't be used with UPDATE_RATE - less than 64 Hz. - @param frequency in Q24n8 fixed-point number format. - */ - inline - void setFreq_Q24n8(Q24n8 frequency) - { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - //phase_increment_fractional = (frequency* (NUM_TABLE_CELLS>>3)/(UPDATE_RATE>>6)) << (F_BITS-(8-3+6)); - phase_increment_fractional = (((((unsigned long)NUM_TABLE_CELLS<<ADJUST_FOR_NUM_TABLE_CELLS)>>3)*frequency)/(UPDATE_RATE>>6)) - << (OSCIL_F_BITS - ADJUST_FOR_NUM_TABLE_CELLS - (8-3+6)); - } - } - - - /** Set the frequency using Q16n16 fixed-point number format. This is useful in - combination with Q16n16_mtof(), a fast alternative to mtof(), using Q16n16 - fixed-point format instead of floats. Note: this should work OK with tables 2048 cells or smaller and - frequencies up to 4096 Hz. Can't be used with UPDATE_RATE less than 64 Hz. - @param frequency in Q16n16 fixed-point number format. - */ - inline - void setFreq_Q16n16(Q16n16 frequency) - { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - //phase_increment_fractional = ((frequency * (NUM_TABLE_CELLS>>7))/(UPDATE_RATE>>6)) << (F_BITS-16+1); - phase_increment_fractional = (((((unsigned long)NUM_TABLE_CELLS<<ADJUST_FOR_NUM_TABLE_CELLS)>>7)*frequency)/(UPDATE_RATE>>6)) - << (OSCIL_F_BITS - ADJUST_FOR_NUM_TABLE_CELLS - 16 + 1); - - } - } - -private: - /** Increments the phase of the oscillator without returning a sample. - */ - inline - void incrementPhase() - { - //phase_fractional += (phase_increment_fractional | 1); // odd phase incr, attempt to reduce frequency spurs in output - phase_fractional += phase_increment_fractional; - } - - unsigned long phase_fractional; - volatile unsigned long phase_increment_fractional; - - unsigned char pulse_width; - uint16_t noise; - - WaveType wavetype; -}; - -#endif /* WAVE_H_ */ diff --git a/PolyDrums_v0_1_3_DelayLPF/hihatc909.h b/PolyDrums_v0_1_3_DelayLPF/hihatc909.h deleted file mode 100644 index d52992d..0000000 --- a/PolyDrums_v0_1_3_DelayLPF/hihatc909.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef hihatc909_H_ -#define hihatc909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define hihatc909_NUM_CELLS 1024 -#define hihatc909_SAMPLERATE 16384 - -const char __attribute__((progmem)) hihatc909_DATA [] = {1, -2, 1, -2, 2, 0, -4, -13, -18, 2, 3, 3, -1, 4, -9, 7, -5, -2, 4, -22, 23, -7, -8, -2, 7, -5, -8, 12, --4, 7, 7, -21, 12, -3, -18, 8, 1, 4, -20, 4, -5, -4, -2, 0, -2, -7, 3, -3, -3, --4, 3, -9, 12, -5, 20, 2, -25, 19, 0, 8, -12, -6, 4, 0, 15, -7, 8, 19, -9, -6, -0, -1, 0, -3, 12, -12, 7, 9, -18, 2, 4, 1, -7, -4, 7, 2, -3, 0, -3, 1, -2, -4, --4, -11, 7, -8, -2, 11, 2, 8, -1, 4, -3, -1, -2, -9, -6, -3, 3, -9, -9, 4, 1, --5, 1, 5, 0, 2, 2, -3, 9, 6, -7, 3, 5, 0, -2, 0, 7, -3, -2, -2, -3, 4, -2, 2, --3, 2, 0, -14, 4, 3, -4, 0, -5, 3, -2, -9, 3, 0, -1, -1, -5, -1, 5, -4, -6, 7, -1, -2, 2, 0, 4, -1, -7, 1, 3, 3, -1, -1, 6, 1, -2, 0, 3, -5, -9, 1, -1, -2, 0, --2, -1, 2, -1, -7, -2, -1, 1, -1, -4, 7, -5, -4, 5, 1, 1, 1, -2, 3, 2, -4, 0, 1, -3, -3, 1, -2, 0, 2, -1, 2, -2, -2, 0, -4, -3, 3, -3, 0, -1, -3, 2, -3, -6, 6, --2, 0, 1, 2, 0, -2, 2, 1, 1, -5, 1, -3, -2, -4, 3, -2, -2, 0, -2, 2, -4, 1, 4, --4, -1, 1, -1, -1, -2, 2, 1, 1, -4, 5, -4, 0, 1, -4, 3, -2, -1, 3, 0, -3, 0, -1, --1, -1, 0, -4, 3, -1, -3, 2, -1, -1, 0, 0, 1, 1, -1, 1, -2, -1, -1, -4, -1, 4, --1, -2, 1, 0, 1, 0, 0, -1, 1, 0, 0, -1, 1, -3, 0, -1, -3, 2, -2, 1, 0, -2, -3, -1, -1, -3, 1, -1, -2, 1, 1, -2, -1, 0, 0, -2, 0, -1, -2, 2, -1, 0, -2, 1, -2, 0, -0, -4, 1, -1, -2, 1, 0, -2, 0, -2, 3, 0, -2, 1, 0, -1, -1, 1, -1, 0, 0, -1, 0, -0, 0, -2, -1, 0, -1, 0, 0, -2, 0, 0, -2, -2, 0, -1, -1, 1, 0, -2, 0, 1, -1, 1, --1, 0, -1, 0, -1, -1, -1, -2, 1, 0, 0, 0, 0, 0, 0, -2, 0, 0, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, 1, -3, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -2, 0, 0, 0, --2, -1, 1, -1, 0, 0, -1, 0, 0, 0, -1, -2, 0, -2, -1, 0, 0, -1, 0, 0, -2, 0, -1, --1, -1, 0, -1, 0, 0, 0, -1, -1, 0, -1, 0, 0, 0, -2, 0, -1, -1, 0, -1, -1, 0, -1, --1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, -1, 1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -0, -1, -1, 0, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, -0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, --1, 0, 0, -1, 0, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, --1, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, 0, 0, -1, -1, 0, -1, 0, 0, -1, -1, 0, --1, 0, 0, -1, 0, 0, 0, -1, -1, -1, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, 0, --1, 0, -1, 0, 0, -1, -1, 0, 0, -1, -1, -1, 0, 0, 0, -1, -1, -1, -1, 0, -1, 0, 0, --1, -1, 0, 0, 0, -1, 0, -1, -1, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, 0, 0, 0, -1, -1, 0, -1, -1, 0, -1, 0, 0, 0, 0, -1, 0, 0, -1, -0, -1, -1, 0, -1, -1, 0, -1, -1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, --1, 0, -1, -1, -1, 0, 0, 0, -1, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, -1, 0, -1, --1, 0, -1, 0, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, 0, 0, -1, 0, -1, 0, -0, -1, 0, -1, -1, 0, -1, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, --1, 0, 0, -1, -1, 0, -1, -1, 0, -1, 0, 0, -1, -1, -1, 0, -1, -1, 0, 0, 0, 0, 0, --1, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, 0, -1, -1, 0, -1, 0, -1, -1, 0, --1, 0, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, 0, -1, -1, 0, -1, -1, -0, -1, 0, -1, 0, -1, -1, -1, 0, 0, -1, -1, -1, 0, -1, 0, -1, -1, -1, 0, 0, -1, -0, 0, 0, -1, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, 0, -0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, --1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, -0, 0, -1, 0, -1, 0, -1, 0, 0, 0, -1, -1, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, -1, -0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, }; - - #endif /* hihatc909_H_ */ diff --git a/PolyDrums_v0_1_3_DelayLPF/hihato909.h b/PolyDrums_v0_1_3_DelayLPF/hihato909.h deleted file mode 100644 index a36f866..0000000 --- a/PolyDrums_v0_1_3_DelayLPF/hihato909.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef hihato_H_ -#define hihato_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define hihato_NUM_CELLS 2048 -#define hihato_SAMPLERATE 16384 - -const char __attribute__((progmem)) hihato_DATA [] = {0, -1, 0, -1, 0, -1, 0, --1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -2, 4, -4, -1, 3, 1, -8, 7, -2, -9, 3, -1, -1, -3, 0, -2, 4, -3, -4, -1, -3, 3, -2, -5, -1, 2, -1, -3, -1, 4, -2, 4, -3, -2, -4, -1, 6, 0, 8, -5, -5, 2, -2, 2, -2, -2, 7, -4, 6, -11, -6, 11, -6, 1, 4, 0, --14, 11, -6, -1, -2, -8, 5, -13, 1, 0, -8, 2, 7, 3, 1, -8, 5, 2, 2, -2, -8, 11, --1, 0, 2, -1, -3, 2, -3, -9, 2, -4, 6, -3, 1, 9, -7, -3, 2, -2, -2, -13, 2, 9, --3, 4, -3, 4, -6, 3, -1, -7, 13, -5, 3, 1, 1, -5, -13, 1, -2, 8, 0, 2, -4, 6, --1, 2, 3, -12, 4, -16, 0, -7, 2, 0, -3, 10, -6, 6, -3, -9, -2, 11, -7, -7, 11, -9, -3, 1, -1, -5, -6, -4, 2, -11, 8, 2, -4, 14, 0, -9, 7, -4, 6, -2, -10, -3, 1, -4, -12, 10, -1, 1, 0, 2, -3, 0, 5, 0, 5, -6, 0, -1, 0, -8, -3, -1, -1, 1, -3, 3, --3, 4, 8, -12, 0, -2, -7, 9, 2, 3, -6, -1, -4, 2, -7, -5, 12, -4, 7, 0, -2, 3, --1, -2, -3, 1, -3, -1, 2, -1, 2, -8, 1, 7, -8, -3, 1, 5, 4, -3, -3, 1, -3, -13, -2, 0, 1, 2, -13, 4, 4, 4, 0, 6, 2, -6, -9, -5, 12, -3, 1, -10, 10, -1, -7, 3, --2, 9, -18, 0, -5, 11, -4, 0, 6, -13, 3, -13, 14, 3, -5, 0, -3, 3, 1, -2, 1, 7, -5, -8, 6, 0, -8, 2, -3, 4, -6, 1, -14, 7, 8, -10, 7, -11, 10, -8, -13, 13, -3, -1, -2, 4, -4, -2, 0, 0, 8, -8, 2, 3, 5, -2, -1, -1, 4, 1, -13, 2, 2, -3, -5, 2, --1, 2, -2, 0, 0, 4, -6, -5, 6, -1, 2, -5, 1, 10, -8, -7, 8, -6, 6, 3, -15, 2, 0, --8, 6, 5, -4, 2, 0, -6, 5, -2, -4, 2, -3, -1, 5, -2, -2, 0, 1, 4, -8, 2, 4, 0, -0, -2, -1, -3, -1, -5, -3, 6, -18, 5, 10, -6, 10, -3, -4, 3, 1, -11, 4, -3, 5, --2, -7, 7, -5, 3, -4, 4, -3, 3, -3, -2, 6, -2, 4, -5, 5, -3, -9, -3, -4, 1, -2, -5, 2, -2, 7, -4, -5, 3, 0, 2, 2, -5, -2, 6, 5, -11, 3, -6, 2, 0, -3, 5, -4, 5, --6, 7, -11, 4, -3, -5, 1, -8, 4, -11, 17, 1, -3, -6, -2, 7, -2, -1, -5, 13, -5, --8, 1, 5, 3, -10, 5, -5, -4, 7, -7, 8, 5, 1, -2, -8, 7, -8, -2, 2, 1, 4, -5, -5, --2, 10, -10, -2, 1, -8, 0, -2, 5, 8, -4, -2, -4, 0, 4, -4, 1, -2, 5, 0, 8, -2, -1, -2, -4, 3, -6, 3, 0, -2, 2, 2, -5, -1, -7, -3, 1, 2, -6, 3, 0, -5, 6, -6, -1, -4, -2, -9, 4, 1, 3, 3, -2, 2, -1, -5, -2, 8, -1, -4, -6, 7, 2, 0, -3, 1, 2, -2, -1, -7, 5, -9, -2, 3, -4, 3, -1, -8, -3, 1, 0, -7, 5, 3, -3, -7, 2, 6, -2, 3, -7, -8, -7, 2, 1, 3, 7, -6, -1, -1, -2, -3, 5, -6, 3, 1, 0, -2, -1, -6, -5, 1, 3, 2, --4, 2, -2, -1, 0, -1, -3, -2, -5, -3, 3, 4, -1, 8, 0, -2, 0, -5, 1, 2, -3, -2, -8, -4, 0, -5, -2, -1, -3, 0, 5, 3, -8, 0, 0, 7, -7, -2, -1, -3, -3, -1, 1, 7, 5, --7, 1, 1, 4, -4, -3, 2, 5, -2, -6, 1, 1, -3, -7, -1, 3, -8, 3, -1, 2, 6, -11, 4, -1, -2, 0, -2, -3, 6, 6, -6, -1, 1, 2, 1, -1, -2, -1, -1, -5, 3, 0, -1, -1, -7, -0, -5, -1, 4, 0, 6, 0, -3, 1, 6, -5, 0, -3, -7, 6, -2, -2, 1, 5, -4, 4, -7, -4, -6, -3, 1, 0, -1, -4, -5, 2, -2, -5, 3, 1, 4, -1, 0, 1, 4, -1, -5, -1, -6, 2, -4, --1, 2, -1, 1, -4, -2, 0, 1, 2, -1, 0, 2, -2, 0, 4, 0, -4, 1, -5, 1, -2, 1, 4, 0, -2, 1, -3, -9, 0, -1, 2, -6, -2, 4, 1, -1, -4, 1, -1, 0, -3, 1, 1, 1, 0, 0, 6, --1, -8, -2, 1, 0, -2, -2, 5, 1, -3, -2, 5, 0, -3, -5, -8, 2, 1, 1, 0, 2, 2, -4, --1, -2, 2, -5, 0, 6, -4, 5, 0, -4, 1, -4, -8, 6, -3, -4, 4, -3, 3, 0, -1, -2, 1, --2, -2, 1, -2, -1, 0, 3, 1, 2, -1, -2, 0, -5, -1, 0, 7, 2, -4, 0, -2, -1, -2, --1, 0, 1, -4, -3, 5, 2, -2, 2, -4, 2, -6, -6, 6, -1, 4, -2, 0, 1, -1, -1, -1, 2, --3, 2, -5, -1, 4, -2, -1, -2, 2, -4, -5, 1, 2, 3, -1, 4, 1, -3, -2, -2, -2, 0, -2, -5, -2, 2, -1, 4, -4, -5, 3, -7, 2, 3, -3, 1, 2, 1, 1, -2, -3, 2, -4, 1, 0, --1, 4, 1, -4, 2, -3, -3, 2, -7, 0, 4, -1, -2, 1, 1, -7, 4, -1, -1, -1, -6, 3, 4, -0, -1, 1, -4, 3, -5, -3, 4, -2, 1, 0, 0, 1, 0, -2, -2, -2, -3, -2, -1, 0, 3, -1, -0, 0, -1, -1, -4, 1, 1, 1, 2, -2, 2, 0, -2, 0, -3, -2, -2, 0, 2, 1, -1, 0, -1, --2, 0, -3, 1, 1, -2, -3, 1, 0, 0, 1, -1, 1, -4, -1, 1, 3, 0, -1, 0, -1, -1, -4, -1, -1, 1, -1, -1, 3, -3, 0, -1, 2, -3, -2, 1, -3, 2, 2, -2, 0, 1, -6, 1, -1, 0, -3, -2, 0, 2, -2, -4, 1, -2, -2, -2, 2, -2, 2, 0, 0, 3, -2, 1, -2, 0, -3, 0, 1, --1, 0, -1, 2, -4, -2, 1, -4, 2, 0, -2, 1, 3, -2, 0, -1, -2, -3, -2, 1, -1, 0, 1, -4, -2, 2, -2, -4, 1, -3, -2, 1, 0, -2, 0, 0, -1, 0, -2, -2, 1, 0, 1, 0, 2, 1, --4, -2, 0, 0, -4, 1, -2, 1, 1, -4, 5, -1, -1, -2, -3, -1, 0, -3, -1, 4, -2, 0, -1, -1, 0, -2, -1, 2, -2, 1, 2, -1, 2, -1, -2, -1, -2, -5, -1, 1, 0, 0, 1, -2, 0, --1, -2, -1, 1, 0, -4, 1, 0, 1, -1, 2, -2, -4, -1, -1, 4, 0, -2, 0, -1, 0, 0, -5, -1, 1, -3, 0, 0, -2, 3, -1, -2, 3, -5, 0, 2, 0, 0, -2, -2, 1, 2, -6, 0, 1, -1, 1, --3, -1, 3, -2, -3, 2, 0, -3, 0, -2, 2, 1, -4, 2, 1, -2, -2, 1, -1, 4, -4, -4, 2, -2, -1, -1, -1, -4, 2, -3, 2, 2, -2, 0, -1, 0, 2, -3, -2, 2, 0, -4, -1, 1, -2, 2, --2, -1, 0, -2, -1, 1, -1, -1, 3, 0, -1, -1, 0, -1, -2, 1, -1, 1, -1, 2, 1, -1, --2, -1, 0, -5, 1, 0, -1, 2, 0, -2, -3, -1, 1, -2, -1, 1, 0, 1, 1, -2, 2, 0, -3, --1, 0, -2, -1, 2, -1, -1, 2, -3, -1, 2, -3, -2, -1, -1, -1, 1, -2, 1, 1, -1, 0, --2, 0, -2, 1, -1, 1, 1, 0, 0, -2, 0, -2, -1, -4, 0, 1, 0, 1, -1, 0, -1, -4, -2, --1, -1, -1, 0, 1, 2, -1, -3, 1, 0, 0, -1, -1, 0, 1, -3, 0, 2, 0, -2, -4, -1, 1, --1, -2, 2, 2, -1, -1, 0, -2, 1, -3, -3, 2, 0, -1, -1, 2, 1, -1, -2, -1, 0, -1, --2, 0, 1, -1, -2, 0, 2, -3, -1, 0, -2, 1, -1, 0, 3, -1, 0, -1, 0, -1, -1, -2, --1, 1, -1, 1, -3, -1, -1, -1, -1, -1, -1, -3, 2, -2, -1, 1, -1, 1, -2, -2, 1, 1, -0, -1, 1, -1, 0, -2, 1, 2, -3, 0, 0, -1, 0, -1, -2, 1, 0, -4, -1, 1, 0, 2, -3, --1, 1, -1, -2, 1, -1, 2, -1, -2, 1, -2, 0, -2, 0, 1, -2, -1, 0, 2, 0, -2, -1, 0, --1, -2, -1, 1, 3, -3, -2, 0, 0, -1, 0, 0, -1, -1, -3, -1, 1, 0, -2, 0, -1, 0, --2, 0, 0, 1, -1, 0, 1, -1, 3, -2, 0, 0, -3, 0, 2, -2, -1, 2, -1, -1, -1, -2, 0, --2, -2, 0, -1, -3, 0, 0, 0, 0, -3, 0, -1, 0, 0, 0, 1, 1, -1, -3, 0, 0, 0, -1, --3, 0, 1, -2, -1, 2, -2, -1, 0, -4, 1, 0, -2, 1, -1, 1, -1, 0, 0, 0, -1, -1, 0, --1, 1, -1, -1, 1, -1, -1, -2, -1, -1, -2, 0, 1, 0, -1, 1, -1, 0, 1, -1, -2, 1, -0, -2, 3, 0, 0, 0, -2, 0, -1, -1, -1, 0, -1, -1, -2, -1, 0, -2, -1, 0, -1, 0, 0, -0, 1, -1, 0, 0, -3, 0, 0, -1, 0, -1, 1, -1, 0, -1, -1, 0, -2, -1, 0, -1, -2, -1, -2, -1, -1, -1, -1, 1, -2, 1, -1, 0, 1, 0, -2, 0, 0, -3, 2, -2, -1, 0, -1, 0, 1, -1, -3, 1, -1, -2, 1, -3, 0, 1, -1, 0, 0, -2, 1, 0, -2, 0, -1, -1, 0, -2, -1, -1, --1, 0, -1, -1, 0, 0, -2, 1, -1, -1, 0, -1, 1, -1, 0, -1, 1, -1, -3, 1, -1, 0, --1, 0, 0, 0, 0, -2, -1, -1, 1, -3, -1, 2, -1, 0, -1, 0, 0, -2, -1, 1, -1, 0, -1, --2, 1, -1, -2, 0, 0, -1, -2, -2, 1, 1, -1, -2, 1, 0, -2, 0, 0, 0, 0, -2, 0, 1, --1, 0, -1, 0, -2, -1, -1, 1, 0, -1, 0, -1, 0, -1, -2, 1, -1, -2, 1, 0, 1, 0, -1, -0, 0, -2, -1, 1, -1, 0, -1, 0, 0, -1, -1, -1, 1, -3, -1, 0, 0, 0, -1, 1, 1, 0, --3, 0, 0, -1, 0, -1, 1, -1, 0, -1, 1, 1, -3, -2, 0, 0, 0, -1, 0, 1, -2, -2, -1, -0, -1, -1, -1, 1, 0, -1, 1, -1, 0, -1, -1, -2, 1, -2, 0, 1, -1, 1, -1, 0, -1, 0, --1, 0, 0, -1, 1, -1, 1, 0, -1, -2, 0, 0, -3, 0, -1, 1, -1, -2, 0, -1, 0, -1, -1, -0, -1, 0, 0, 1, -1, 1, -1, -2, 1, -2, 0, 0, -1, 0, 0, -1, -1, 1, -2, -2, 0, -1, -0, -1, 0, -1, 0, -1, -1, -1, -1, 0, -1, 1, 0, 0, 0, -1, -1, 0, 1, -1, 0, 0, -1, -0, -1, 0, 0, -1, -2, 0, -1, -1, 0, -1, 1, 0, -1, 0, -1, -2, 0, 0, -1, 0, -1, -1, -0, -1, -1, -2, 0, 1, -1, -1, 0, 0, 0, -1, 0, 0, 0, -1, -1, 0, -1, 0, -1, -1, -1, --1, 0, 1, -1, -2, 1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -1, 1, 0, 0, 0, -1, -1, 0, --2, 0, -1, 0, 1, -2, -1, -1, 0, 0, -3, 1, 0, -1, 0, 0, 0, -2, 0, -2, 1, -1, -2, -1, 0, 0, -2, 0, 1, -2, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 0, -1, 0, -1, 0, 0, -1, -1, 0, 0, -1, 0, -2, 0, -1, 0, -1, 1, 0, -2, -2, 0, 0, -3, -1, 0, -1, 0, 0, --1, 0, }; - - #endif /* hihato_H_ */ diff --git a/PolyDrums_v0_1_3_DelayLPF/kick909.h b/PolyDrums_v0_1_3_DelayLPF/kick909.h deleted file mode 100644 index 3ddf8cd..0000000 --- a/PolyDrums_v0_1_3_DelayLPF/kick909.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef kick909_H_ -#define kick909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define kick909_NUM_CELLS 2048 -#define kick909_SAMPLERATE 16384 - -const char __attribute__((progmem)) kick909_DATA [] = {-1, 0, -1, 0, -1, 0, 0, -0, 0, 0, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, -1, -2, -2, -3, -3, -2, -2, -2, -1, -1, --1, -1, 0, 0, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 8, 9, 9, 10, 14, 17, -20, 24, 29, 50, 57, 49, 53, 54, 53, 53, 54, 53, 53, 53, 52, 51, 50, 48, 46, 45, -44, 42, 40, 38, 35, 33, 30, 26, 23, 19, 15, 12, 8, 5, 1, -2, -6, -9, -11, -13, --16, -17, -18, -20, -22, -23, -24, -24, -25, -26, -27, -27, -27, -27, -28, -28, --28, -28, -27, -27, -27, -26, -25, -24, -24, -23, -21, -20, -19, -17, -15, -13, --12, -10, -8, -5, -3, -1, 1, 3, 6, 8, 10, 12, 14, 17, 19, 21, 24, 25, 28, 30, -32, 33, 35, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, -40, 40, 39, 38, 38, 37, 37, 36, 36, 35, 34, 33, 32, 32, 30, 29, 28, 26, 24, 22, -20, 18, 17, 15, 13, 11, 9, 8, 6, 5, 3, 1, -1, -2, -4, -5, -7, -8, -9, -11, -13, --14, -16, -17, -18, -19, -20, -21, -22, -24, -25, -25, -26, -27, -27, -28, -29, --29, -30, -30, -30, -30, -31, -31, -31, -31, -31, -32, -31, -32, -32, -32, -32, --32, -32, -32, -32, -32, -32, -32, -32, -31, -31, -31, -30, -30, -30, -29, -28, --28, -27, -27, -26, -26, -25, -25, -24, -23, -22, -21, -20, -20, -19, -18, -17, --16, -15, -14, -13, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, 0, 1, 2, 3, 4, 6, -6, 8, 9, 10, 11, 12, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 27, -28, 29, 30, 30, 31, 32, 33, 33, 34, 34, 34, 34, 35, 35, 35, 36, 36, 36, 36, 36, -36, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 36, -36, 35, 35, 35, 34, 34, 34, 33, 33, 32, 32, 32, 32, 31, 31, 30, 30, 29, 29, 28, -28, 27, 27, 26, 25, 25, 24, 23, 23, 21, 21, 20, 19, 18, 17, 16, 15, 14, 12, 11, -10, 9, 8, 7, 7, 6, 5, 4, 3, 2, 1, 0, -2, -3, -4, -4, -5, -6, -7, -8, -8, -9, --10, -11, -12, -12, -13, -14, -15, -16, -16, -17, -18, -19, -20, -20, -21, -22, --23, -23, -24, -25, -25, -26, -26, -27, -27, -28, -29, -29, -29, -30, -30, -31, --31, -32, -32, -32, -32, -33, -33, -33, -33, -33, -33, -34, -34, -34, -34, -34, --34, -34, -34, -34, -34, -34, -34, -34, -35, -35, -35, -35, -35, -35, -35, -35, --35, -35, -35, -35, -34, -34, -34, -34, -33, -33, -33, -33, -33, -32, -32, -32, --32, -31, -31, -31, -31, -31, -30, -30, -30, -29, -29, -29, -28, -28, -28, -27, --27, -26, -26, -25, -25, -24, -24, -23, -23, -22, -21, -21, -20, -19, -19, -18, --17, -17, -16, -15, -14, -14, -13, -12, -12, -11, -10, -9, -9, -8, -7, -6, -5, --5, -4, -3, -2, -1, -1, 0, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 12, 13, -14, 15, 16, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, -29, 29, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 32, 33, 33, 34, 34, 34, 34, -34, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, -35, 35, 35, 35, 35, 35, 35, 35, 35, 34, 34, 34, 34, 33, 33, 32, 33, 33, 32, 32, -32, 31, 31, 31, 31, 30, 30, 30, 29, 29, 29, 28, 28, 28, 27, 27, 26, 26, 26, 25, -25, 24, 24, 23, 22, 22, 21, 20, 20, 19, 18, 17, 17, 16, 15, 14, 13, 12, 11, 11, -10, 9, 8, 7, 6, 5, 4, 4, 3, 2, 1, 0, -1, -1, -2, -3, -4, -5, -5, -6, -7, -8, -9, --9, -10, -11, -12, -12, -13, -14, -14, -15, -16, -17, -17, -18, -19, -19, -20, --21, -21, -22, -23, -23, -24, -24, -25, -26, -26, -27, -27, -28, -28, -29, -30, --30, -30, -31, -31, -32, -32, -32, -33, -33, -33, -34, -34, -34, -34, -34, -35, --35, -35, -35, -35, -35, -35, -35, -36, -36, -36, -36, -36, -36, -36, -36, -36, --36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, --35, -35, -35, -35, -35, -34, -34, -34, -34, -34, -33, -33, -33, -33, -32, -32, --32, -32, -31, -31, -31, -31, -30, -30, -30, -29, -29, -29, -28, -28, -27, -27, --26, -26, -26, -25, -24, -24, -23, -23, -22, -21, -21, -20, -19, -19, -18, -17, --17, -16, -15, -15, -14, -13, -12, -12, -11, -10, -9, -9, -8, -7, -6, -6, -5, --4, -3, -3, -2, -1, 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 11, 11, 12, 13, -14, 15, 15, 16, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 25, 26, 26, 27, 28, -28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 33, 32, -33, 33, 34, 33, 33, 32, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, -34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 33, 33, 32, 33, 33, 32, 32, 32, 32, 31, -31, 31, 31, 30, 30, 30, 29, 29, 29, 29, 28, 28, 28, 27, 27, 26, 26, 26, 25, 25, -24, 24, 23, 23, 22, 22, 21, 20, 20, 19, 18, 18, 17, 16, 15, 14, 13, 12, 12, 11, -10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 0, -1, -2, -3, -3, -4, -5, -6, -7, -7, -8, -9, --10, -10, -11, -12, -12, -13, -14, -14, -15, -15, -16, -17, -17, -18, -18, -19, --19, -20, -20, -21, -21, -22, -22, -23, -23, -24, -24, -25, -25, -25, -26, -26, --27, -27, -27, -27, -28, -28, -28, -28, -29, -29, -29, -29, -29, -29, -29, -29, --29, -29, -29, -30, -30, -30, -30, -30, -29, -29, -29, -29, -29, -29, -29, -29, --29, -29, -29, -29, -29, -29, -29, -29, -29, -28, -28, -28, -28, -28, -28, -28, --28, -27, -27, -27, -27, -27, -26, -26, -26, -26, -26, -25, -25, -25, -25, -25, --24, -24, -24, -24, -23, -23, -23, -23, -23, -22, -22, -22, -21, -21, -21, -21, --20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -15, -15, --15, -14, -14, -13, -13, -13, -12, -12, -12, -11, -11, -10, -10, -10, -9, -9, --8, -8, -8, -7, -7, -7, -6, -6, -5, -5, -5, -4, -4, -4, -3, -3, -3, -2, -2, -1, --1, -1, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, -7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, -6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, -2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, -3, --4, -4, -4, -4, -4, -5, -5, -5, -5, -6, -6, -6, -6, -6, -6, -7, -7, -7, -7, -7, --8, -8, -8, -8, -8, -8, -8, -9, -9, -9, -9, -9, -9, -9, -9, -10, -10, -10, -10, --10, -10, -10, -10, -10, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -12, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -10, -10, --10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -9, -9, --9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -8, -8, -8, -8, -8, -8, -8, --8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -6, --6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, --3, -2, -3, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, }; - - #endif /* kick909_H_ */ diff --git a/PolyDrums_v0_1_3_DelayLPF/snare909.h b/PolyDrums_v0_1_3_DelayLPF/snare909.h deleted file mode 100644 index d42b2e3..0000000 --- a/PolyDrums_v0_1_3_DelayLPF/snare909.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef snare909_H_ -#define snare909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define snare909_NUM_CELLS 2048 -#define snare909_SAMPLERATE 16384 - -const char __attribute__((progmem)) snare909_DATA [] = {0, -1, 0, -1, 0, -1, 0, --1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, --1, 0, 0, -2, -2, 0, -2, -1, -3, -2, 4, -3, -7, -2, 1, -7, 6, -3, -2, -6, -8, 8, --6, 0, -3, -1, -7, 0, -4, -11, -2, 3, -7, -9, 19, -1, 33, 43, 22, 60, 57, 49, -58, 55, 68, 65, 62, 60, 60, 69, 64, 61, 57, 58, 43, 50, 39, 37, 27, 17, 21, 15, -11, -2, -6, -12, -6, -23, -7, -22, -30, -22, -25, -27, -26, -31, -31, -21, -18, --8, -18, -4, 3, 1, 8, 12, 12, 19, 14, 42, 28, 21, 43, 45, 49, 46, 46, 43, 55, -44, 47, 44, 30, 46, 34, 38, 42, 24, 34, 27, 45, 23, 28, 38, 35, 36, 23, 30, 28, -40, 23, 32, 35, 29, 31, 31, 30, 28, 30, 30, 12, 13, 18, 8, 7, -2, 5, 6, -1, -7, --5, -9, -10, -11, -13, -17, -22, -25, -24, -24, -33, -28, -24, -30, -20, -28, --41, -28, -29, -26, -27, -37, -26, -29, -32, -20, -31, -26, -15, -20, -9, -14, --15, -12, -6, -7, -3, 8, 6, 15, 16, 12, 21, 30, 25, 35, 35, 29, 46, 44, 38, 49, -34, 48, 44, 44, 55, 38, 50, 41, 52, 43, 43, 53, 44, 56, 46, 39, 41, 44, 42, 42, -44, 41, 43, 35, 38, 39, 26, 30, 36, 31, 27, 26, 21, 20, 15, 9, 8, -2, 0, 10, --10, -13, -3, -17, -14, -14, -18, -7, -30, -24, -32, -26, -28, -37, -23, -35, --25, -40, -31, -34, -46, -30, -42, -38, -26, -37, -33, -32, -27, -32, -23, -23, --20, -13, -11, -10, -18, 0, -13, -3, -8, 3, -6, 4, 19, -1, 12, 14, 19, 10, 13, -9, 20, 19, 21, 23, 21, 34, 21, 24, 34, 20, 31, 28, 31, 36, 24, 33, 23, 31, 27, -30, 35, 37, 26, 17, 21, 19, 27, 21, 24, 17, 23, 19, 24, 19, 4, 23, 7, 15, 17, -14, 24, 8, 15, 10, 5, 6, 11, 12, -5, 9, 9, 10, 9, 1, 5, 0, -2, -2, 1, 1, -7, 0, -3, -2, -2, -8, -8, -19, -4, -18, -6, -4, -11, -5, -15, -1, -28, -12, -19, -10, --15, -23, -19, -23, -9, -25, -22, -21, -22, -18, -23, -18, -16, -31, -28, -23, --20, -27, -15, -26, -23, -22, -23, -16, -22, -29, -20, -11, -29, -12, -17, -14, --15, -12, -16, -22, -21, -8, -11, -16, -8, -13, -12, -8, -15, -14, -9, -14, -2, --13, 3, -9, -12, 9, 3, 0, 7, -3, 0, 9, 2, 9, 7, 5, 4, 18, 12, 3, 14, 17, 16, 19, -14, 6, 21, 24, 23, 18, 24, 18, 11, 25, 25, 20, 24, 22, 5, 27, 20, 13, 25, 28, -17, 19, 11, 14, 24, 10, 23, 10, 23, 19, 16, 9, 14, 9, 14, 17, 6, 13, 8, 11, -1, -17, 9, 0, 6, 4, -1, 3, -12, -10, -4, -12, -9, -14, -5, -24, -11, -14, -21, -16, --13, -18, -30, -17, -29, -25, -21, -21, -29, -30, -15, -34, -30, -21, -29, -25, --26, -28, -36, -27, -30, -28, -25, -21, -11, -31, -18, -21, -12, -12, -12, -13, --17, -15, -17, 0, -21, -9, 3, -3, -1, -7, 2, -3, 3, 3, -9, 13, 8, 5, -3, 9, 13, -3, 18, 6, 13, 13, 15, 12, 7, 10, 14, 12, 11, 3, 12, 15, 17, 6, 7, 26, -1, 16, -19, 8, 16, 12, 15, 1, 10, 20, 7, 7, 8, 17, 1, 3, 12, 8, 7, 10, 9, -4, 1, -3, 5, -1, 0, 1, 4, 3, -6, 1, -2, -2, -10, -7, -1, -3, -4, -19, 0, -10, -13, -4, -15, --8, -4, -13, -24, -10, -8, -13, -10, -11, -24, -14, -18, -6, -9, -24, -20, -10, --12, -18, -11, -14, -13, -18, -17, -28, -8, -27, -20, -14, -15, -11, -18, -9, --16, -15, -17, -16, -6, -13, -17, 3, -25, -1, -11, -4, -6, -8, -5, -14, 0, -11, -5, -3, 0, 0, -1, -12, 0, -2, -5, 6, 5, 4, 4, -11, 2, 3, -4, 12, 1, 5, -2, 3, -3, -0, 2, 6, 7, -7, 2, 1, 6, 5, -2, 0, 2, 1, 9, 1, 9, -5, -6, 7, -2, 5, -3, 16, -1, -1, 2, 4, 10, -3, 17, -2, 6, 7, 2, 9, -2, 1, -6, 10, -5, -1, 3, -8, 11, -6, 7, --1, -7, 2, -3, -6, 1, -3, -11, -3, -3, -7, -12, -4, -7, -10, -9, -18, -6, -11, --20, -3, -12, -6, -10, -24, -9, -16, -18, -9, -18, -20, -11, -9, -15, -24, -10, --20, -27, -13, -14, -13, -19, -18, -23, -21, -17, -14, -22, -15, -21, -19, -14, --19, -11, -15, -15, -17, -17, -18, -12, -12, -12, -8, -10, -17, -9, -14, -3, -5, --10, -9, -10, -8, -10, 7, -5, -3, 0, -2, 3, -3, 6, -6, -7, -1, 3, 5, 1, 4, -12, -8, 5, -1, 11, 6, -4, 3, 6, -1, 10, 1, 7, 2, 7, 6, -6, 2, 3, 3, 1, 6, 0, -3, 5, -5, 7, 1, -3, -2, -2, 6, 2, -3, 0, 3, 4, -4, 2, -5, -1, -2, -4, 0, -8, -8, -5, 2, --9, -6, -1, -2, -9, -6, -12, 1, -10, -14, -9, -13, -10, -10, -9, -10, -7, -17, --3, -13, -7, -12, -15, -16, -10, -9, -16, -7, -11, -11, -13, -14, -9, -11, -16, --17, -12, -10, -16, -10, -11, -14, -4, -14, -17, -7, -12, -6, -16, -2, -7, -9, --10, -9, -5, -18, 1, -8, 0, 1, -9, -16, -4, -3, -6, 4, -9, -2, -10, 0, 1, -10, -3, -1, -3, -2, -4, 0, 3, -3, 0, -1, 0, 2, -4, 2, -3, -8, 0, -5, 5, -7, -4, 3, --9, 6, -10, 5, 1, -4, 2, -8, 2, -6, 2, -1, 2, -2, -6, 1, -6, -5, -3, 7, -8, -5, -2, -7, -1, -8, 3, 0, 0, 1, -6, -3, -5, -3, -3, -9, -6, 1, -7, -5, -3, -3, -6, --11, -5, -1, -8, -15, -1, -8, -8, 0, -13, -9, 0, -14, -10, -9, -9, -11, -3, -11, --14, -7, -5, -4, -12, -18, -16, -2, -19, -7, -13, -5, -12, -10, -6, -23, -4, --10, -11, -8, -10, -14, -12, -5, -14, -13, -3, -8, -16, -10, -8, -15, -6, -13, --10, -11, -8, -6, -12, -9, -8, -10, -10, -8, -4, -13, -5, -6, -11, 2, -14, -2, --6, -7, -1, -11, 1, -4, -9, 3, -3, 2, -8, -1, -2, -7, -1, 0, 4, -3, 3, -7, 2, --3, -1, 1, -3, -2, -1, 7, -4, 1, -2, -2, -4, -3, 8, -9, 1, -1, -3, 4, -6, 3, 3, -0, -1, -5, -7, -2, 1, -4, 3, 0, -9, 0, -4, 4, -5, -4, 1, -3, -4, -5, -3, -7, -8, --7, 2, -9, -8, -2, -7, -3, -10, -6, -4, -12, -6, -10, -7, -10, -10, -5, -11, -3, --7, -13, -10, -8, -6, -15, -7, -7, -11, -9, -11, -8, -10, -11, -8, -6, -12, -8, --10, -8, -6, -10, -7, -8, -7, -8, -11, -3, -4, -5, -6, -12, -8, -6, -6, -3, -6, --6, -6, -2, 1, -12, -5, -4, -6, -1, -1, -7, -5, -4, -3, 1, -6, 2, -6, 0, -5, -9, -4, -7, -2, 2, -3, 1, -3, -4, -4, -1, -2, -4, 3, -5, -2, -3, -4, -1, -4, 1, -1, --10, 1, 0, -9, 2, -3, -6, -2, 6, -5, -6, -2, -3, -3, -4, -4, -6, -1, -5, -6, -1, --2, -9, -1, -2, -5, -3, 0, -5, -7, -5, -8, -1, -7, -6, -4, -2, -6, -7, -7, -8, --5, 0, -4, -12, -4, -10, -3, -4, -11, -3, -6, -6, -6, -9, -7, -9, -7, -5, -7, --2, -10, -10, -3, -10, -5, -7, -10, -6, -12, -6, -9, -4, -7, -8, -5, -12, -6, --5, -4, -9, -4, -7, -5, -5, -8, -7, -7, -9, -7, -5, -11, -3, -6, -3, -5, -8, -4, --3, -6, -8, -6, -5, -4, -5, -6, -2, -6, -6, -2, -5, -3, -4, -5, -7, -3, -2, -2, --2, -9, 1, -3, -8, 0, -3, 0, -5, -3, -2, -1, 0, -3, -3, -4, 1, -2, -8, 3, -1, --5, 1, 0, -3, -4, -4, -1, 0, -3, 2, -6, -1, -3, -6, 2, -4, -3, -3, -1, -1, -5, --3, 0, 0, -6, -1, -4, -5, -3, 0, -1, -4, -8, -4, 0, -9, 0, -4, -5, -4, -1, -5, --6, -4, -6, -3, -6, -6, -9, -4, -4, -7, -4, -3, -10, -6, -6, -5, -5, -8, -5, -9, --5, -6, -5, -6, -9, -8, -4, -5, -10, -3, -7, -6, -6, -4, -6, -9, -4, -6, -2, -7, --2, -3, -7, -4, -7, -3, -5, -3, -4, -7, -4, -3, -3, -2, -1, -5, -4, -3, -4, -3, --3, -2, -3, -1, -3, -7, 0, -3, 2, -1, -5, -3, -1, -3, -5, 1, -8, 2, -5, 0, -1, --6, -1, -2, 2, -5, -1, -1, -2, -2, -1, -6, 0, -5, -2, 0, -5, -2, -4, 1, -5, -4, --2, 0, -5, -3, 0, -5, -1, -2, -3, -3, -4, -2, -3, -3, -5, -4, -2, -6, -3, -6, --4, -3, -6, -3, -2, -5, -5, -5, -4, -5, -3, -3, -8, -2, -6, -3, -4, -9, -1, -8, --4, -4, -7, -2, -6, -3, -5, -4, -3, -5, -3, -8, -4, -8, -5, -3, -8, -1, -7, -2, --4, -6, -5, -3, -4, -3, -4, -4, -1, -5, -2, -5, -2, -3, -4, -3, -5, -2, -4, -1, --4, -4, -1, -3, -1, -4, -4, -3, -2, -3, -1, -3, -5, -2, -1, -3, -2, 0, -4, -2, --3, -4, -2, -3, -2, -2, -1, -3, -4, -2, -3, -2, -3, 0, -5, -2, -1, -3, -1, -2, --1, -5, -2, -1, -2, -2, -2, -1, -2, -2, -3, -2, -4, -2, -1, -3, -2, -2, -2, -2, --1, -4, -4, -1, -3, -2, -1, -6, -1, -4, -4, -2, -5, -1, -4, -1, -4, -4, -2, -3, --4, -2, -4, -4, -3, -4, -1, -5, -5, -3, -3, -4, -4, -5, -3, -3, -6, -4, -4, -3, --4, -4, -3, -4, -3, -5, -5, -4, -6, -2, -6, -3, -4, -4, -3, -5, -2, -5, -5, -3, --3, -4, -4, -4, -2, -3, -4, -4, -4, -2, -3, -3, -3, -3, -3, -2, -2, -4, -1, -2, --3, -1, -3, -1, -2, -3, -3, -1, -4, -3, -1, -2, -2, -1, -2, -2, -2, -3, -1, -2, --1, -1, -3, -2, -1, -2, -2, -2, -1, -1, -1, -2, -2, -1, -2, -1, -2, -2, -1, -2, --2, -2, -1, -2, -2, -1, -2, -2, -1, -2, -2, -2, -2, -1, -2, -3, -2, -2, -2, -2, --2, -2, -2, -2, -3, -3, -2, -2, -3, -2, -3, -3, -3, -3, -2, -3, -2, -3, -3, -3, --3, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -3, -3, -3, --3, -3, -3, -3, -3, -3, -2, -3, -3, -2, -3, -2, -2, -2, -2, -2, -3, -2, -2, -3, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --1, -2, -2, -2, -2, -1, -2, -1, -1, -2, -2, -1, -2, -1, -2, -2, -2, -2, -1, -2, --2, -2, -2, -1, -1, -2, -1, -2, -1, -2, -2, -1, -1, -1, -2, -1, -2, -1, -2, -1, --1, -2, -1, -1, -1, -1, -1, -1, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, }; - - #endif /* snare909_H_ */ diff --git a/PolyDrums_v0_1_5_DelayNoLPF/ADSRslow.h b/PolyDrums_v0_1_5_DelayNoLPF/ADSRslow.h deleted file mode 100644 index e4d6813..0000000 --- a/PolyDrums_v0_1_5_DelayNoLPF/ADSRslow.h +++ /dev/null @@ -1,309 +0,0 @@ -/* - * ADSRslow.h - * - * Copyright 2012 Tim Barrass. - * - tiny modification by Dave Green in setPhase for calling at Control Rate - - * This file is part of Mozzi. - * - * Mozzi is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Mozzi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Mozzi. If not, see <http://www.gnu.org/licenses/>. - * - */ - -#ifndef ADSR_H_ -#define ADSR_H_ - -#include "Arduino.h" -//#include <util/atomic.h> -#include "Line.h" -#include "mozzi_fixmath.h" - -/** A simple ADSR envelope generator. -@todo Test whether using the template parameter makes any difference to speed, -and rationalise which units which do and don't need them. -Template objects are messy when you try to use pointers to them, -you have to include the whole template shebang in the pointer handling. -*/ -template <unsigned int CONTROL_UPDATE_RATE> -class ADSR -{ -private: - - const unsigned int AUDIO_TICKS_PER_CONTROL; - - unsigned int phase_control_step_counter; - unsigned int phase_num_control_steps; - - enum {ATTACK,DECAY,SUSTAIN,RELEASE,IDLE}; - - - struct phase{ - byte phase_type; - unsigned int control_steps; - unsigned long audio_steps; - Q8n0 level; - }attack,decay,sustain,release,idle; - - phase * current_phase; - - // Linear audio rate transitions for envelope - Line <unsigned long> transition; - - inline - unsigned int convertMsecToControlSteps(unsigned int msec){ - return (uint) (((ulong)msec*CONTROL_UPDATE_RATE)>>10); // approximate /1000 with shift - } - - inline - void setPhase(phase * next_phase) { - phase_control_step_counter = 0; - phase_num_control_steps = next_phase->control_steps; - transition.set(Q8n0_to_Q16n16(next_phase->level),next_phase-> control_steps); -// Dave G: divide by control_steps rather than audio_steps to call at Control Rate instead! - current_phase = next_phase; - } - - - - inline - void checkForAndSetNextPhase(phase * next_phase) { - if (++phase_control_step_counter >= phase_num_control_steps){ - setPhase(next_phase); - } - } - - - inline - void checkForAndSetIdle() { - if (++phase_control_step_counter >= phase_num_control_steps){ - transition.set(0,0,1); - current_phase = &idle; - } - } - - - -inline - void setTime(phase * p, unsigned int msec) - { - p->control_steps=convertMsecToControlSteps(msec); - p->audio_steps = (ulong) p->control_steps * AUDIO_TICKS_PER_CONTROL; - } - - -public: - - /** Constructor. - */ - ADSR():AUDIO_TICKS_PER_CONTROL(AUDIO_RATE/CONTROL_UPDATE_RATE) - { - attack.phase_type = ATTACK; - decay.phase_type = DECAY; - sustain.phase_type = SUSTAIN; - release.phase_type = RELEASE; - idle.phase_type = IDLE; - release.level = 0; - } - - -/** Updates the internal controls of the ADSR. - Call this in updateControl(). - */ - void update(){ // control rate - - switch(current_phase->phase_type) { - - case ATTACK: - checkForAndSetNextPhase(&decay); - break; - - case DECAY: - checkForAndSetNextPhase(&sustain); - break; - - case SUSTAIN: - checkForAndSetNextPhase(&release); - break; - - case RELEASE: - checkForAndSetIdle(); - break; - - } - } - - /** Advances one audio step along the ADSR and returns the level. - Call this in updateAudio(). - @return the next value, as an unsigned int. - */ - inline - unsigned int next() - { - return Q16n16_to_Q16n0(transition.next()); - } - - - - /** Start the attack phase of the ADSR. THis will restart the ADSR no matter what phase it is up to. - */ - inline - void noteOn(){ - setPhase(&attack); - } - - - - /** Start the release phase of the ADSR. - @todo fix release for rate rather than steps (time), so it releases at the same rate whatever the current level. - */ - inline - void noteOff(){ - setPhase(&release); - } - - - - - - /** Set the attack level of the ADSR. - @param value the attack level. - */ - inline - void setAttackLevel(byte value) - { - attack.level=value; - } - - - - /** Set the decay level of the ADSR. - @param value the decay level. - */ - inline - void setDecayLevel(byte value) - { - decay.level=value; - } - - - /** Set the sustain level of the ADSR. - @param value the sustain level. Usually the same as the decay level, - for a steady sustained note. - */ - inline - void setSustainLevel(byte value) - { - sustain.level=value; - } - - /** Set the release level of the ADSR. Normally you'd make this 0, - but you have the option of some other value. - @param value the release level (normally 0). - */ - inline - void setReleaseLevel(byte value) - { - release.level=value; - } - - - - /** Set the attack and decay levels of the ADSR. This assumes a conventional - ADSR where the sustain continues at the same level as the decay, till the release ramps to 0. - @param attack the new attack level. - @param value the new sustain level. - */ - inline - void setADLevels(byte attack, byte decay) - { - setAttackLevel(attack); - setDecayLevel(decay); - setSustainLevel(decay); - setReleaseLevel(0); - } - - - - - - - - /** Set the attack time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - @param value the unsigned int attack time in milliseconds. - */ - inline - void setAttackTime(unsigned int msec) - { - setTime(&attack, msec); - } - - - /** Set the decay time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - @param value the unsigned int decay time in milliseconds. - */ - inline - void setDecayTime(unsigned int msec) - { - setTime(&decay, msec); - } - - - /** Set the sustain time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - The sustain phase will finish if the ADSR recieves a noteOff(). - @param value the unsigned int sustain time in milliseconds. - */ - inline - void setSustainTime(unsigned int msec) - { - setTime(&sustain, msec); - } - - - - /** Set the release time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - @param value the unsigned int release time in milliseconds. - */ - inline - void setReleaseTime(unsigned int msec) - { - setTime(&release, msec); - } - - - - /** Set the attack, decay and release times of the ADSR in milliseconds. - The actual times will be resolved within the resolution of CONTROL_RATE. - @param attack_ms the new attack time in milliseconds. - @param decay_ms the new decay time in milliseconds. - @param decay_ms the new sustain time in milliseconds. - @param release_ms the new release time in milliseconds. - */ - inline - void setTimes(unsigned int attack_ms, unsigned int decay_ms, unsigned int sustain_ms, unsigned int release_ms) - { - setAttackTime(attack_ms); - setDecayTime(decay_ms); - setSustainTime(sustain_ms); - setReleaseTime(release_ms); - } - - -}; - -#endif /* ADSR_H_ */ - diff --git a/PolyDrums_v0_1_5_DelayNoLPF/PolyDrums_v0_1_5_DelayNoLPF.ino b/PolyDrums_v0_1_5_DelayNoLPF/PolyDrums_v0_1_5_DelayNoLPF.ino deleted file mode 100644 index c2dee16..0000000 --- a/PolyDrums_v0_1_5_DelayNoLPF/PolyDrums_v0_1_5_DelayNoLPF.ino +++ /dev/null @@ -1,504 +0,0 @@ - -/* Example of a sound being triggered by MIDI input. - * - * Demonstrates playing notes with Mozzi in response to MIDI input, - * using the standard Arduino MIDI library: - * http://playground.arduino.cc/Main/MIDILibrary - * - * Mozzi help/discussion/announcements: - * https://groups.google.com/forum/#!forum/mozzi-users - * - * Tim Barrass 2013. - * This example code is in the public domain. - * - * sgreen - modified to use standard Arduino midi library, added saw wave, lowpass filter - * Audio output from pin 9 (pwm) - * Midi plug pin 2 (centre) to Arduino gnd, pin 5 to RX (0) - * http://www.philrees.co.uk/midiplug.htm - * Now with drums! (& still has some LPF code in there, commented out : ) - -NB Needs tweaked ADSRslow.h (probably put this in your usual Mozzi libraries directory along with -the normal ADSR.h, seems less picky about where the drum sounds go) -Note also use of smallest wavetables; there was some sort of note buffering issue when using the 1024 byte versions..?! - -S Green: -mod controller/ribbon was low pass filter cut-off (disabled in this version) -DG Oct 2013: -up/down next to octave switches between square/saw/triangle waves (all 2-note polyphonic, no portamento) -big button switches between backing options, button to the right=other drums on/off, -button to the left toggles delay mode on/off - - */ -#define MAX_NOTES 3 -//Dave G: now seems to do 2+ note polyphony without clicking (higher notes are a bit grainy) -int threshold=255/(MAX_NOTES); - -#include <MIDI.h> -#include <MozziGuts.h> -#include <Oscil.h> // oscillator template -#include <Line.h> // for envelope -#include <Sample.h> -#include <mozzi_utils.h> -#include <mozzi_analog.h> - -#include <tables/square_analogue512_int8.h> // sine table for oscillator -#include <tables/saw512_int8.h> -#include <tables/triangle512_int8.h> - -#include <mozzi_midi.h> -#include <ADSRslow.h> -#include <fixedMath.h> -#include <LowPassFilter.h> -//#include "Wave.h" -#include <WaveShaper.h> -#include <tables/waveshape_compress_512_to_488_int16.h> - -#define DRUM_SAMPLES 1 - -#if DRUM_SAMPLES -#include "kick909.h" -#include "snare909.h" -#include "hihatc909.h" -#include "hihato909.h" -#endif - -// use #define for CONTROL_RATE, not a constant -#define CONTROL_RATE 128 // powers of 2 please - -#define ENABLE_MIDI 1 -#define DEBUG 0 -#define BPM 120 -#define STEPS_PER_BEAT 4 - -unsigned long tickCounter = 0; -unsigned long ticksPerStep = (60*CONTROL_RATE) / (BPM*STEPS_PER_BEAT); - -//Wave myosc; -WaveShaper <int> aCompress(WAVESHAPE_COMPRESS_512_TO_488_DATA); // to compress instead of dividing by 2 after adding signals - -struct Channel { - //Wave osc; - Oscil <TRIANGLE512_NUM_CELLS, AUDIO_RATE> osc; - ADSR <CONTROL_RATE> env; - byte note; - byte gain; -}; -Channel chan[MAX_NOTES]; -byte currentChan = 0; - -// envelope generator -//ADSR <CONTROL_RATE> envelope; -LowPassFilter lpf; -int crushCtrl = 0; -int gain = 32; -float octave = 1.0f; - -boolean enableDrums = true; - -int freeChan=0; -int beat = 0; -int waveType = 0; - -byte delayOn=0; -byte snareOn=1; -byte hatsOn=1; -byte bassOn=1; - -int button0_old = 0; -int button1_old = 0; - -#if DRUM_SAMPLES -// drums -Sample <kick909_NUM_CELLS, AUDIO_RATE> kickSamp(kick909_DATA); -Sample <snare909_NUM_CELLS, AUDIO_RATE> snareSamp(snare909_DATA); -Sample <hihatc909_NUM_CELLS, AUDIO_RATE> hihatcSamp(hihatc909_DATA); -Sample <hihato_NUM_CELLS, AUDIO_RATE> hihatoSamp(hihato_DATA); -#endif - -byte pattern[7][16] = { - //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 hhc - 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, // 1 hho - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, // 2 snare - 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, // 3 kick - 12,0,24,0,12,0,24,0, 12, 0,24,0,12,0,24,0, // 4 bass - 24,0,12,0,24,0,12,0, 34, 0,22,0,29,0,17,0, // 5 bass - 12,0,12,0,14,0,12,0, 15,16,12,0,17,0,16,0, // 6 bass -}; -//bittersweet 0,12,15,12,13,10,13,0, 18,13,18,0, 17,13,17,0, - -// pin defines -#define LED 13 // to see if MIDI is being recieved -#define BUTTON0_PIN 2 -#define BUTTON1_PIN 3 - -// forward declarations -void HandleNoteOn(byte channel, byte note, byte velocity); -void HandleNoteOff(byte channel, byte note, byte velocity); -void HandleControlChange (byte channel, byte number, byte value); -void HandlePitchBend (byte channel, int bend); - -void setup() { - // init IO pins - pinMode(LED, OUTPUT); - -#if 0 - pinMode(BUTTON0_PIN, INPUT); - digitalWrite(BUTTON0_PIN, HIGH); // turn on pull-up resistor - - pinMode(BUTTON1_PIN, INPUT); - digitalWrite(BUTTON1_PIN, HIGH); // turn on pull-up resistor -#endif - -#if DEBUG - Serial.begin(57600); // for debugging -#endif - -#if ENABLE_MIDI - // Initiate MIDI communications, listen to all channels - MIDI.begin(MIDI_CHANNEL_OMNI); - - // Connect the HandleNoteOn function to the library, so it is called upon reception of a NoteOn. - MIDI.setHandleNoteOn(HandleNoteOn); // Put only the name of the function - MIDI.setHandleNoteOff(HandleNoteOff); // Put only the name of the function - MIDI.setHandleControlChange(HandleControlChange); - MIDI.setHandlePitchBend(HandlePitchBend); - MIDI.setHandleContinue(HandleContinue); - MIDI.setHandleStop(HandleStop); - MIDI.setHandleStart(HandleStart); - MIDI.setHandleProgramChange(HandleProgramChange); - -#endif - -#if 0 - //osc.setFreq(440u); // default frequency - //myosc.setFreq(440.0f); - myosc.setFreq(440.0f*4.0f); - myosc.setPulseWidth(32); - - envelope.setADLevels(255, 200); - envelope.setTimes(50, 200, 65535, 5000); -#endif - - for(int i=0; i<MAX_NOTES; i++) - { - // chan[i].osc.setType(WAVE_TRI); - chan[i].osc.setTable(SQUARE_ANALOGUE512_DATA); - //chan[i].osc.setPulseWidth(16); - chan[i].note=128; - chan[i].env.setADLevels(127,127); - chan[i].env.setTimes(10, 10, 20000, 510); -// chan[i].fxenv.setADLevels(255,255); -// chan[i].fxenv.setTimes(10, 10, 0, 2000); - } - - lpf.setResonance(128); - lpf.setCutoffFreq(190); - -#if DRUM_SAMPLES - kickSamp.setFreq((float) kick909_SAMPLERATE / (float) kick909_NUM_CELLS); - snareSamp.setFreq((float) snare909_SAMPLERATE / (float) snare909_NUM_CELLS); - hihatcSamp.setFreq((float) hihatc909_SAMPLERATE / (float) hihatc909_NUM_CELLS); - hihatoSamp.setFreq((float) hihato_SAMPLERATE / (float) hihato_NUM_CELLS); - //snareSamp.start(); -#endif - - //setupFastAnalogRead(); // optional -// adcEnableInterrupt(); // for analog reads - - startMozzi(CONTROL_RATE); -} - -void HandleProgramChange (byte channel, byte number) -{ - // change wave - waveType = (number) % 3; - - for(int i=0; i<MAX_NOTES; i++) - { -#if 1 - switch(waveType) { - case 0: - chan[i].osc.setTable(SQUARE_ANALOGUE512_DATA); - break; - case 1: - chan[i].osc.setTable(SAW512_DATA); - break; - case 2: - chan[i].osc.setTable(TRIANGLE512_DATA); - break; - } -#else - for(int i=0; i<MAX_NOTES; i++) - { - chan[i].osc.setType((WaveType) waveType); - } -#endif - } -} - - -void HandleNoteOn(byte channel, byte note, byte velocity) { - //osc.setFreq(mtof(note)); // simple but less accurate frequency - //osc.setFreq_Q16n16(Q16n16_mtof(Q8n0_to_Q16n16(note))); // accurate frequency - - // start note on next channel - now with v basic "note priority"! -int index; -int empty=99; - -if (0==velocity) {empty=0;} -else { - digitalWrite(LED,HIGH); - for(int i=0; i<MAX_NOTES; i++) - { - index=((currentChan+i)%(MAX_NOTES-hatsOn)+hatsOn); - if (chan[index].gain==0) {empty=index; break;} - } - } - -if (empty==99) // ie all no empty channels found so far? - { - for(int i=0; i<MAX_NOTES; i++) - { - index=((currentChan+i)%(MAX_NOTES-hatsOn)+hatsOn); - if (chan[index].note==128) {empty=index; break;} - } - } - -if (empty<99) {currentChan=empty;} else - { - currentChan = (currentChan + 1) % MAX_NOTES; // add 1, wrap around - } - - chan[currentChan].note = note; - chan[currentChan].osc.setFreq(float(mtof(note))); -// NB this does not seem v accurate frequency (esp low notes), should try alternatives - if (waveType==2) {chan[currentChan].osc.setFreq(float(mtof(note+24)));} //high triangle - chan[currentChan].env.noteOn(); -// chan[currentChan].fxenv.noteOn(); - -} - -void HandleNoteOff(byte channel, byte note, byte velocity) { - //envelope.noteOff(); - - // find which channel was playing this note - for(int i=0; i<MAX_NOTES; i++) { - if (chan[i].note == note) { - // kill it - chan[i].env.noteOff(); - chan[i].note=128; - } - } - - digitalWrite(LED,LOW); -} - -void HandleControlChange (byte channel, byte number, byte value) -{ - // http://www.indiana.edu/~emusic/cntrlnumb.html - switch(number) { - case 1: // modulation wheel - //gain = value*2; - lpf.setCutoffFreq( int(value*1.5f) ); // control messages are in [0, 127] range - lpf.setResonance( int(value*1.4f) ); -// for(int i=0; i<MAX_NOTES; i++) {chan[i].env.setTimes(10, 10, 0, 900+value); } - break; -/* - case 105: - lpf.setCutoffFreq(value*2); // control messages are in [0, 127] range - break; -*/ - case 106: - //lpf.setResonance(value*2); - crushCtrl = value; - break; - } -} - -// pitchbend = control strip + button on Keytar -void HandlePitchBend (byte channel, int bend) -{ - //bend value from +/-8192 - //lfo.setFreq((unsigned int) (bend+8192)>>7); - for(int i=0; i<MAX_NOTES; i++) { -// chan[i].osc.setPulseWidth((bend+8192) >> 8); - } - -} - -void HandleStop () { //this is the Back button on the Xbox keyboard -delayOn=(! delayOn); - for(int i=0; i<MAX_NOTES; i++) - { -if (delayOn) - { - chan[i].env.setTimes(10, 10, 0, 1020); - } - else - { - chan[i].env.setTimes(10, 10, 20000, 510); - } - } -} - -void HandleStart () { //this is the Back button on the Xbox keyboard -// octave *= 2.0f; -// if (octave > 16.0f) octave = 1.0f; -//Dave G: no longer used : ) -snareOn=(! snareOn); -} - -void HandleContinue () { // the big round button on all keytars -bassOn=(bassOn+1)%4; -if (0==bassOn) {hatsOn=0;} else {hatsOn=1;} -} - -void updateControl(){ -#if ENABLE_MIDI - MIDI.read(); -#endif - - //envelope.update(); - - // update playing envelopes - for(int i=0; i<MAX_NOTES; i++) { - chan[i].env.update(); - int tremolo=chan[i].env.next(); -if (delayOn) -{chan[i].gain=(tremolo * (tremolo&0b00011111) )>>5;} -else {chan[i].gain=tremolo;} -//subtler effect: {chan[i].gain=(tremolo + (tremolo&0b00011111) )>>1;} - if (chan[i].gain>threshold) {chan[i].gain=threshold;} - // threshold=255/MAX_NOTES, genuinely not sure if this is best approach but stops crashes :) - } - -#if 0 - // push buttons - int button0 = !digitalRead(BUTTON0_PIN); // active low - int button1 = !digitalRead(BUTTON1_PIN); - - /* - if (button0) { - // trigger - //envelope.noteOn(); - //lpf.reset(); - digitalWrite(LED, HIGH); - } else { - digitalWrite(LED, LOW); beat - } - */ - - if (button0 && !button0_old) { - // lfo.setType((WaveType) ((((int) lfo.getType()) + 1) % 3)); - } - button0_old = button0; - - if (button1 & !button1_old) { - waveType = (waveType + 1) & 3; - //myosc.setType((WaveType) waveType); - for(int i=0; i<MAX_NOTES; i++) - { - chan[i].osc.setType((WaveType) waveType); - } - } - button1_old = button1; -#endif - -#if DRUM_SAMPLES - if (enableDrums) { - // drums - tickCounter++; - if (tickCounter > ticksPerStep) { - beat = (beat+1) & 0xf; - tickCounter = 0; - -//if (beat==0 || beat==8) {HandleNoteOn(1, 48, 128); } - - //semi-perceptible BPM-locked phaser -// int filterlevel=beat; if (beat>7) {filterlevel=15-beat;} -// lpf.setCutoffFreq( (filterlevel+11) <<3 ); //maps to 72-192 -// lpf.setResonance( (filterlevel+10) <<3); - if (hatsOn && pattern[0][beat]) hihatcSamp.start(); - if (hatsOn && pattern[1][beat]) hihatoSamp.start(); - if (snareOn && pattern[2][beat]) snareSamp.start(); - if (snareOn && pattern[3][beat]) kickSamp.start(); - if (bassOn && pattern[bassOn+3][beat]) { HandleNoteOn(0, pattern[bassOn+3][beat]+24, 0) ;} - } - } -#endif - -#if 0 - // knobs - int knob0 = adcGetResult(0); // [0, 1023] - int knob1 = adcGetResult(1); - //lpf.setCutoffFreq(knob0>>2); - //lpf.setResonance(knob1>>2); - - //crushCtrl = knob1>>7; -// lfo.setFreq((float) knob0); - //myosc.setFreq((float) knob1); - //myosc.setFreq((unsigned int) knob0*20); - //myosc.setPulseWidth((unsigned char) (knob1>>2)); - - // start the next read cycle in the background - adcReadAllChannels(); -#endif - -#if DEBUG - Serial.println(knob0); -#endif -} - -// strip the low bits off! -int bitCrush(int x, int a) -{ - return (x>>a)<<a; -} - -int updateAudio() -{ - //int x = (int) (envelope.next() * osc.next())>>8; - //int x = (int) (envelope.next() * myosc.next())>>8; - //int x = (int) (envelope.next() * (lfo.next() * myosc.next())>>8)>>8; - //int x = (int) lfo.next(); - //int x = (int) (lfo.next() * myosc.next())>>8; - //int x = (int) (envelope.next() * lpf.next(myosc.next()))>>8; - //int x = (envelope.next() * lpf.next(osc.next()))>>8; - //x = bitCrush(x, crushCtrl>>4); - //x = bitCrush(x, crushCtrl); - //x = (x * crushCtrl)>>4; // simple gain - //x = x>>2; - //x = lpf.next(x); - - // sum up channels - int x = hihatcSamp.next() + hihatoSamp.next(); - for(int i=0; i<MAX_NOTES; i++) { - x += (int) (chan[i].gain * chan[i].osc.next())>>8; - } - -//Dave G: helps avoids crashes if goes through some sort of waveshaper here? - x = aCompress.next(256u + x); - - //x = (x*gain)>>8; -// x = lpf.next(x); - -#if DRUM_SAMPLES - if (enableDrums) { - // drums please! - int drums = kickSamp.next() + snareSamp.next() ; - //drums = (drums>>4)<<4; - x += drums; - } -#endif - - return x; -} - - -void loop() { - audioHook(); // required here -} - - - diff --git a/PolyDrums_v0_1_5_DelayNoLPF/hihatc909.h b/PolyDrums_v0_1_5_DelayNoLPF/hihatc909.h deleted file mode 100644 index d52992d..0000000 --- a/PolyDrums_v0_1_5_DelayNoLPF/hihatc909.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef hihatc909_H_ -#define hihatc909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define hihatc909_NUM_CELLS 1024 -#define hihatc909_SAMPLERATE 16384 - -const char __attribute__((progmem)) hihatc909_DATA [] = {1, -2, 1, -2, 2, 0, -4, -13, -18, 2, 3, 3, -1, 4, -9, 7, -5, -2, 4, -22, 23, -7, -8, -2, 7, -5, -8, 12, --4, 7, 7, -21, 12, -3, -18, 8, 1, 4, -20, 4, -5, -4, -2, 0, -2, -7, 3, -3, -3, --4, 3, -9, 12, -5, 20, 2, -25, 19, 0, 8, -12, -6, 4, 0, 15, -7, 8, 19, -9, -6, -0, -1, 0, -3, 12, -12, 7, 9, -18, 2, 4, 1, -7, -4, 7, 2, -3, 0, -3, 1, -2, -4, --4, -11, 7, -8, -2, 11, 2, 8, -1, 4, -3, -1, -2, -9, -6, -3, 3, -9, -9, 4, 1, --5, 1, 5, 0, 2, 2, -3, 9, 6, -7, 3, 5, 0, -2, 0, 7, -3, -2, -2, -3, 4, -2, 2, --3, 2, 0, -14, 4, 3, -4, 0, -5, 3, -2, -9, 3, 0, -1, -1, -5, -1, 5, -4, -6, 7, -1, -2, 2, 0, 4, -1, -7, 1, 3, 3, -1, -1, 6, 1, -2, 0, 3, -5, -9, 1, -1, -2, 0, --2, -1, 2, -1, -7, -2, -1, 1, -1, -4, 7, -5, -4, 5, 1, 1, 1, -2, 3, 2, -4, 0, 1, -3, -3, 1, -2, 0, 2, -1, 2, -2, -2, 0, -4, -3, 3, -3, 0, -1, -3, 2, -3, -6, 6, --2, 0, 1, 2, 0, -2, 2, 1, 1, -5, 1, -3, -2, -4, 3, -2, -2, 0, -2, 2, -4, 1, 4, --4, -1, 1, -1, -1, -2, 2, 1, 1, -4, 5, -4, 0, 1, -4, 3, -2, -1, 3, 0, -3, 0, -1, --1, -1, 0, -4, 3, -1, -3, 2, -1, -1, 0, 0, 1, 1, -1, 1, -2, -1, -1, -4, -1, 4, --1, -2, 1, 0, 1, 0, 0, -1, 1, 0, 0, -1, 1, -3, 0, -1, -3, 2, -2, 1, 0, -2, -3, -1, -1, -3, 1, -1, -2, 1, 1, -2, -1, 0, 0, -2, 0, -1, -2, 2, -1, 0, -2, 1, -2, 0, -0, -4, 1, -1, -2, 1, 0, -2, 0, -2, 3, 0, -2, 1, 0, -1, -1, 1, -1, 0, 0, -1, 0, -0, 0, -2, -1, 0, -1, 0, 0, -2, 0, 0, -2, -2, 0, -1, -1, 1, 0, -2, 0, 1, -1, 1, --1, 0, -1, 0, -1, -1, -1, -2, 1, 0, 0, 0, 0, 0, 0, -2, 0, 0, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, 1, -3, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -2, 0, 0, 0, --2, -1, 1, -1, 0, 0, -1, 0, 0, 0, -1, -2, 0, -2, -1, 0, 0, -1, 0, 0, -2, 0, -1, --1, -1, 0, -1, 0, 0, 0, -1, -1, 0, -1, 0, 0, 0, -2, 0, -1, -1, 0, -1, -1, 0, -1, --1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, -1, 1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -0, -1, -1, 0, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, -0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, --1, 0, 0, -1, 0, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, --1, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, 0, 0, -1, -1, 0, -1, 0, 0, -1, -1, 0, --1, 0, 0, -1, 0, 0, 0, -1, -1, -1, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, 0, --1, 0, -1, 0, 0, -1, -1, 0, 0, -1, -1, -1, 0, 0, 0, -1, -1, -1, -1, 0, -1, 0, 0, --1, -1, 0, 0, 0, -1, 0, -1, -1, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, 0, 0, 0, -1, -1, 0, -1, -1, 0, -1, 0, 0, 0, 0, -1, 0, 0, -1, -0, -1, -1, 0, -1, -1, 0, -1, -1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, --1, 0, -1, -1, -1, 0, 0, 0, -1, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, -1, 0, -1, --1, 0, -1, 0, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, 0, 0, -1, 0, -1, 0, -0, -1, 0, -1, -1, 0, -1, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, --1, 0, 0, -1, -1, 0, -1, -1, 0, -1, 0, 0, -1, -1, -1, 0, -1, -1, 0, 0, 0, 0, 0, --1, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, 0, -1, -1, 0, -1, 0, -1, -1, 0, --1, 0, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, 0, -1, -1, 0, -1, -1, -0, -1, 0, -1, 0, -1, -1, -1, 0, 0, -1, -1, -1, 0, -1, 0, -1, -1, -1, 0, 0, -1, -0, 0, 0, -1, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, 0, -0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, --1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, -0, 0, -1, 0, -1, 0, -1, 0, 0, 0, -1, -1, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, -1, -0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, }; - - #endif /* hihatc909_H_ */ diff --git a/PolyDrums_v0_1_5_DelayNoLPF/hihato909.h b/PolyDrums_v0_1_5_DelayNoLPF/hihato909.h deleted file mode 100644 index a36f866..0000000 --- a/PolyDrums_v0_1_5_DelayNoLPF/hihato909.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef hihato_H_ -#define hihato_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define hihato_NUM_CELLS 2048 -#define hihato_SAMPLERATE 16384 - -const char __attribute__((progmem)) hihato_DATA [] = {0, -1, 0, -1, 0, -1, 0, --1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -2, 4, -4, -1, 3, 1, -8, 7, -2, -9, 3, -1, -1, -3, 0, -2, 4, -3, -4, -1, -3, 3, -2, -5, -1, 2, -1, -3, -1, 4, -2, 4, -3, -2, -4, -1, 6, 0, 8, -5, -5, 2, -2, 2, -2, -2, 7, -4, 6, -11, -6, 11, -6, 1, 4, 0, --14, 11, -6, -1, -2, -8, 5, -13, 1, 0, -8, 2, 7, 3, 1, -8, 5, 2, 2, -2, -8, 11, --1, 0, 2, -1, -3, 2, -3, -9, 2, -4, 6, -3, 1, 9, -7, -3, 2, -2, -2, -13, 2, 9, --3, 4, -3, 4, -6, 3, -1, -7, 13, -5, 3, 1, 1, -5, -13, 1, -2, 8, 0, 2, -4, 6, --1, 2, 3, -12, 4, -16, 0, -7, 2, 0, -3, 10, -6, 6, -3, -9, -2, 11, -7, -7, 11, -9, -3, 1, -1, -5, -6, -4, 2, -11, 8, 2, -4, 14, 0, -9, 7, -4, 6, -2, -10, -3, 1, -4, -12, 10, -1, 1, 0, 2, -3, 0, 5, 0, 5, -6, 0, -1, 0, -8, -3, -1, -1, 1, -3, 3, --3, 4, 8, -12, 0, -2, -7, 9, 2, 3, -6, -1, -4, 2, -7, -5, 12, -4, 7, 0, -2, 3, --1, -2, -3, 1, -3, -1, 2, -1, 2, -8, 1, 7, -8, -3, 1, 5, 4, -3, -3, 1, -3, -13, -2, 0, 1, 2, -13, 4, 4, 4, 0, 6, 2, -6, -9, -5, 12, -3, 1, -10, 10, -1, -7, 3, --2, 9, -18, 0, -5, 11, -4, 0, 6, -13, 3, -13, 14, 3, -5, 0, -3, 3, 1, -2, 1, 7, -5, -8, 6, 0, -8, 2, -3, 4, -6, 1, -14, 7, 8, -10, 7, -11, 10, -8, -13, 13, -3, -1, -2, 4, -4, -2, 0, 0, 8, -8, 2, 3, 5, -2, -1, -1, 4, 1, -13, 2, 2, -3, -5, 2, --1, 2, -2, 0, 0, 4, -6, -5, 6, -1, 2, -5, 1, 10, -8, -7, 8, -6, 6, 3, -15, 2, 0, --8, 6, 5, -4, 2, 0, -6, 5, -2, -4, 2, -3, -1, 5, -2, -2, 0, 1, 4, -8, 2, 4, 0, -0, -2, -1, -3, -1, -5, -3, 6, -18, 5, 10, -6, 10, -3, -4, 3, 1, -11, 4, -3, 5, --2, -7, 7, -5, 3, -4, 4, -3, 3, -3, -2, 6, -2, 4, -5, 5, -3, -9, -3, -4, 1, -2, -5, 2, -2, 7, -4, -5, 3, 0, 2, 2, -5, -2, 6, 5, -11, 3, -6, 2, 0, -3, 5, -4, 5, --6, 7, -11, 4, -3, -5, 1, -8, 4, -11, 17, 1, -3, -6, -2, 7, -2, -1, -5, 13, -5, --8, 1, 5, 3, -10, 5, -5, -4, 7, -7, 8, 5, 1, -2, -8, 7, -8, -2, 2, 1, 4, -5, -5, --2, 10, -10, -2, 1, -8, 0, -2, 5, 8, -4, -2, -4, 0, 4, -4, 1, -2, 5, 0, 8, -2, -1, -2, -4, 3, -6, 3, 0, -2, 2, 2, -5, -1, -7, -3, 1, 2, -6, 3, 0, -5, 6, -6, -1, -4, -2, -9, 4, 1, 3, 3, -2, 2, -1, -5, -2, 8, -1, -4, -6, 7, 2, 0, -3, 1, 2, -2, -1, -7, 5, -9, -2, 3, -4, 3, -1, -8, -3, 1, 0, -7, 5, 3, -3, -7, 2, 6, -2, 3, -7, -8, -7, 2, 1, 3, 7, -6, -1, -1, -2, -3, 5, -6, 3, 1, 0, -2, -1, -6, -5, 1, 3, 2, --4, 2, -2, -1, 0, -1, -3, -2, -5, -3, 3, 4, -1, 8, 0, -2, 0, -5, 1, 2, -3, -2, -8, -4, 0, -5, -2, -1, -3, 0, 5, 3, -8, 0, 0, 7, -7, -2, -1, -3, -3, -1, 1, 7, 5, --7, 1, 1, 4, -4, -3, 2, 5, -2, -6, 1, 1, -3, -7, -1, 3, -8, 3, -1, 2, 6, -11, 4, -1, -2, 0, -2, -3, 6, 6, -6, -1, 1, 2, 1, -1, -2, -1, -1, -5, 3, 0, -1, -1, -7, -0, -5, -1, 4, 0, 6, 0, -3, 1, 6, -5, 0, -3, -7, 6, -2, -2, 1, 5, -4, 4, -7, -4, -6, -3, 1, 0, -1, -4, -5, 2, -2, -5, 3, 1, 4, -1, 0, 1, 4, -1, -5, -1, -6, 2, -4, --1, 2, -1, 1, -4, -2, 0, 1, 2, -1, 0, 2, -2, 0, 4, 0, -4, 1, -5, 1, -2, 1, 4, 0, -2, 1, -3, -9, 0, -1, 2, -6, -2, 4, 1, -1, -4, 1, -1, 0, -3, 1, 1, 1, 0, 0, 6, --1, -8, -2, 1, 0, -2, -2, 5, 1, -3, -2, 5, 0, -3, -5, -8, 2, 1, 1, 0, 2, 2, -4, --1, -2, 2, -5, 0, 6, -4, 5, 0, -4, 1, -4, -8, 6, -3, -4, 4, -3, 3, 0, -1, -2, 1, --2, -2, 1, -2, -1, 0, 3, 1, 2, -1, -2, 0, -5, -1, 0, 7, 2, -4, 0, -2, -1, -2, --1, 0, 1, -4, -3, 5, 2, -2, 2, -4, 2, -6, -6, 6, -1, 4, -2, 0, 1, -1, -1, -1, 2, --3, 2, -5, -1, 4, -2, -1, -2, 2, -4, -5, 1, 2, 3, -1, 4, 1, -3, -2, -2, -2, 0, -2, -5, -2, 2, -1, 4, -4, -5, 3, -7, 2, 3, -3, 1, 2, 1, 1, -2, -3, 2, -4, 1, 0, --1, 4, 1, -4, 2, -3, -3, 2, -7, 0, 4, -1, -2, 1, 1, -7, 4, -1, -1, -1, -6, 3, 4, -0, -1, 1, -4, 3, -5, -3, 4, -2, 1, 0, 0, 1, 0, -2, -2, -2, -3, -2, -1, 0, 3, -1, -0, 0, -1, -1, -4, 1, 1, 1, 2, -2, 2, 0, -2, 0, -3, -2, -2, 0, 2, 1, -1, 0, -1, --2, 0, -3, 1, 1, -2, -3, 1, 0, 0, 1, -1, 1, -4, -1, 1, 3, 0, -1, 0, -1, -1, -4, -1, -1, 1, -1, -1, 3, -3, 0, -1, 2, -3, -2, 1, -3, 2, 2, -2, 0, 1, -6, 1, -1, 0, -3, -2, 0, 2, -2, -4, 1, -2, -2, -2, 2, -2, 2, 0, 0, 3, -2, 1, -2, 0, -3, 0, 1, --1, 0, -1, 2, -4, -2, 1, -4, 2, 0, -2, 1, 3, -2, 0, -1, -2, -3, -2, 1, -1, 0, 1, -4, -2, 2, -2, -4, 1, -3, -2, 1, 0, -2, 0, 0, -1, 0, -2, -2, 1, 0, 1, 0, 2, 1, --4, -2, 0, 0, -4, 1, -2, 1, 1, -4, 5, -1, -1, -2, -3, -1, 0, -3, -1, 4, -2, 0, -1, -1, 0, -2, -1, 2, -2, 1, 2, -1, 2, -1, -2, -1, -2, -5, -1, 1, 0, 0, 1, -2, 0, --1, -2, -1, 1, 0, -4, 1, 0, 1, -1, 2, -2, -4, -1, -1, 4, 0, -2, 0, -1, 0, 0, -5, -1, 1, -3, 0, 0, -2, 3, -1, -2, 3, -5, 0, 2, 0, 0, -2, -2, 1, 2, -6, 0, 1, -1, 1, --3, -1, 3, -2, -3, 2, 0, -3, 0, -2, 2, 1, -4, 2, 1, -2, -2, 1, -1, 4, -4, -4, 2, -2, -1, -1, -1, -4, 2, -3, 2, 2, -2, 0, -1, 0, 2, -3, -2, 2, 0, -4, -1, 1, -2, 2, --2, -1, 0, -2, -1, 1, -1, -1, 3, 0, -1, -1, 0, -1, -2, 1, -1, 1, -1, 2, 1, -1, --2, -1, 0, -5, 1, 0, -1, 2, 0, -2, -3, -1, 1, -2, -1, 1, 0, 1, 1, -2, 2, 0, -3, --1, 0, -2, -1, 2, -1, -1, 2, -3, -1, 2, -3, -2, -1, -1, -1, 1, -2, 1, 1, -1, 0, --2, 0, -2, 1, -1, 1, 1, 0, 0, -2, 0, -2, -1, -4, 0, 1, 0, 1, -1, 0, -1, -4, -2, --1, -1, -1, 0, 1, 2, -1, -3, 1, 0, 0, -1, -1, 0, 1, -3, 0, 2, 0, -2, -4, -1, 1, --1, -2, 2, 2, -1, -1, 0, -2, 1, -3, -3, 2, 0, -1, -1, 2, 1, -1, -2, -1, 0, -1, --2, 0, 1, -1, -2, 0, 2, -3, -1, 0, -2, 1, -1, 0, 3, -1, 0, -1, 0, -1, -1, -2, --1, 1, -1, 1, -3, -1, -1, -1, -1, -1, -1, -3, 2, -2, -1, 1, -1, 1, -2, -2, 1, 1, -0, -1, 1, -1, 0, -2, 1, 2, -3, 0, 0, -1, 0, -1, -2, 1, 0, -4, -1, 1, 0, 2, -3, --1, 1, -1, -2, 1, -1, 2, -1, -2, 1, -2, 0, -2, 0, 1, -2, -1, 0, 2, 0, -2, -1, 0, --1, -2, -1, 1, 3, -3, -2, 0, 0, -1, 0, 0, -1, -1, -3, -1, 1, 0, -2, 0, -1, 0, --2, 0, 0, 1, -1, 0, 1, -1, 3, -2, 0, 0, -3, 0, 2, -2, -1, 2, -1, -1, -1, -2, 0, --2, -2, 0, -1, -3, 0, 0, 0, 0, -3, 0, -1, 0, 0, 0, 1, 1, -1, -3, 0, 0, 0, -1, --3, 0, 1, -2, -1, 2, -2, -1, 0, -4, 1, 0, -2, 1, -1, 1, -1, 0, 0, 0, -1, -1, 0, --1, 1, -1, -1, 1, -1, -1, -2, -1, -1, -2, 0, 1, 0, -1, 1, -1, 0, 1, -1, -2, 1, -0, -2, 3, 0, 0, 0, -2, 0, -1, -1, -1, 0, -1, -1, -2, -1, 0, -2, -1, 0, -1, 0, 0, -0, 1, -1, 0, 0, -3, 0, 0, -1, 0, -1, 1, -1, 0, -1, -1, 0, -2, -1, 0, -1, -2, -1, -2, -1, -1, -1, -1, 1, -2, 1, -1, 0, 1, 0, -2, 0, 0, -3, 2, -2, -1, 0, -1, 0, 1, -1, -3, 1, -1, -2, 1, -3, 0, 1, -1, 0, 0, -2, 1, 0, -2, 0, -1, -1, 0, -2, -1, -1, --1, 0, -1, -1, 0, 0, -2, 1, -1, -1, 0, -1, 1, -1, 0, -1, 1, -1, -3, 1, -1, 0, --1, 0, 0, 0, 0, -2, -1, -1, 1, -3, -1, 2, -1, 0, -1, 0, 0, -2, -1, 1, -1, 0, -1, --2, 1, -1, -2, 0, 0, -1, -2, -2, 1, 1, -1, -2, 1, 0, -2, 0, 0, 0, 0, -2, 0, 1, --1, 0, -1, 0, -2, -1, -1, 1, 0, -1, 0, -1, 0, -1, -2, 1, -1, -2, 1, 0, 1, 0, -1, -0, 0, -2, -1, 1, -1, 0, -1, 0, 0, -1, -1, -1, 1, -3, -1, 0, 0, 0, -1, 1, 1, 0, --3, 0, 0, -1, 0, -1, 1, -1, 0, -1, 1, 1, -3, -2, 0, 0, 0, -1, 0, 1, -2, -2, -1, -0, -1, -1, -1, 1, 0, -1, 1, -1, 0, -1, -1, -2, 1, -2, 0, 1, -1, 1, -1, 0, -1, 0, --1, 0, 0, -1, 1, -1, 1, 0, -1, -2, 0, 0, -3, 0, -1, 1, -1, -2, 0, -1, 0, -1, -1, -0, -1, 0, 0, 1, -1, 1, -1, -2, 1, -2, 0, 0, -1, 0, 0, -1, -1, 1, -2, -2, 0, -1, -0, -1, 0, -1, 0, -1, -1, -1, -1, 0, -1, 1, 0, 0, 0, -1, -1, 0, 1, -1, 0, 0, -1, -0, -1, 0, 0, -1, -2, 0, -1, -1, 0, -1, 1, 0, -1, 0, -1, -2, 0, 0, -1, 0, -1, -1, -0, -1, -1, -2, 0, 1, -1, -1, 0, 0, 0, -1, 0, 0, 0, -1, -1, 0, -1, 0, -1, -1, -1, --1, 0, 1, -1, -2, 1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -1, 1, 0, 0, 0, -1, -1, 0, --2, 0, -1, 0, 1, -2, -1, -1, 0, 0, -3, 1, 0, -1, 0, 0, 0, -2, 0, -2, 1, -1, -2, -1, 0, 0, -2, 0, 1, -2, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 0, -1, 0, -1, 0, 0, -1, -1, 0, 0, -1, 0, -2, 0, -1, 0, -1, 1, 0, -2, -2, 0, 0, -3, -1, 0, -1, 0, 0, --1, 0, }; - - #endif /* hihato_H_ */ diff --git a/PolyDrums_v0_1_5_DelayNoLPF/kick909.h b/PolyDrums_v0_1_5_DelayNoLPF/kick909.h deleted file mode 100644 index 3ddf8cd..0000000 --- a/PolyDrums_v0_1_5_DelayNoLPF/kick909.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef kick909_H_ -#define kick909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define kick909_NUM_CELLS 2048 -#define kick909_SAMPLERATE 16384 - -const char __attribute__((progmem)) kick909_DATA [] = {-1, 0, -1, 0, -1, 0, 0, -0, 0, 0, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, -1, -2, -2, -3, -3, -2, -2, -2, -1, -1, --1, -1, 0, 0, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 8, 9, 9, 10, 14, 17, -20, 24, 29, 50, 57, 49, 53, 54, 53, 53, 54, 53, 53, 53, 52, 51, 50, 48, 46, 45, -44, 42, 40, 38, 35, 33, 30, 26, 23, 19, 15, 12, 8, 5, 1, -2, -6, -9, -11, -13, --16, -17, -18, -20, -22, -23, -24, -24, -25, -26, -27, -27, -27, -27, -28, -28, --28, -28, -27, -27, -27, -26, -25, -24, -24, -23, -21, -20, -19, -17, -15, -13, --12, -10, -8, -5, -3, -1, 1, 3, 6, 8, 10, 12, 14, 17, 19, 21, 24, 25, 28, 30, -32, 33, 35, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, -40, 40, 39, 38, 38, 37, 37, 36, 36, 35, 34, 33, 32, 32, 30, 29, 28, 26, 24, 22, -20, 18, 17, 15, 13, 11, 9, 8, 6, 5, 3, 1, -1, -2, -4, -5, -7, -8, -9, -11, -13, --14, -16, -17, -18, -19, -20, -21, -22, -24, -25, -25, -26, -27, -27, -28, -29, --29, -30, -30, -30, -30, -31, -31, -31, -31, -31, -32, -31, -32, -32, -32, -32, --32, -32, -32, -32, -32, -32, -32, -32, -31, -31, -31, -30, -30, -30, -29, -28, --28, -27, -27, -26, -26, -25, -25, -24, -23, -22, -21, -20, -20, -19, -18, -17, --16, -15, -14, -13, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, 0, 1, 2, 3, 4, 6, -6, 8, 9, 10, 11, 12, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 27, -28, 29, 30, 30, 31, 32, 33, 33, 34, 34, 34, 34, 35, 35, 35, 36, 36, 36, 36, 36, -36, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 36, -36, 35, 35, 35, 34, 34, 34, 33, 33, 32, 32, 32, 32, 31, 31, 30, 30, 29, 29, 28, -28, 27, 27, 26, 25, 25, 24, 23, 23, 21, 21, 20, 19, 18, 17, 16, 15, 14, 12, 11, -10, 9, 8, 7, 7, 6, 5, 4, 3, 2, 1, 0, -2, -3, -4, -4, -5, -6, -7, -8, -8, -9, --10, -11, -12, -12, -13, -14, -15, -16, -16, -17, -18, -19, -20, -20, -21, -22, --23, -23, -24, -25, -25, -26, -26, -27, -27, -28, -29, -29, -29, -30, -30, -31, --31, -32, -32, -32, -32, -33, -33, -33, -33, -33, -33, -34, -34, -34, -34, -34, --34, -34, -34, -34, -34, -34, -34, -34, -35, -35, -35, -35, -35, -35, -35, -35, --35, -35, -35, -35, -34, -34, -34, -34, -33, -33, -33, -33, -33, -32, -32, -32, --32, -31, -31, -31, -31, -31, -30, -30, -30, -29, -29, -29, -28, -28, -28, -27, --27, -26, -26, -25, -25, -24, -24, -23, -23, -22, -21, -21, -20, -19, -19, -18, --17, -17, -16, -15, -14, -14, -13, -12, -12, -11, -10, -9, -9, -8, -7, -6, -5, --5, -4, -3, -2, -1, -1, 0, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 12, 13, -14, 15, 16, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, -29, 29, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 32, 33, 33, 34, 34, 34, 34, -34, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, -35, 35, 35, 35, 35, 35, 35, 35, 35, 34, 34, 34, 34, 33, 33, 32, 33, 33, 32, 32, -32, 31, 31, 31, 31, 30, 30, 30, 29, 29, 29, 28, 28, 28, 27, 27, 26, 26, 26, 25, -25, 24, 24, 23, 22, 22, 21, 20, 20, 19, 18, 17, 17, 16, 15, 14, 13, 12, 11, 11, -10, 9, 8, 7, 6, 5, 4, 4, 3, 2, 1, 0, -1, -1, -2, -3, -4, -5, -5, -6, -7, -8, -9, --9, -10, -11, -12, -12, -13, -14, -14, -15, -16, -17, -17, -18, -19, -19, -20, --21, -21, -22, -23, -23, -24, -24, -25, -26, -26, -27, -27, -28, -28, -29, -30, --30, -30, -31, -31, -32, -32, -32, -33, -33, -33, -34, -34, -34, -34, -34, -35, --35, -35, -35, -35, -35, -35, -35, -36, -36, -36, -36, -36, -36, -36, -36, -36, --36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, --35, -35, -35, -35, -35, -34, -34, -34, -34, -34, -33, -33, -33, -33, -32, -32, --32, -32, -31, -31, -31, -31, -30, -30, -30, -29, -29, -29, -28, -28, -27, -27, --26, -26, -26, -25, -24, -24, -23, -23, -22, -21, -21, -20, -19, -19, -18, -17, --17, -16, -15, -15, -14, -13, -12, -12, -11, -10, -9, -9, -8, -7, -6, -6, -5, --4, -3, -3, -2, -1, 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 11, 11, 12, 13, -14, 15, 15, 16, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 25, 26, 26, 27, 28, -28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 33, 32, -33, 33, 34, 33, 33, 32, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, -34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 33, 33, 32, 33, 33, 32, 32, 32, 32, 31, -31, 31, 31, 30, 30, 30, 29, 29, 29, 29, 28, 28, 28, 27, 27, 26, 26, 26, 25, 25, -24, 24, 23, 23, 22, 22, 21, 20, 20, 19, 18, 18, 17, 16, 15, 14, 13, 12, 12, 11, -10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 0, -1, -2, -3, -3, -4, -5, -6, -7, -7, -8, -9, --10, -10, -11, -12, -12, -13, -14, -14, -15, -15, -16, -17, -17, -18, -18, -19, --19, -20, -20, -21, -21, -22, -22, -23, -23, -24, -24, -25, -25, -25, -26, -26, --27, -27, -27, -27, -28, -28, -28, -28, -29, -29, -29, -29, -29, -29, -29, -29, --29, -29, -29, -30, -30, -30, -30, -30, -29, -29, -29, -29, -29, -29, -29, -29, --29, -29, -29, -29, -29, -29, -29, -29, -29, -28, -28, -28, -28, -28, -28, -28, --28, -27, -27, -27, -27, -27, -26, -26, -26, -26, -26, -25, -25, -25, -25, -25, --24, -24, -24, -24, -23, -23, -23, -23, -23, -22, -22, -22, -21, -21, -21, -21, --20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -15, -15, --15, -14, -14, -13, -13, -13, -12, -12, -12, -11, -11, -10, -10, -10, -9, -9, --8, -8, -8, -7, -7, -7, -6, -6, -5, -5, -5, -4, -4, -4, -3, -3, -3, -2, -2, -1, --1, -1, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, -7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, -6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, -2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, -3, --4, -4, -4, -4, -4, -5, -5, -5, -5, -6, -6, -6, -6, -6, -6, -7, -7, -7, -7, -7, --8, -8, -8, -8, -8, -8, -8, -9, -9, -9, -9, -9, -9, -9, -9, -10, -10, -10, -10, --10, -10, -10, -10, -10, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -12, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -10, -10, --10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -9, -9, --9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -8, -8, -8, -8, -8, -8, -8, --8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -6, --6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, --3, -2, -3, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, }; - - #endif /* kick909_H_ */ diff --git a/PolyDrums_v0_1_5_DelayNoLPF/snare909.h b/PolyDrums_v0_1_5_DelayNoLPF/snare909.h deleted file mode 100644 index d42b2e3..0000000 --- a/PolyDrums_v0_1_5_DelayNoLPF/snare909.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef snare909_H_ -#define snare909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define snare909_NUM_CELLS 2048 -#define snare909_SAMPLERATE 16384 - -const char __attribute__((progmem)) snare909_DATA [] = {0, -1, 0, -1, 0, -1, 0, --1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, --1, 0, 0, -2, -2, 0, -2, -1, -3, -2, 4, -3, -7, -2, 1, -7, 6, -3, -2, -6, -8, 8, --6, 0, -3, -1, -7, 0, -4, -11, -2, 3, -7, -9, 19, -1, 33, 43, 22, 60, 57, 49, -58, 55, 68, 65, 62, 60, 60, 69, 64, 61, 57, 58, 43, 50, 39, 37, 27, 17, 21, 15, -11, -2, -6, -12, -6, -23, -7, -22, -30, -22, -25, -27, -26, -31, -31, -21, -18, --8, -18, -4, 3, 1, 8, 12, 12, 19, 14, 42, 28, 21, 43, 45, 49, 46, 46, 43, 55, -44, 47, 44, 30, 46, 34, 38, 42, 24, 34, 27, 45, 23, 28, 38, 35, 36, 23, 30, 28, -40, 23, 32, 35, 29, 31, 31, 30, 28, 30, 30, 12, 13, 18, 8, 7, -2, 5, 6, -1, -7, --5, -9, -10, -11, -13, -17, -22, -25, -24, -24, -33, -28, -24, -30, -20, -28, --41, -28, -29, -26, -27, -37, -26, -29, -32, -20, -31, -26, -15, -20, -9, -14, --15, -12, -6, -7, -3, 8, 6, 15, 16, 12, 21, 30, 25, 35, 35, 29, 46, 44, 38, 49, -34, 48, 44, 44, 55, 38, 50, 41, 52, 43, 43, 53, 44, 56, 46, 39, 41, 44, 42, 42, -44, 41, 43, 35, 38, 39, 26, 30, 36, 31, 27, 26, 21, 20, 15, 9, 8, -2, 0, 10, --10, -13, -3, -17, -14, -14, -18, -7, -30, -24, -32, -26, -28, -37, -23, -35, --25, -40, -31, -34, -46, -30, -42, -38, -26, -37, -33, -32, -27, -32, -23, -23, --20, -13, -11, -10, -18, 0, -13, -3, -8, 3, -6, 4, 19, -1, 12, 14, 19, 10, 13, -9, 20, 19, 21, 23, 21, 34, 21, 24, 34, 20, 31, 28, 31, 36, 24, 33, 23, 31, 27, -30, 35, 37, 26, 17, 21, 19, 27, 21, 24, 17, 23, 19, 24, 19, 4, 23, 7, 15, 17, -14, 24, 8, 15, 10, 5, 6, 11, 12, -5, 9, 9, 10, 9, 1, 5, 0, -2, -2, 1, 1, -7, 0, -3, -2, -2, -8, -8, -19, -4, -18, -6, -4, -11, -5, -15, -1, -28, -12, -19, -10, --15, -23, -19, -23, -9, -25, -22, -21, -22, -18, -23, -18, -16, -31, -28, -23, --20, -27, -15, -26, -23, -22, -23, -16, -22, -29, -20, -11, -29, -12, -17, -14, --15, -12, -16, -22, -21, -8, -11, -16, -8, -13, -12, -8, -15, -14, -9, -14, -2, --13, 3, -9, -12, 9, 3, 0, 7, -3, 0, 9, 2, 9, 7, 5, 4, 18, 12, 3, 14, 17, 16, 19, -14, 6, 21, 24, 23, 18, 24, 18, 11, 25, 25, 20, 24, 22, 5, 27, 20, 13, 25, 28, -17, 19, 11, 14, 24, 10, 23, 10, 23, 19, 16, 9, 14, 9, 14, 17, 6, 13, 8, 11, -1, -17, 9, 0, 6, 4, -1, 3, -12, -10, -4, -12, -9, -14, -5, -24, -11, -14, -21, -16, --13, -18, -30, -17, -29, -25, -21, -21, -29, -30, -15, -34, -30, -21, -29, -25, --26, -28, -36, -27, -30, -28, -25, -21, -11, -31, -18, -21, -12, -12, -12, -13, --17, -15, -17, 0, -21, -9, 3, -3, -1, -7, 2, -3, 3, 3, -9, 13, 8, 5, -3, 9, 13, -3, 18, 6, 13, 13, 15, 12, 7, 10, 14, 12, 11, 3, 12, 15, 17, 6, 7, 26, -1, 16, -19, 8, 16, 12, 15, 1, 10, 20, 7, 7, 8, 17, 1, 3, 12, 8, 7, 10, 9, -4, 1, -3, 5, -1, 0, 1, 4, 3, -6, 1, -2, -2, -10, -7, -1, -3, -4, -19, 0, -10, -13, -4, -15, --8, -4, -13, -24, -10, -8, -13, -10, -11, -24, -14, -18, -6, -9, -24, -20, -10, --12, -18, -11, -14, -13, -18, -17, -28, -8, -27, -20, -14, -15, -11, -18, -9, --16, -15, -17, -16, -6, -13, -17, 3, -25, -1, -11, -4, -6, -8, -5, -14, 0, -11, -5, -3, 0, 0, -1, -12, 0, -2, -5, 6, 5, 4, 4, -11, 2, 3, -4, 12, 1, 5, -2, 3, -3, -0, 2, 6, 7, -7, 2, 1, 6, 5, -2, 0, 2, 1, 9, 1, 9, -5, -6, 7, -2, 5, -3, 16, -1, -1, 2, 4, 10, -3, 17, -2, 6, 7, 2, 9, -2, 1, -6, 10, -5, -1, 3, -8, 11, -6, 7, --1, -7, 2, -3, -6, 1, -3, -11, -3, -3, -7, -12, -4, -7, -10, -9, -18, -6, -11, --20, -3, -12, -6, -10, -24, -9, -16, -18, -9, -18, -20, -11, -9, -15, -24, -10, --20, -27, -13, -14, -13, -19, -18, -23, -21, -17, -14, -22, -15, -21, -19, -14, --19, -11, -15, -15, -17, -17, -18, -12, -12, -12, -8, -10, -17, -9, -14, -3, -5, --10, -9, -10, -8, -10, 7, -5, -3, 0, -2, 3, -3, 6, -6, -7, -1, 3, 5, 1, 4, -12, -8, 5, -1, 11, 6, -4, 3, 6, -1, 10, 1, 7, 2, 7, 6, -6, 2, 3, 3, 1, 6, 0, -3, 5, -5, 7, 1, -3, -2, -2, 6, 2, -3, 0, 3, 4, -4, 2, -5, -1, -2, -4, 0, -8, -8, -5, 2, --9, -6, -1, -2, -9, -6, -12, 1, -10, -14, -9, -13, -10, -10, -9, -10, -7, -17, --3, -13, -7, -12, -15, -16, -10, -9, -16, -7, -11, -11, -13, -14, -9, -11, -16, --17, -12, -10, -16, -10, -11, -14, -4, -14, -17, -7, -12, -6, -16, -2, -7, -9, --10, -9, -5, -18, 1, -8, 0, 1, -9, -16, -4, -3, -6, 4, -9, -2, -10, 0, 1, -10, -3, -1, -3, -2, -4, 0, 3, -3, 0, -1, 0, 2, -4, 2, -3, -8, 0, -5, 5, -7, -4, 3, --9, 6, -10, 5, 1, -4, 2, -8, 2, -6, 2, -1, 2, -2, -6, 1, -6, -5, -3, 7, -8, -5, -2, -7, -1, -8, 3, 0, 0, 1, -6, -3, -5, -3, -3, -9, -6, 1, -7, -5, -3, -3, -6, --11, -5, -1, -8, -15, -1, -8, -8, 0, -13, -9, 0, -14, -10, -9, -9, -11, -3, -11, --14, -7, -5, -4, -12, -18, -16, -2, -19, -7, -13, -5, -12, -10, -6, -23, -4, --10, -11, -8, -10, -14, -12, -5, -14, -13, -3, -8, -16, -10, -8, -15, -6, -13, --10, -11, -8, -6, -12, -9, -8, -10, -10, -8, -4, -13, -5, -6, -11, 2, -14, -2, --6, -7, -1, -11, 1, -4, -9, 3, -3, 2, -8, -1, -2, -7, -1, 0, 4, -3, 3, -7, 2, --3, -1, 1, -3, -2, -1, 7, -4, 1, -2, -2, -4, -3, 8, -9, 1, -1, -3, 4, -6, 3, 3, -0, -1, -5, -7, -2, 1, -4, 3, 0, -9, 0, -4, 4, -5, -4, 1, -3, -4, -5, -3, -7, -8, --7, 2, -9, -8, -2, -7, -3, -10, -6, -4, -12, -6, -10, -7, -10, -10, -5, -11, -3, --7, -13, -10, -8, -6, -15, -7, -7, -11, -9, -11, -8, -10, -11, -8, -6, -12, -8, --10, -8, -6, -10, -7, -8, -7, -8, -11, -3, -4, -5, -6, -12, -8, -6, -6, -3, -6, --6, -6, -2, 1, -12, -5, -4, -6, -1, -1, -7, -5, -4, -3, 1, -6, 2, -6, 0, -5, -9, -4, -7, -2, 2, -3, 1, -3, -4, -4, -1, -2, -4, 3, -5, -2, -3, -4, -1, -4, 1, -1, --10, 1, 0, -9, 2, -3, -6, -2, 6, -5, -6, -2, -3, -3, -4, -4, -6, -1, -5, -6, -1, --2, -9, -1, -2, -5, -3, 0, -5, -7, -5, -8, -1, -7, -6, -4, -2, -6, -7, -7, -8, --5, 0, -4, -12, -4, -10, -3, -4, -11, -3, -6, -6, -6, -9, -7, -9, -7, -5, -7, --2, -10, -10, -3, -10, -5, -7, -10, -6, -12, -6, -9, -4, -7, -8, -5, -12, -6, --5, -4, -9, -4, -7, -5, -5, -8, -7, -7, -9, -7, -5, -11, -3, -6, -3, -5, -8, -4, --3, -6, -8, -6, -5, -4, -5, -6, -2, -6, -6, -2, -5, -3, -4, -5, -7, -3, -2, -2, --2, -9, 1, -3, -8, 0, -3, 0, -5, -3, -2, -1, 0, -3, -3, -4, 1, -2, -8, 3, -1, --5, 1, 0, -3, -4, -4, -1, 0, -3, 2, -6, -1, -3, -6, 2, -4, -3, -3, -1, -1, -5, --3, 0, 0, -6, -1, -4, -5, -3, 0, -1, -4, -8, -4, 0, -9, 0, -4, -5, -4, -1, -5, --6, -4, -6, -3, -6, -6, -9, -4, -4, -7, -4, -3, -10, -6, -6, -5, -5, -8, -5, -9, --5, -6, -5, -6, -9, -8, -4, -5, -10, -3, -7, -6, -6, -4, -6, -9, -4, -6, -2, -7, --2, -3, -7, -4, -7, -3, -5, -3, -4, -7, -4, -3, -3, -2, -1, -5, -4, -3, -4, -3, --3, -2, -3, -1, -3, -7, 0, -3, 2, -1, -5, -3, -1, -3, -5, 1, -8, 2, -5, 0, -1, --6, -1, -2, 2, -5, -1, -1, -2, -2, -1, -6, 0, -5, -2, 0, -5, -2, -4, 1, -5, -4, --2, 0, -5, -3, 0, -5, -1, -2, -3, -3, -4, -2, -3, -3, -5, -4, -2, -6, -3, -6, --4, -3, -6, -3, -2, -5, -5, -5, -4, -5, -3, -3, -8, -2, -6, -3, -4, -9, -1, -8, --4, -4, -7, -2, -6, -3, -5, -4, -3, -5, -3, -8, -4, -8, -5, -3, -8, -1, -7, -2, --4, -6, -5, -3, -4, -3, -4, -4, -1, -5, -2, -5, -2, -3, -4, -3, -5, -2, -4, -1, --4, -4, -1, -3, -1, -4, -4, -3, -2, -3, -1, -3, -5, -2, -1, -3, -2, 0, -4, -2, --3, -4, -2, -3, -2, -2, -1, -3, -4, -2, -3, -2, -3, 0, -5, -2, -1, -3, -1, -2, --1, -5, -2, -1, -2, -2, -2, -1, -2, -2, -3, -2, -4, -2, -1, -3, -2, -2, -2, -2, --1, -4, -4, -1, -3, -2, -1, -6, -1, -4, -4, -2, -5, -1, -4, -1, -4, -4, -2, -3, --4, -2, -4, -4, -3, -4, -1, -5, -5, -3, -3, -4, -4, -5, -3, -3, -6, -4, -4, -3, --4, -4, -3, -4, -3, -5, -5, -4, -6, -2, -6, -3, -4, -4, -3, -5, -2, -5, -5, -3, --3, -4, -4, -4, -2, -3, -4, -4, -4, -2, -3, -3, -3, -3, -3, -2, -2, -4, -1, -2, --3, -1, -3, -1, -2, -3, -3, -1, -4, -3, -1, -2, -2, -1, -2, -2, -2, -3, -1, -2, --1, -1, -3, -2, -1, -2, -2, -2, -1, -1, -1, -2, -2, -1, -2, -1, -2, -2, -1, -2, --2, -2, -1, -2, -2, -1, -2, -2, -1, -2, -2, -2, -2, -1, -2, -3, -2, -2, -2, -2, --2, -2, -2, -2, -3, -3, -2, -2, -3, -2, -3, -3, -3, -3, -2, -3, -2, -3, -3, -3, --3, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -3, -3, -3, --3, -3, -3, -3, -3, -3, -2, -3, -3, -2, -3, -2, -2, -2, -2, -2, -3, -2, -2, -3, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --1, -2, -2, -2, -2, -1, -2, -1, -1, -2, -2, -1, -2, -1, -2, -2, -2, -2, -1, -2, --2, -2, -2, -1, -1, -2, -1, -2, -1, -2, -2, -1, -1, -1, -2, -1, -2, -1, -2, -1, --1, -2, -1, -1, -1, -1, -1, -1, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, }; - - #endif /* snare909_H_ */ diff --git a/PolyDrums_v0_2_0_DelayDuty/PolyDrums_v0_2_0_DelayDuty.ino b/PolyDrums_v0_2_0_DelayDuty/PolyDrums_v0_2_0_DelayDuty.ino deleted file mode 100644 index 7c06b20..0000000 --- a/PolyDrums_v0_2_0_DelayDuty/PolyDrums_v0_2_0_DelayDuty.ino +++ /dev/null @@ -1,480 +0,0 @@ - -/* Example of a sound being triggered by MIDI input. - * NOW COMPATIBLE WITH MOZZI v1.0.2, MIDI library 4.2 - * LESS COMPATIBLE WITH ARDUINO IDE 1.0.6 onwards - http://sensorium.github.io/Mozzi/blog/2015/04/08/use-arduino-1-dot-0-5/ - * Demonstrates playing notes with Mozzi in response to MIDI input, - * using the standard Arduino MIDI library: - * http://playground.arduino.cc/Main/MIDILibrary - * - * Mozzi help/discussion/announcements: - * https://groups.google.com/forum/#!forum/mozzi-users - * - * Tim Barrass 2013. - * This example code is in the public domain. - * - * sgreen - modified to use standard Arduino midi library, added saw wave - * Audio output from pin 9 (pwm) - * Midi plug pin 2 (centre) to Arduino gnd, pin 5 to RX (0) - * http://www.philrees.co.uk/midiplug.htm - -D Green July 2015: -Big transparent button cycles through different backing sequences (including an empty one at the end) - -Small button to its left toggles between normal envelope and fake "delay" effect on all sounds - -Small button to its right switches main drums on and off - -Different waveforms selected via the right-hand corner up and down keys between octave up -and octave down - cycles between (I think): sawtooth, squarewave (variable duty cycle controlled by touchstrip), -squarewave with variable duty cycle autolocked to tempo, triangle wave (sounds like electric piano) - - */ -#define MAX_NOTES 3 -//Dave G: now seems to do 2+ note polyphony without clicking (higher notes are a bit grainy) -int threshold=255/(MAX_NOTES); - -#include <MIDI.h> -//#include <SPI.h> -#include <MozziGuts.h> -#include <Oscil.h> // oscillator template -#include <Line.h> // for envelope -#include <Sample.h> -#include <mozzi_utils.h> -#include <mozzi_analog.h> - -//#include <tables/square_analogue512_int8.h> -#include <tables/saw512_int8.h> -#include <tables/cos512_int8.h> - -#include <mozzi_midi.h> -#include <ADSR.h> -//#include <fixedMath.h> -#include <LowPassFilter.h> -//#include "Wave.h" -#include <WaveShaper.h> -#include <tables/waveshape_compress_512_to_488_int16.h> - - -#define DRUM_SAMPLES 1 - -#if DRUM_SAMPLES -#include "kick909.h" -#include "snare909.h" -#include "hihatc909.h" -#include "hihato909.h" -#endif - -// use #define for CONTROL_RATE, not a constant -#define CONTROL_RATE 128 // powers of 2 please - -#define ENABLE_MIDI 1 -#define DEBUG 0 -#define BPM 120 -#define STEPS_PER_BEAT 4 - -unsigned long beatCounter = 0; -unsigned long ticksPerStep = (60*CONTROL_RATE) / (BPM*STEPS_PER_BEAT); - -// audio sinewave oscillator -//Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> oscSin(SIN2048_DATA); -//Oscil <SAW512_NUM_CELLS, AUDIO_RATE> sawwave(SAW512_DATA); -//Oscil <TRIANGLE2048_NUM_CELLS, AUDIO_RATE> oscTri(TRIANGLE2048_DATA); -//Wave myosc; -WaveShaper <int> aCompress(WAVESHAPE_COMPRESS_512_TO_488_DATA); // to compress instead of dividing by 2 after adding signals - -struct Channel { - //Wave osc; - Oscil <COS512_NUM_CELLS, AUDIO_RATE> osc; - ADSR <CONTROL_RATE,CONTROL_RATE> env; -// ADSR <CONTROL_RATE> fxenv; - byte note; - byte gain; -}; -Channel chan[MAX_NOTES]; -byte currentChan = 0; - -// envelope generator -//ADSR <CONTROL_RATE> envelope; -LowPassFilter lpf; -int crushCtrl = 0; -int gain = 32; -float octave = 1.0f; - -boolean enableDrums = true; - -int freeChan=0; -int beat = 0; -int waveType = 3; -int bitmask = 0b0000000010000000; - -byte delayOn=0; -byte snareOn=1; -byte hatsOn=1; -byte bassOn=1; - -int button0_old = 0; -int button1_old = 0; - -#if DRUM_SAMPLES -// drums -Sample <kick909_NUM_CELLS, AUDIO_RATE> kickSamp(kick909_DATA); -Sample <snare909_NUM_CELLS, AUDIO_RATE> snareSamp(snare909_DATA); -Sample <hihatc909_NUM_CELLS, AUDIO_RATE> hihatcSamp(hihatc909_DATA); -Sample <hihato_NUM_CELLS, AUDIO_RATE> hihatoSamp(hihato_DATA); -#endif - -#define BASSPLUS4 7 //basically how many basslines there are plus 4 for drum parts -byte pattern[BASSPLUS4][32] = { - //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 hhc - 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, // 1 hho - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, // 2 snare - 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, // 3 kick - 12,0,24,0,12,0,24,0, 12, 0,24,0,12,0,24,0, 12,0,24,0,12,0,24,0, 12, 0,24,0,12,0,24,0, // 5 bass - 12,0,12,0,14,0,12,0, 15,16,12,0,17,0,16,0, 12,0,12,0,14,0,12,0, 15,16,12,0,17,0,16,0, // 6 bass - 24,0,12,0,24,0,12,0, 34, 0,22,0,29,0,17,0, 24,0,12,0,24,0,12,0, 34, 0,22,0,29,0,17,0, // 7 bass -}; -//bittersweet 0,12,15,12,13,10,13,0, 18,13,18,0, 17,13,17,0, - -// pin defines -#define LED 13 // to see if MIDI is being recieved -#define BUTTON0_PIN 2 -#define BUTTON1_PIN 3 - -// forward declarations -void HandleNoteOn(byte channel, byte note, byte velocity); -void HandleNoteOff(byte channel, byte note, byte velocity); -void HandleControlChange (byte channel, byte number, byte value); -void HandlePitchBend (byte channel, int bend); - -//yes surely this should go in setup but then not scoped in other functions..?? - MIDI_CREATE_DEFAULT_INSTANCE(); - -void setup() { - // init IO pins - pinMode(LED, OUTPUT); - -#if 0 - pinMode(BUTTON0_PIN, INPUT); - digitalWrite(BUTTON0_PIN, HIGH); // turn on pull-up resistor - - pinMode(BUTTON1_PIN, INPUT); - digitalWrite(BUTTON1_PIN, HIGH); // turn on pull-up resistor -#endif - -#if DEBUG - Serial.begin(57600); // for debugging -#endif - -#if ENABLE_MIDI - // Initiate MIDI communications, listen to all channels - MIDI.begin(MIDI_CHANNEL_OMNI); - - // Connect the HandleNoteOn function to the library, so it is called upon reception of a NoteOn. - MIDI.setHandleNoteOn(HandleNoteOn); // Put only the name of the function - MIDI.setHandleNoteOff(HandleNoteOff); // Put only the name of the function - MIDI.setHandleControlChange(HandleControlChange); - MIDI.setHandlePitchBend(HandlePitchBend); - MIDI.setHandleContinue(HandleContinue); - MIDI.setHandleStop(HandleStop); - MIDI.setHandleStart(HandleStart); - MIDI.setHandleProgramChange(HandleProgramChange); - -#endif - -#if 0 - //osc.setFreq(440u); // default frequency - //myosc.setFreq(440.0f); - myosc.setFreq(440.0f*4.0f); - myosc.setPulseWidth(32); - - envelope.setADLevels(255, 200); - envelope.setTimes(50, 200, 65535, 5000); -#endif - - for(int i=0; i<MAX_NOTES; i++) - { - // chan[i].osc.setType(WAVE_TRI); - chan[i].osc.setTable(SAW512_DATA); - //chan[i].osc.setPulseWidth(16); - chan[i].note=128; - chan[i].env.setADLevels(127,127); - chan[i].env.setTimes(10, 10, 20000, 510); -// chan[i].fxenv.setADLevels(255,255); -// chan[i].fxenv.setTimes(10, 10, 0, 2000); - } - - lpf.setResonance(128); - lpf.setCutoffFreq(190); - -#if DRUM_SAMPLES - kickSamp.setFreq((float) kick909_SAMPLERATE / (float) kick909_NUM_CELLS); - snareSamp.setFreq((float) snare909_SAMPLERATE / (float) snare909_NUM_CELLS); - hihatcSamp.setFreq((float) hihatc909_SAMPLERATE / (float) hihatc909_NUM_CELLS); - hihatoSamp.setFreq((float) hihato_SAMPLERATE / (float) hihato_NUM_CELLS); - //snareSamp.start(); -#endif - - //setupFastAnalogRead(); // optional -// adcEnableInterrupt(); // for analog reads - - startMozzi(CONTROL_RATE); -} - -void HandleProgramChange (byte channel, byte number) -{ - // change wave - waveType = (number) % 4; - - for(int i=0; i<MAX_NOTES; i++) - { -#if 1 - switch(waveType) { -// case 4: -// chan[i].osc.setTable(SQUARE_ANALOGUE512_DATA); -// break; - case 0: - chan[i].osc.setTable(SAW512_DATA); - break; - case 1: - chan[i].osc.setTable(COS512_DATA); - break; - case 2: - chan[i].osc.setTable(SAW512_DATA); - break; - case 3: - chan[i].osc.setTable(SAW512_DATA); - break; - } -#else - for(int i=0; i<MAX_NOTES; i++) - { - chan[i].osc.setType((WaveType) waveType); - } -#endif - } -} - - -void HandleNoteOn(byte channel, byte note, byte velocity) { - //osc.setFreq(mtof(note)); // simple but less accurate frequency - //osc.setFreq_Q16n16(Q16n16_mtof(Q8n0_to_Q16n16(note))); // accurate frequency - //myosc.setFreq(mtof(note)); // accurate frequency - //envelope.noteOn(); - - // start note on next channel - now with v basic "note priority"! -int index; -int empty=99; - -if (0==velocity) {empty=0;} -else { - digitalWrite(LED,HIGH); - for(int i=0; i<MAX_NOTES; i++) - { - index=((currentChan+i)%(MAX_NOTES-hatsOn)+hatsOn); - if (chan[index].gain==0) {empty=index; break;} - } - } - -if (empty==99) // ie all no empty channels found so far? - { - for(int i=0; i<MAX_NOTES; i++) - { - index=((currentChan+i)%(MAX_NOTES-hatsOn)+hatsOn); - if (chan[index].note==128) {empty=index; break;} - } - } - -if (empty<99) {currentChan=empty;} else - { - currentChan = (currentChan + 1) % MAX_NOTES; // add 1, wrap around - } - - chan[currentChan].note = note; - chan[currentChan].osc.setFreq(float(mtof(note))); -// (float(mtof(note))); // accurate frequency? - if (waveType==1) {chan[currentChan].osc.setFreq(float(mtof(note+24)));} //high triangle - chan[currentChan].env.noteOn(); -// chan[currentChan].fxenv.noteOn(); - -} - -void HandleNoteOff(byte channel, byte note, byte velocity) { - //envelope.noteOff(); - - // find which channel was playing this note - for(int i=0; i<MAX_NOTES; i++) { - if (chan[i].note == note) { - // kill it - chan[i].env.noteOff(); - chan[i].note=128; - } - } - - digitalWrite(LED,LOW); -} - -void HandleControlChange (byte channel, byte number, byte value) -{ - // http://www.indiana.edu/~emusic/cntrlnumb.html - switch(number) { - case 1: // modulation wheel - int divided= constrain((value /16)+2,1,7); // values=0-127, map to 0-7 - bitmask=((0b00000000111111111)>>divided)<<divided; - break; - - //gain = value*2; -/* lpf.setCutoffFreq( int(value*1.5f) ); // control messages are in [0, 127] range - lpf.setResonance( int(value*1.4f) ); -// for(int i=0; i<MAX_NOTES; i++) {chan[i].env.setTimes(10, 10, 0, 900+value); } -*/ - - break; - } -} - -// pitchbend = control strip + button on Keytar -void HandlePitchBend (byte channel, int bend) -{ - //bend value from +/-8192 - //lfo.setFreq((unsigned int) (bend+8192)>>7); - for(int i=0; i<MAX_NOTES; i++) { -// chan[i].osc.setPulseWidth((bend+8192) >> 8); - } - -} - -void HandleStop () { //this is the Back button on the Xbox keyboard -// octave *= 2.0f; -// if (octave > 16.0f) octave = 1.0f; -//Dave G: no longer used : ) -delayOn=(! delayOn); - for(int i=0; i<MAX_NOTES; i++) - { -if (delayOn) - { - chan[i].env.setTimes(10, 10, 0, 1020); - } - else - { - chan[i].env.setTimes(10, 10, 20000, 510); - } - } -} - -void HandleStart () { //this is the Back button on the Xbox keyboard -// octave *= 2.0f; -// if (octave > 16.0f) octave = 1.0f; -//Dave G: no longer used : ) -snareOn=(! snareOn); -} - -void HandleContinue () { // the big round button on all keytars -bassOn=(bassOn+1)% ((BASSPLUS4-4)+1) ; -if (0==bassOn) {hatsOn=0;} else {hatsOn=1;} -} - -void updateControl(){ -#if ENABLE_MIDI - MIDI.read(); -#endif - - //envelope.update(); - - // update playing envelopes - for(int i=0; i<MAX_NOTES; i++) { - chan[i].env.update(); -// chan[i].fxenv.update(); - //int tremolo=( chan[i].fxenv.next() & 0b00111111 ); - int tremolo=chan[i].env.next(); -if (delayOn) -{chan[i].gain=(tremolo * (tremolo&0b00011111) )>>5;} -else {chan[i].gain=tremolo;} -//subtler effect: {chan[i].gain=(tremolo + (tremolo&0b00011111) )>>1;} - if (chan[i].gain>threshold) {chan[i].gain=threshold;} - // threshold=255/MAX_NOTES, genuinely not sure if this is best approach but stops crashes :) - } - - -#if DRUM_SAMPLES - if (enableDrums) { - // drums - beatCounter++; - if (beatCounter > ticksPerStep) { - beat = (beat+1) & 0x1f; - beatCounter = 0; - -//if (beat==0 || beat==8) {HandleNoteOn(1, 48, 128); } - - //semi-perceptible BPM-locked phaser - if (3==waveType){int slowbeat=beat>>1; - int divided=(slowbeat+6)>>1; if (slowbeat>7) {divided=(22-slowbeat)>>1;} - bitmask=((0b00000000111111111)>>divided)<<divided; - } -// lpf.setCutoffFreq( (filterlevel+11) <<3 ); //maps to 72-192 -// lpf.setResonance( (filterlevel+10) <<3); - if (pattern[0][beat] && hatsOn) hihatcSamp.start(); - if (pattern[1][beat] && hatsOn) hihatoSamp.start(); - if (pattern[2][beat] && snareOn) snareSamp.start(); - if (pattern[3][beat] && snareOn) kickSamp.start(); - if (pattern[bassOn+3][beat] && bassOn) { HandleNoteOn(0, pattern[bassOn+3][beat]+24, 0) ;} - } - } -#endif - -} - -// strip the low bits off! -int bitCrush(int x, int a) -{ - return (x>>a)<<a; -} - -int updateAudio() -{ - //int x = (int) (envelope.next() * osc.next())>>8; - //int x = (int) (envelope.next() * myosc.next())>>8; - //int x = (int) (envelope.next() * (lfo.next() * myosc.next())>>8)>>8; - //int x = (int) lfo.next(); - //int x = (int) (lfo.next() * myosc.next())>>8; - //int x = (int) (envelope.next() * lpf.next(myosc.next()))>>8; - //int x = (envelope.next() * lpf.next(osc.next()))>>8; - //x = bitCrush(x, crushCtrl>>4); - //x = bitCrush(x, crushCtrl); - //x = (x * crushCtrl)>>4; // simple gain - //x = x>>2; - //x = lpf.next(x); - - // sum up channels - int x = hihatcSamp.next() + hihatoSamp.next(); - for(int i=0; i<MAX_NOTES; i++) { - int raw=chan[i].osc.next(); - if (i==0 && 1<waveType) {int squared=((( (raw+128) & bitmask) && 1)<<8)-128; raw=squared;} - x += (int) (chan[i].gain * raw)>>8; - } - -//Dave G: helps crash less if goes through some sort of waveshaper here? - x = aCompress.next(256u + x); - - //x = (x*gain)>>8; -// x = lpf.next(x); - -#if DRUM_SAMPLES - if (enableDrums) { - // drums please! - int drums = kickSamp.next() + snareSamp.next() ; - //drums = (drums>>4)<<4; - x += drums; - } -#endif - - return x; -} - - -void loop() { - audioHook(); // required here -} - - - diff --git a/PolyDrums_v0_2_0_DelayDuty/hihatc909.h b/PolyDrums_v0_2_0_DelayDuty/hihatc909.h deleted file mode 100644 index d2b9d76..0000000 --- a/PolyDrums_v0_2_0_DelayDuty/hihatc909.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef hihatc909_H_ -#define hihatc909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define hihatc909_NUM_CELLS 1024 -#define hihatc909_SAMPLERATE 16384 - -const int8_t __attribute__((progmem)) hihatc909_DATA [] = {1, -2, 1, -2, 2, 0, -4, -13, -18, 2, 3, 3, -1, 4, -9, 7, -5, -2, 4, -22, 23, -7, -8, -2, 7, -5, -8, 12, --4, 7, 7, -21, 12, -3, -18, 8, 1, 4, -20, 4, -5, -4, -2, 0, -2, -7, 3, -3, -3, --4, 3, -9, 12, -5, 20, 2, -25, 19, 0, 8, -12, -6, 4, 0, 15, -7, 8, 19, -9, -6, -0, -1, 0, -3, 12, -12, 7, 9, -18, 2, 4, 1, -7, -4, 7, 2, -3, 0, -3, 1, -2, -4, --4, -11, 7, -8, -2, 11, 2, 8, -1, 4, -3, -1, -2, -9, -6, -3, 3, -9, -9, 4, 1, --5, 1, 5, 0, 2, 2, -3, 9, 6, -7, 3, 5, 0, -2, 0, 7, -3, -2, -2, -3, 4, -2, 2, --3, 2, 0, -14, 4, 3, -4, 0, -5, 3, -2, -9, 3, 0, -1, -1, -5, -1, 5, -4, -6, 7, -1, -2, 2, 0, 4, -1, -7, 1, 3, 3, -1, -1, 6, 1, -2, 0, 3, -5, -9, 1, -1, -2, 0, --2, -1, 2, -1, -7, -2, -1, 1, -1, -4, 7, -5, -4, 5, 1, 1, 1, -2, 3, 2, -4, 0, 1, -3, -3, 1, -2, 0, 2, -1, 2, -2, -2, 0, -4, -3, 3, -3, 0, -1, -3, 2, -3, -6, 6, --2, 0, 1, 2, 0, -2, 2, 1, 1, -5, 1, -3, -2, -4, 3, -2, -2, 0, -2, 2, -4, 1, 4, --4, -1, 1, -1, -1, -2, 2, 1, 1, -4, 5, -4, 0, 1, -4, 3, -2, -1, 3, 0, -3, 0, -1, --1, -1, 0, -4, 3, -1, -3, 2, -1, -1, 0, 0, 1, 1, -1, 1, -2, -1, -1, -4, -1, 4, --1, -2, 1, 0, 1, 0, 0, -1, 1, 0, 0, -1, 1, -3, 0, -1, -3, 2, -2, 1, 0, -2, -3, -1, -1, -3, 1, -1, -2, 1, 1, -2, -1, 0, 0, -2, 0, -1, -2, 2, -1, 0, -2, 1, -2, 0, -0, -4, 1, -1, -2, 1, 0, -2, 0, -2, 3, 0, -2, 1, 0, -1, -1, 1, -1, 0, 0, -1, 0, -0, 0, -2, -1, 0, -1, 0, 0, -2, 0, 0, -2, -2, 0, -1, -1, 1, 0, -2, 0, 1, -1, 1, --1, 0, -1, 0, -1, -1, -1, -2, 1, 0, 0, 0, 0, 0, 0, -2, 0, 0, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, 1, -3, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -2, 0, 0, 0, --2, -1, 1, -1, 0, 0, -1, 0, 0, 0, -1, -2, 0, -2, -1, 0, 0, -1, 0, 0, -2, 0, -1, --1, -1, 0, -1, 0, 0, 0, -1, -1, 0, -1, 0, 0, 0, -2, 0, -1, -1, 0, -1, -1, 0, -1, --1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, -1, 1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -0, -1, -1, 0, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, -0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, --1, 0, 0, -1, 0, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, --1, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, 0, 0, -1, -1, 0, -1, 0, 0, -1, -1, 0, --1, 0, 0, -1, 0, 0, 0, -1, -1, -1, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, 0, --1, 0, -1, 0, 0, -1, -1, 0, 0, -1, -1, -1, 0, 0, 0, -1, -1, -1, -1, 0, -1, 0, 0, --1, -1, 0, 0, 0, -1, 0, -1, -1, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, 0, 0, 0, -1, -1, 0, -1, -1, 0, -1, 0, 0, 0, 0, -1, 0, 0, -1, -0, -1, -1, 0, -1, -1, 0, -1, -1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, --1, 0, -1, -1, -1, 0, 0, 0, -1, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, -1, 0, -1, --1, 0, -1, 0, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, 0, 0, -1, 0, -1, 0, -0, -1, 0, -1, -1, 0, -1, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, --1, 0, 0, -1, -1, 0, -1, -1, 0, -1, 0, 0, -1, -1, -1, 0, -1, -1, 0, 0, 0, 0, 0, --1, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, 0, -1, -1, 0, -1, 0, -1, -1, 0, --1, 0, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, 0, -1, -1, 0, -1, -1, -0, -1, 0, -1, 0, -1, -1, -1, 0, 0, -1, -1, -1, 0, -1, 0, -1, -1, -1, 0, 0, -1, -0, 0, 0, -1, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, 0, -0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, --1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, -0, 0, -1, 0, -1, 0, -1, 0, 0, 0, -1, -1, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, -1, -0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, }; - - #endif /* hihatc909_H_ */ diff --git a/PolyDrums_v0_2_0_DelayDuty/hihato909.h b/PolyDrums_v0_2_0_DelayDuty/hihato909.h deleted file mode 100644 index fd3a74d..0000000 --- a/PolyDrums_v0_2_0_DelayDuty/hihato909.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef hihato_H_ -#define hihato_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define hihato_NUM_CELLS 2048 -#define hihato_SAMPLERATE 16384 - -const int8_t __attribute__((progmem)) hihato_DATA [] = {0, -1, 0, -1, 0, -1, 0, --1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -2, 4, -4, -1, 3, 1, -8, 7, -2, -9, 3, -1, -1, -3, 0, -2, 4, -3, -4, -1, -3, 3, -2, -5, -1, 2, -1, -3, -1, 4, -2, 4, -3, -2, -4, -1, 6, 0, 8, -5, -5, 2, -2, 2, -2, -2, 7, -4, 6, -11, -6, 11, -6, 1, 4, 0, --14, 11, -6, -1, -2, -8, 5, -13, 1, 0, -8, 2, 7, 3, 1, -8, 5, 2, 2, -2, -8, 11, --1, 0, 2, -1, -3, 2, -3, -9, 2, -4, 6, -3, 1, 9, -7, -3, 2, -2, -2, -13, 2, 9, --3, 4, -3, 4, -6, 3, -1, -7, 13, -5, 3, 1, 1, -5, -13, 1, -2, 8, 0, 2, -4, 6, --1, 2, 3, -12, 4, -16, 0, -7, 2, 0, -3, 10, -6, 6, -3, -9, -2, 11, -7, -7, 11, -9, -3, 1, -1, -5, -6, -4, 2, -11, 8, 2, -4, 14, 0, -9, 7, -4, 6, -2, -10, -3, 1, -4, -12, 10, -1, 1, 0, 2, -3, 0, 5, 0, 5, -6, 0, -1, 0, -8, -3, -1, -1, 1, -3, 3, --3, 4, 8, -12, 0, -2, -7, 9, 2, 3, -6, -1, -4, 2, -7, -5, 12, -4, 7, 0, -2, 3, --1, -2, -3, 1, -3, -1, 2, -1, 2, -8, 1, 7, -8, -3, 1, 5, 4, -3, -3, 1, -3, -13, -2, 0, 1, 2, -13, 4, 4, 4, 0, 6, 2, -6, -9, -5, 12, -3, 1, -10, 10, -1, -7, 3, --2, 9, -18, 0, -5, 11, -4, 0, 6, -13, 3, -13, 14, 3, -5, 0, -3, 3, 1, -2, 1, 7, -5, -8, 6, 0, -8, 2, -3, 4, -6, 1, -14, 7, 8, -10, 7, -11, 10, -8, -13, 13, -3, -1, -2, 4, -4, -2, 0, 0, 8, -8, 2, 3, 5, -2, -1, -1, 4, 1, -13, 2, 2, -3, -5, 2, --1, 2, -2, 0, 0, 4, -6, -5, 6, -1, 2, -5, 1, 10, -8, -7, 8, -6, 6, 3, -15, 2, 0, --8, 6, 5, -4, 2, 0, -6, 5, -2, -4, 2, -3, -1, 5, -2, -2, 0, 1, 4, -8, 2, 4, 0, -0, -2, -1, -3, -1, -5, -3, 6, -18, 5, 10, -6, 10, -3, -4, 3, 1, -11, 4, -3, 5, --2, -7, 7, -5, 3, -4, 4, -3, 3, -3, -2, 6, -2, 4, -5, 5, -3, -9, -3, -4, 1, -2, -5, 2, -2, 7, -4, -5, 3, 0, 2, 2, -5, -2, 6, 5, -11, 3, -6, 2, 0, -3, 5, -4, 5, --6, 7, -11, 4, -3, -5, 1, -8, 4, -11, 17, 1, -3, -6, -2, 7, -2, -1, -5, 13, -5, --8, 1, 5, 3, -10, 5, -5, -4, 7, -7, 8, 5, 1, -2, -8, 7, -8, -2, 2, 1, 4, -5, -5, --2, 10, -10, -2, 1, -8, 0, -2, 5, 8, -4, -2, -4, 0, 4, -4, 1, -2, 5, 0, 8, -2, -1, -2, -4, 3, -6, 3, 0, -2, 2, 2, -5, -1, -7, -3, 1, 2, -6, 3, 0, -5, 6, -6, -1, -4, -2, -9, 4, 1, 3, 3, -2, 2, -1, -5, -2, 8, -1, -4, -6, 7, 2, 0, -3, 1, 2, -2, -1, -7, 5, -9, -2, 3, -4, 3, -1, -8, -3, 1, 0, -7, 5, 3, -3, -7, 2, 6, -2, 3, -7, -8, -7, 2, 1, 3, 7, -6, -1, -1, -2, -3, 5, -6, 3, 1, 0, -2, -1, -6, -5, 1, 3, 2, --4, 2, -2, -1, 0, -1, -3, -2, -5, -3, 3, 4, -1, 8, 0, -2, 0, -5, 1, 2, -3, -2, -8, -4, 0, -5, -2, -1, -3, 0, 5, 3, -8, 0, 0, 7, -7, -2, -1, -3, -3, -1, 1, 7, 5, --7, 1, 1, 4, -4, -3, 2, 5, -2, -6, 1, 1, -3, -7, -1, 3, -8, 3, -1, 2, 6, -11, 4, -1, -2, 0, -2, -3, 6, 6, -6, -1, 1, 2, 1, -1, -2, -1, -1, -5, 3, 0, -1, -1, -7, -0, -5, -1, 4, 0, 6, 0, -3, 1, 6, -5, 0, -3, -7, 6, -2, -2, 1, 5, -4, 4, -7, -4, -6, -3, 1, 0, -1, -4, -5, 2, -2, -5, 3, 1, 4, -1, 0, 1, 4, -1, -5, -1, -6, 2, -4, --1, 2, -1, 1, -4, -2, 0, 1, 2, -1, 0, 2, -2, 0, 4, 0, -4, 1, -5, 1, -2, 1, 4, 0, -2, 1, -3, -9, 0, -1, 2, -6, -2, 4, 1, -1, -4, 1, -1, 0, -3, 1, 1, 1, 0, 0, 6, --1, -8, -2, 1, 0, -2, -2, 5, 1, -3, -2, 5, 0, -3, -5, -8, 2, 1, 1, 0, 2, 2, -4, --1, -2, 2, -5, 0, 6, -4, 5, 0, -4, 1, -4, -8, 6, -3, -4, 4, -3, 3, 0, -1, -2, 1, --2, -2, 1, -2, -1, 0, 3, 1, 2, -1, -2, 0, -5, -1, 0, 7, 2, -4, 0, -2, -1, -2, --1, 0, 1, -4, -3, 5, 2, -2, 2, -4, 2, -6, -6, 6, -1, 4, -2, 0, 1, -1, -1, -1, 2, --3, 2, -5, -1, 4, -2, -1, -2, 2, -4, -5, 1, 2, 3, -1, 4, 1, -3, -2, -2, -2, 0, -2, -5, -2, 2, -1, 4, -4, -5, 3, -7, 2, 3, -3, 1, 2, 1, 1, -2, -3, 2, -4, 1, 0, --1, 4, 1, -4, 2, -3, -3, 2, -7, 0, 4, -1, -2, 1, 1, -7, 4, -1, -1, -1, -6, 3, 4, -0, -1, 1, -4, 3, -5, -3, 4, -2, 1, 0, 0, 1, 0, -2, -2, -2, -3, -2, -1, 0, 3, -1, -0, 0, -1, -1, -4, 1, 1, 1, 2, -2, 2, 0, -2, 0, -3, -2, -2, 0, 2, 1, -1, 0, -1, --2, 0, -3, 1, 1, -2, -3, 1, 0, 0, 1, -1, 1, -4, -1, 1, 3, 0, -1, 0, -1, -1, -4, -1, -1, 1, -1, -1, 3, -3, 0, -1, 2, -3, -2, 1, -3, 2, 2, -2, 0, 1, -6, 1, -1, 0, -3, -2, 0, 2, -2, -4, 1, -2, -2, -2, 2, -2, 2, 0, 0, 3, -2, 1, -2, 0, -3, 0, 1, --1, 0, -1, 2, -4, -2, 1, -4, 2, 0, -2, 1, 3, -2, 0, -1, -2, -3, -2, 1, -1, 0, 1, -4, -2, 2, -2, -4, 1, -3, -2, 1, 0, -2, 0, 0, -1, 0, -2, -2, 1, 0, 1, 0, 2, 1, --4, -2, 0, 0, -4, 1, -2, 1, 1, -4, 5, -1, -1, -2, -3, -1, 0, -3, -1, 4, -2, 0, -1, -1, 0, -2, -1, 2, -2, 1, 2, -1, 2, -1, -2, -1, -2, -5, -1, 1, 0, 0, 1, -2, 0, --1, -2, -1, 1, 0, -4, 1, 0, 1, -1, 2, -2, -4, -1, -1, 4, 0, -2, 0, -1, 0, 0, -5, -1, 1, -3, 0, 0, -2, 3, -1, -2, 3, -5, 0, 2, 0, 0, -2, -2, 1, 2, -6, 0, 1, -1, 1, --3, -1, 3, -2, -3, 2, 0, -3, 0, -2, 2, 1, -4, 2, 1, -2, -2, 1, -1, 4, -4, -4, 2, -2, -1, -1, -1, -4, 2, -3, 2, 2, -2, 0, -1, 0, 2, -3, -2, 2, 0, -4, -1, 1, -2, 2, --2, -1, 0, -2, -1, 1, -1, -1, 3, 0, -1, -1, 0, -1, -2, 1, -1, 1, -1, 2, 1, -1, --2, -1, 0, -5, 1, 0, -1, 2, 0, -2, -3, -1, 1, -2, -1, 1, 0, 1, 1, -2, 2, 0, -3, --1, 0, -2, -1, 2, -1, -1, 2, -3, -1, 2, -3, -2, -1, -1, -1, 1, -2, 1, 1, -1, 0, --2, 0, -2, 1, -1, 1, 1, 0, 0, -2, 0, -2, -1, -4, 0, 1, 0, 1, -1, 0, -1, -4, -2, --1, -1, -1, 0, 1, 2, -1, -3, 1, 0, 0, -1, -1, 0, 1, -3, 0, 2, 0, -2, -4, -1, 1, --1, -2, 2, 2, -1, -1, 0, -2, 1, -3, -3, 2, 0, -1, -1, 2, 1, -1, -2, -1, 0, -1, --2, 0, 1, -1, -2, 0, 2, -3, -1, 0, -2, 1, -1, 0, 3, -1, 0, -1, 0, -1, -1, -2, --1, 1, -1, 1, -3, -1, -1, -1, -1, -1, -1, -3, 2, -2, -1, 1, -1, 1, -2, -2, 1, 1, -0, -1, 1, -1, 0, -2, 1, 2, -3, 0, 0, -1, 0, -1, -2, 1, 0, -4, -1, 1, 0, 2, -3, --1, 1, -1, -2, 1, -1, 2, -1, -2, 1, -2, 0, -2, 0, 1, -2, -1, 0, 2, 0, -2, -1, 0, --1, -2, -1, 1, 3, -3, -2, 0, 0, -1, 0, 0, -1, -1, -3, -1, 1, 0, -2, 0, -1, 0, --2, 0, 0, 1, -1, 0, 1, -1, 3, -2, 0, 0, -3, 0, 2, -2, -1, 2, -1, -1, -1, -2, 0, --2, -2, 0, -1, -3, 0, 0, 0, 0, -3, 0, -1, 0, 0, 0, 1, 1, -1, -3, 0, 0, 0, -1, --3, 0, 1, -2, -1, 2, -2, -1, 0, -4, 1, 0, -2, 1, -1, 1, -1, 0, 0, 0, -1, -1, 0, --1, 1, -1, -1, 1, -1, -1, -2, -1, -1, -2, 0, 1, 0, -1, 1, -1, 0, 1, -1, -2, 1, -0, -2, 3, 0, 0, 0, -2, 0, -1, -1, -1, 0, -1, -1, -2, -1, 0, -2, -1, 0, -1, 0, 0, -0, 1, -1, 0, 0, -3, 0, 0, -1, 0, -1, 1, -1, 0, -1, -1, 0, -2, -1, 0, -1, -2, -1, -2, -1, -1, -1, -1, 1, -2, 1, -1, 0, 1, 0, -2, 0, 0, -3, 2, -2, -1, 0, -1, 0, 1, -1, -3, 1, -1, -2, 1, -3, 0, 1, -1, 0, 0, -2, 1, 0, -2, 0, -1, -1, 0, -2, -1, -1, --1, 0, -1, -1, 0, 0, -2, 1, -1, -1, 0, -1, 1, -1, 0, -1, 1, -1, -3, 1, -1, 0, --1, 0, 0, 0, 0, -2, -1, -1, 1, -3, -1, 2, -1, 0, -1, 0, 0, -2, -1, 1, -1, 0, -1, --2, 1, -1, -2, 0, 0, -1, -2, -2, 1, 1, -1, -2, 1, 0, -2, 0, 0, 0, 0, -2, 0, 1, --1, 0, -1, 0, -2, -1, -1, 1, 0, -1, 0, -1, 0, -1, -2, 1, -1, -2, 1, 0, 1, 0, -1, -0, 0, -2, -1, 1, -1, 0, -1, 0, 0, -1, -1, -1, 1, -3, -1, 0, 0, 0, -1, 1, 1, 0, --3, 0, 0, -1, 0, -1, 1, -1, 0, -1, 1, 1, -3, -2, 0, 0, 0, -1, 0, 1, -2, -2, -1, -0, -1, -1, -1, 1, 0, -1, 1, -1, 0, -1, -1, -2, 1, -2, 0, 1, -1, 1, -1, 0, -1, 0, --1, 0, 0, -1, 1, -1, 1, 0, -1, -2, 0, 0, -3, 0, -1, 1, -1, -2, 0, -1, 0, -1, -1, -0, -1, 0, 0, 1, -1, 1, -1, -2, 1, -2, 0, 0, -1, 0, 0, -1, -1, 1, -2, -2, 0, -1, -0, -1, 0, -1, 0, -1, -1, -1, -1, 0, -1, 1, 0, 0, 0, -1, -1, 0, 1, -1, 0, 0, -1, -0, -1, 0, 0, -1, -2, 0, -1, -1, 0, -1, 1, 0, -1, 0, -1, -2, 0, 0, -1, 0, -1, -1, -0, -1, -1, -2, 0, 1, -1, -1, 0, 0, 0, -1, 0, 0, 0, -1, -1, 0, -1, 0, -1, -1, -1, --1, 0, 1, -1, -2, 1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -1, 1, 0, 0, 0, -1, -1, 0, --2, 0, -1, 0, 1, -2, -1, -1, 0, 0, -3, 1, 0, -1, 0, 0, 0, -2, 0, -2, 1, -1, -2, -1, 0, 0, -2, 0, 1, -2, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 0, -1, 0, -1, 0, 0, -1, -1, 0, 0, -1, 0, -2, 0, -1, 0, -1, 1, 0, -2, -2, 0, 0, -3, -1, 0, -1, 0, 0, --1, 0, }; - - #endif /* hihato_H_ */ diff --git a/PolyDrums_v0_2_0_DelayDuty/kick909.h b/PolyDrums_v0_2_0_DelayDuty/kick909.h deleted file mode 100644 index 8dc2b21..0000000 --- a/PolyDrums_v0_2_0_DelayDuty/kick909.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef kick909_H_ -#define kick909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define kick909_NUM_CELLS 2048 -#define kick909_SAMPLERATE 16384 - -const int8_t __attribute__((progmem)) kick909_DATA [] = {-1, 0, -1, 0, -1, 0, 0, -0, 0, 0, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, -1, -2, -2, -3, -3, -2, -2, -2, -1, -1, --1, -1, 0, 0, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 8, 9, 9, 10, 14, 17, -20, 24, 29, 50, 57, 49, 53, 54, 53, 53, 54, 53, 53, 53, 52, 51, 50, 48, 46, 45, -44, 42, 40, 38, 35, 33, 30, 26, 23, 19, 15, 12, 8, 5, 1, -2, -6, -9, -11, -13, --16, -17, -18, -20, -22, -23, -24, -24, -25, -26, -27, -27, -27, -27, -28, -28, --28, -28, -27, -27, -27, -26, -25, -24, -24, -23, -21, -20, -19, -17, -15, -13, --12, -10, -8, -5, -3, -1, 1, 3, 6, 8, 10, 12, 14, 17, 19, 21, 24, 25, 28, 30, -32, 33, 35, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, -40, 40, 39, 38, 38, 37, 37, 36, 36, 35, 34, 33, 32, 32, 30, 29, 28, 26, 24, 22, -20, 18, 17, 15, 13, 11, 9, 8, 6, 5, 3, 1, -1, -2, -4, -5, -7, -8, -9, -11, -13, --14, -16, -17, -18, -19, -20, -21, -22, -24, -25, -25, -26, -27, -27, -28, -29, --29, -30, -30, -30, -30, -31, -31, -31, -31, -31, -32, -31, -32, -32, -32, -32, --32, -32, -32, -32, -32, -32, -32, -32, -31, -31, -31, -30, -30, -30, -29, -28, --28, -27, -27, -26, -26, -25, -25, -24, -23, -22, -21, -20, -20, -19, -18, -17, --16, -15, -14, -13, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, 0, 1, 2, 3, 4, 6, -6, 8, 9, 10, 11, 12, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 27, -28, 29, 30, 30, 31, 32, 33, 33, 34, 34, 34, 34, 35, 35, 35, 36, 36, 36, 36, 36, -36, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 36, -36, 35, 35, 35, 34, 34, 34, 33, 33, 32, 32, 32, 32, 31, 31, 30, 30, 29, 29, 28, -28, 27, 27, 26, 25, 25, 24, 23, 23, 21, 21, 20, 19, 18, 17, 16, 15, 14, 12, 11, -10, 9, 8, 7, 7, 6, 5, 4, 3, 2, 1, 0, -2, -3, -4, -4, -5, -6, -7, -8, -8, -9, --10, -11, -12, -12, -13, -14, -15, -16, -16, -17, -18, -19, -20, -20, -21, -22, --23, -23, -24, -25, -25, -26, -26, -27, -27, -28, -29, -29, -29, -30, -30, -31, --31, -32, -32, -32, -32, -33, -33, -33, -33, -33, -33, -34, -34, -34, -34, -34, --34, -34, -34, -34, -34, -34, -34, -34, -35, -35, -35, -35, -35, -35, -35, -35, --35, -35, -35, -35, -34, -34, -34, -34, -33, -33, -33, -33, -33, -32, -32, -32, --32, -31, -31, -31, -31, -31, -30, -30, -30, -29, -29, -29, -28, -28, -28, -27, --27, -26, -26, -25, -25, -24, -24, -23, -23, -22, -21, -21, -20, -19, -19, -18, --17, -17, -16, -15, -14, -14, -13, -12, -12, -11, -10, -9, -9, -8, -7, -6, -5, --5, -4, -3, -2, -1, -1, 0, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 12, 13, -14, 15, 16, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, -29, 29, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 32, 33, 33, 34, 34, 34, 34, -34, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, -35, 35, 35, 35, 35, 35, 35, 35, 35, 34, 34, 34, 34, 33, 33, 32, 33, 33, 32, 32, -32, 31, 31, 31, 31, 30, 30, 30, 29, 29, 29, 28, 28, 28, 27, 27, 26, 26, 26, 25, -25, 24, 24, 23, 22, 22, 21, 20, 20, 19, 18, 17, 17, 16, 15, 14, 13, 12, 11, 11, -10, 9, 8, 7, 6, 5, 4, 4, 3, 2, 1, 0, -1, -1, -2, -3, -4, -5, -5, -6, -7, -8, -9, --9, -10, -11, -12, -12, -13, -14, -14, -15, -16, -17, -17, -18, -19, -19, -20, --21, -21, -22, -23, -23, -24, -24, -25, -26, -26, -27, -27, -28, -28, -29, -30, --30, -30, -31, -31, -32, -32, -32, -33, -33, -33, -34, -34, -34, -34, -34, -35, --35, -35, -35, -35, -35, -35, -35, -36, -36, -36, -36, -36, -36, -36, -36, -36, --36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, --35, -35, -35, -35, -35, -34, -34, -34, -34, -34, -33, -33, -33, -33, -32, -32, --32, -32, -31, -31, -31, -31, -30, -30, -30, -29, -29, -29, -28, -28, -27, -27, --26, -26, -26, -25, -24, -24, -23, -23, -22, -21, -21, -20, -19, -19, -18, -17, --17, -16, -15, -15, -14, -13, -12, -12, -11, -10, -9, -9, -8, -7, -6, -6, -5, --4, -3, -3, -2, -1, 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 11, 11, 12, 13, -14, 15, 15, 16, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 25, 26, 26, 27, 28, -28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 33, 32, -33, 33, 34, 33, 33, 32, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, -34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 33, 33, 32, 33, 33, 32, 32, 32, 32, 31, -31, 31, 31, 30, 30, 30, 29, 29, 29, 29, 28, 28, 28, 27, 27, 26, 26, 26, 25, 25, -24, 24, 23, 23, 22, 22, 21, 20, 20, 19, 18, 18, 17, 16, 15, 14, 13, 12, 12, 11, -10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 0, -1, -2, -3, -3, -4, -5, -6, -7, -7, -8, -9, --10, -10, -11, -12, -12, -13, -14, -14, -15, -15, -16, -17, -17, -18, -18, -19, --19, -20, -20, -21, -21, -22, -22, -23, -23, -24, -24, -25, -25, -25, -26, -26, --27, -27, -27, -27, -28, -28, -28, -28, -29, -29, -29, -29, -29, -29, -29, -29, --29, -29, -29, -30, -30, -30, -30, -30, -29, -29, -29, -29, -29, -29, -29, -29, --29, -29, -29, -29, -29, -29, -29, -29, -29, -28, -28, -28, -28, -28, -28, -28, --28, -27, -27, -27, -27, -27, -26, -26, -26, -26, -26, -25, -25, -25, -25, -25, --24, -24, -24, -24, -23, -23, -23, -23, -23, -22, -22, -22, -21, -21, -21, -21, --20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -15, -15, --15, -14, -14, -13, -13, -13, -12, -12, -12, -11, -11, -10, -10, -10, -9, -9, --8, -8, -8, -7, -7, -7, -6, -6, -5, -5, -5, -4, -4, -4, -3, -3, -3, -2, -2, -1, --1, -1, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, -7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, -6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, -2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, -3, --4, -4, -4, -4, -4, -5, -5, -5, -5, -6, -6, -6, -6, -6, -6, -7, -7, -7, -7, -7, --8, -8, -8, -8, -8, -8, -8, -9, -9, -9, -9, -9, -9, -9, -9, -10, -10, -10, -10, --10, -10, -10, -10, -10, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -12, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -10, -10, --10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -9, -9, --9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -8, -8, -8, -8, -8, -8, -8, --8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -6, --6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, --3, -2, -3, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, }; - - #endif /* kick909_H_ */ diff --git a/PolyDrums_v0_2_0_DelayDuty/snare909.h b/PolyDrums_v0_2_0_DelayDuty/snare909.h deleted file mode 100644 index 7ed733c..0000000 --- a/PolyDrums_v0_2_0_DelayDuty/snare909.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef snare909_H_ -#define snare909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define snare909_NUM_CELLS 2048 -#define snare909_SAMPLERATE 16384 - -const int8_t __attribute__((progmem)) snare909_DATA [] = {0, -1, 0, -1, 0, -1, 0, --1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, --1, 0, 0, -2, -2, 0, -2, -1, -3, -2, 4, -3, -7, -2, 1, -7, 6, -3, -2, -6, -8, 8, --6, 0, -3, -1, -7, 0, -4, -11, -2, 3, -7, -9, 19, -1, 33, 43, 22, 60, 57, 49, -58, 55, 68, 65, 62, 60, 60, 69, 64, 61, 57, 58, 43, 50, 39, 37, 27, 17, 21, 15, -11, -2, -6, -12, -6, -23, -7, -22, -30, -22, -25, -27, -26, -31, -31, -21, -18, --8, -18, -4, 3, 1, 8, 12, 12, 19, 14, 42, 28, 21, 43, 45, 49, 46, 46, 43, 55, -44, 47, 44, 30, 46, 34, 38, 42, 24, 34, 27, 45, 23, 28, 38, 35, 36, 23, 30, 28, -40, 23, 32, 35, 29, 31, 31, 30, 28, 30, 30, 12, 13, 18, 8, 7, -2, 5, 6, -1, -7, --5, -9, -10, -11, -13, -17, -22, -25, -24, -24, -33, -28, -24, -30, -20, -28, --41, -28, -29, -26, -27, -37, -26, -29, -32, -20, -31, -26, -15, -20, -9, -14, --15, -12, -6, -7, -3, 8, 6, 15, 16, 12, 21, 30, 25, 35, 35, 29, 46, 44, 38, 49, -34, 48, 44, 44, 55, 38, 50, 41, 52, 43, 43, 53, 44, 56, 46, 39, 41, 44, 42, 42, -44, 41, 43, 35, 38, 39, 26, 30, 36, 31, 27, 26, 21, 20, 15, 9, 8, -2, 0, 10, --10, -13, -3, -17, -14, -14, -18, -7, -30, -24, -32, -26, -28, -37, -23, -35, --25, -40, -31, -34, -46, -30, -42, -38, -26, -37, -33, -32, -27, -32, -23, -23, --20, -13, -11, -10, -18, 0, -13, -3, -8, 3, -6, 4, 19, -1, 12, 14, 19, 10, 13, -9, 20, 19, 21, 23, 21, 34, 21, 24, 34, 20, 31, 28, 31, 36, 24, 33, 23, 31, 27, -30, 35, 37, 26, 17, 21, 19, 27, 21, 24, 17, 23, 19, 24, 19, 4, 23, 7, 15, 17, -14, 24, 8, 15, 10, 5, 6, 11, 12, -5, 9, 9, 10, 9, 1, 5, 0, -2, -2, 1, 1, -7, 0, -3, -2, -2, -8, -8, -19, -4, -18, -6, -4, -11, -5, -15, -1, -28, -12, -19, -10, --15, -23, -19, -23, -9, -25, -22, -21, -22, -18, -23, -18, -16, -31, -28, -23, --20, -27, -15, -26, -23, -22, -23, -16, -22, -29, -20, -11, -29, -12, -17, -14, --15, -12, -16, -22, -21, -8, -11, -16, -8, -13, -12, -8, -15, -14, -9, -14, -2, --13, 3, -9, -12, 9, 3, 0, 7, -3, 0, 9, 2, 9, 7, 5, 4, 18, 12, 3, 14, 17, 16, 19, -14, 6, 21, 24, 23, 18, 24, 18, 11, 25, 25, 20, 24, 22, 5, 27, 20, 13, 25, 28, -17, 19, 11, 14, 24, 10, 23, 10, 23, 19, 16, 9, 14, 9, 14, 17, 6, 13, 8, 11, -1, -17, 9, 0, 6, 4, -1, 3, -12, -10, -4, -12, -9, -14, -5, -24, -11, -14, -21, -16, --13, -18, -30, -17, -29, -25, -21, -21, -29, -30, -15, -34, -30, -21, -29, -25, --26, -28, -36, -27, -30, -28, -25, -21, -11, -31, -18, -21, -12, -12, -12, -13, --17, -15, -17, 0, -21, -9, 3, -3, -1, -7, 2, -3, 3, 3, -9, 13, 8, 5, -3, 9, 13, -3, 18, 6, 13, 13, 15, 12, 7, 10, 14, 12, 11, 3, 12, 15, 17, 6, 7, 26, -1, 16, -19, 8, 16, 12, 15, 1, 10, 20, 7, 7, 8, 17, 1, 3, 12, 8, 7, 10, 9, -4, 1, -3, 5, -1, 0, 1, 4, 3, -6, 1, -2, -2, -10, -7, -1, -3, -4, -19, 0, -10, -13, -4, -15, --8, -4, -13, -24, -10, -8, -13, -10, -11, -24, -14, -18, -6, -9, -24, -20, -10, --12, -18, -11, -14, -13, -18, -17, -28, -8, -27, -20, -14, -15, -11, -18, -9, --16, -15, -17, -16, -6, -13, -17, 3, -25, -1, -11, -4, -6, -8, -5, -14, 0, -11, -5, -3, 0, 0, -1, -12, 0, -2, -5, 6, 5, 4, 4, -11, 2, 3, -4, 12, 1, 5, -2, 3, -3, -0, 2, 6, 7, -7, 2, 1, 6, 5, -2, 0, 2, 1, 9, 1, 9, -5, -6, 7, -2, 5, -3, 16, -1, -1, 2, 4, 10, -3, 17, -2, 6, 7, 2, 9, -2, 1, -6, 10, -5, -1, 3, -8, 11, -6, 7, --1, -7, 2, -3, -6, 1, -3, -11, -3, -3, -7, -12, -4, -7, -10, -9, -18, -6, -11, --20, -3, -12, -6, -10, -24, -9, -16, -18, -9, -18, -20, -11, -9, -15, -24, -10, --20, -27, -13, -14, -13, -19, -18, -23, -21, -17, -14, -22, -15, -21, -19, -14, --19, -11, -15, -15, -17, -17, -18, -12, -12, -12, -8, -10, -17, -9, -14, -3, -5, --10, -9, -10, -8, -10, 7, -5, -3, 0, -2, 3, -3, 6, -6, -7, -1, 3, 5, 1, 4, -12, -8, 5, -1, 11, 6, -4, 3, 6, -1, 10, 1, 7, 2, 7, 6, -6, 2, 3, 3, 1, 6, 0, -3, 5, -5, 7, 1, -3, -2, -2, 6, 2, -3, 0, 3, 4, -4, 2, -5, -1, -2, -4, 0, -8, -8, -5, 2, --9, -6, -1, -2, -9, -6, -12, 1, -10, -14, -9, -13, -10, -10, -9, -10, -7, -17, --3, -13, -7, -12, -15, -16, -10, -9, -16, -7, -11, -11, -13, -14, -9, -11, -16, --17, -12, -10, -16, -10, -11, -14, -4, -14, -17, -7, -12, -6, -16, -2, -7, -9, --10, -9, -5, -18, 1, -8, 0, 1, -9, -16, -4, -3, -6, 4, -9, -2, -10, 0, 1, -10, -3, -1, -3, -2, -4, 0, 3, -3, 0, -1, 0, 2, -4, 2, -3, -8, 0, -5, 5, -7, -4, 3, --9, 6, -10, 5, 1, -4, 2, -8, 2, -6, 2, -1, 2, -2, -6, 1, -6, -5, -3, 7, -8, -5, -2, -7, -1, -8, 3, 0, 0, 1, -6, -3, -5, -3, -3, -9, -6, 1, -7, -5, -3, -3, -6, --11, -5, -1, -8, -15, -1, -8, -8, 0, -13, -9, 0, -14, -10, -9, -9, -11, -3, -11, --14, -7, -5, -4, -12, -18, -16, -2, -19, -7, -13, -5, -12, -10, -6, -23, -4, --10, -11, -8, -10, -14, -12, -5, -14, -13, -3, -8, -16, -10, -8, -15, -6, -13, --10, -11, -8, -6, -12, -9, -8, -10, -10, -8, -4, -13, -5, -6, -11, 2, -14, -2, --6, -7, -1, -11, 1, -4, -9, 3, -3, 2, -8, -1, -2, -7, -1, 0, 4, -3, 3, -7, 2, --3, -1, 1, -3, -2, -1, 7, -4, 1, -2, -2, -4, -3, 8, -9, 1, -1, -3, 4, -6, 3, 3, -0, -1, -5, -7, -2, 1, -4, 3, 0, -9, 0, -4, 4, -5, -4, 1, -3, -4, -5, -3, -7, -8, --7, 2, -9, -8, -2, -7, -3, -10, -6, -4, -12, -6, -10, -7, -10, -10, -5, -11, -3, --7, -13, -10, -8, -6, -15, -7, -7, -11, -9, -11, -8, -10, -11, -8, -6, -12, -8, --10, -8, -6, -10, -7, -8, -7, -8, -11, -3, -4, -5, -6, -12, -8, -6, -6, -3, -6, --6, -6, -2, 1, -12, -5, -4, -6, -1, -1, -7, -5, -4, -3, 1, -6, 2, -6, 0, -5, -9, -4, -7, -2, 2, -3, 1, -3, -4, -4, -1, -2, -4, 3, -5, -2, -3, -4, -1, -4, 1, -1, --10, 1, 0, -9, 2, -3, -6, -2, 6, -5, -6, -2, -3, -3, -4, -4, -6, -1, -5, -6, -1, --2, -9, -1, -2, -5, -3, 0, -5, -7, -5, -8, -1, -7, -6, -4, -2, -6, -7, -7, -8, --5, 0, -4, -12, -4, -10, -3, -4, -11, -3, -6, -6, -6, -9, -7, -9, -7, -5, -7, --2, -10, -10, -3, -10, -5, -7, -10, -6, -12, -6, -9, -4, -7, -8, -5, -12, -6, --5, -4, -9, -4, -7, -5, -5, -8, -7, -7, -9, -7, -5, -11, -3, -6, -3, -5, -8, -4, --3, -6, -8, -6, -5, -4, -5, -6, -2, -6, -6, -2, -5, -3, -4, -5, -7, -3, -2, -2, --2, -9, 1, -3, -8, 0, -3, 0, -5, -3, -2, -1, 0, -3, -3, -4, 1, -2, -8, 3, -1, --5, 1, 0, -3, -4, -4, -1, 0, -3, 2, -6, -1, -3, -6, 2, -4, -3, -3, -1, -1, -5, --3, 0, 0, -6, -1, -4, -5, -3, 0, -1, -4, -8, -4, 0, -9, 0, -4, -5, -4, -1, -5, --6, -4, -6, -3, -6, -6, -9, -4, -4, -7, -4, -3, -10, -6, -6, -5, -5, -8, -5, -9, --5, -6, -5, -6, -9, -8, -4, -5, -10, -3, -7, -6, -6, -4, -6, -9, -4, -6, -2, -7, --2, -3, -7, -4, -7, -3, -5, -3, -4, -7, -4, -3, -3, -2, -1, -5, -4, -3, -4, -3, --3, -2, -3, -1, -3, -7, 0, -3, 2, -1, -5, -3, -1, -3, -5, 1, -8, 2, -5, 0, -1, --6, -1, -2, 2, -5, -1, -1, -2, -2, -1, -6, 0, -5, -2, 0, -5, -2, -4, 1, -5, -4, --2, 0, -5, -3, 0, -5, -1, -2, -3, -3, -4, -2, -3, -3, -5, -4, -2, -6, -3, -6, --4, -3, -6, -3, -2, -5, -5, -5, -4, -5, -3, -3, -8, -2, -6, -3, -4, -9, -1, -8, --4, -4, -7, -2, -6, -3, -5, -4, -3, -5, -3, -8, -4, -8, -5, -3, -8, -1, -7, -2, --4, -6, -5, -3, -4, -3, -4, -4, -1, -5, -2, -5, -2, -3, -4, -3, -5, -2, -4, -1, --4, -4, -1, -3, -1, -4, -4, -3, -2, -3, -1, -3, -5, -2, -1, -3, -2, 0, -4, -2, --3, -4, -2, -3, -2, -2, -1, -3, -4, -2, -3, -2, -3, 0, -5, -2, -1, -3, -1, -2, --1, -5, -2, -1, -2, -2, -2, -1, -2, -2, -3, -2, -4, -2, -1, -3, -2, -2, -2, -2, --1, -4, -4, -1, -3, -2, -1, -6, -1, -4, -4, -2, -5, -1, -4, -1, -4, -4, -2, -3, --4, -2, -4, -4, -3, -4, -1, -5, -5, -3, -3, -4, -4, -5, -3, -3, -6, -4, -4, -3, --4, -4, -3, -4, -3, -5, -5, -4, -6, -2, -6, -3, -4, -4, -3, -5, -2, -5, -5, -3, --3, -4, -4, -4, -2, -3, -4, -4, -4, -2, -3, -3, -3, -3, -3, -2, -2, -4, -1, -2, --3, -1, -3, -1, -2, -3, -3, -1, -4, -3, -1, -2, -2, -1, -2, -2, -2, -3, -1, -2, --1, -1, -3, -2, -1, -2, -2, -2, -1, -1, -1, -2, -2, -1, -2, -1, -2, -2, -1, -2, --2, -2, -1, -2, -2, -1, -2, -2, -1, -2, -2, -2, -2, -1, -2, -3, -2, -2, -2, -2, --2, -2, -2, -2, -3, -3, -2, -2, -3, -2, -3, -3, -3, -3, -2, -3, -2, -3, -3, -3, --3, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -3, -3, -3, --3, -3, -3, -3, -3, -3, -2, -3, -3, -2, -3, -2, -2, -2, -2, -2, -3, -2, -2, -3, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --1, -2, -2, -2, -2, -1, -2, -1, -1, -2, -2, -1, -2, -1, -2, -2, -2, -2, -1, -2, --2, -2, -2, -1, -1, -2, -1, -2, -1, -2, -2, -1, -1, -1, -2, -1, -2, -1, -2, -1, --1, -2, -1, -1, -1, -1, -1, -1, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, }; - - #endif /* snare909_H_ */ diff --git a/README.md b/README.md deleted file mode 100644 index 5f95b90..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -cheapsynth -========== - -Patches and utilities for our Cheapsynth Arduino instrument diff --git a/WaveClass3PolyPlusLPF_BETA/Wave.h b/WaveClass3PolyPlusLPF_BETA/Wave.h deleted file mode 100644 index a9afd72..0000000 --- a/WaveClass3PolyPlusLPF_BETA/Wave.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Wave.h - * - * Simon Green 2013. - * - * Based on Mozzi "Oscil.h" - */ - -#ifndef WAVE_H_ -#define WAVE_H_ - -#include "Arduino.h" -#include "mozzi_fixmath.h" -#include <util/atomic.h> - -// fractional bits for oscillator index precision -#define OSCIL_F_BITS 16 -#define OSCIL_F_BITS_AS_MULTIPLIER 65536 -#define NUM_TABLE_CELLS 256 -#define ADJUST_FOR_NUM_TABLE_CELLS 8 -#define UPDATE_RATE AUDIO_RATE - -/** Generate waveform -*/ - -enum WaveType { WAVE_SAW=0, WAVE_TRI, WAVE_RECT, WAVE_NOISE }; - -class Wave -{ -public: - /** Constructor. "Wave mywave;" makes a Wave oscillator - */ - Wave () { - phase_fractional = 0; - phase_increment_fractional = 0; - wavetype = WAVE_SAW; - noise = 0xACE1; - pulse_width = 128; - } - - /** Increments one step along the phase. - @return the next value. - */ - inline - char next() - { - incrementPhase(); - - char w; - //ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - int n = (phase_fractional >> OSCIL_F_BITS) & (NUM_TABLE_CELLS-1); - switch(wavetype) { - case WAVE_SAW: - w = n - 128; - break; - case WAVE_TRI: - if (n & 0x80) // >= 128 - w = ((n^0xFF)<<1)-128; - else - w = (n<<1)-128; - break; - case WAVE_RECT: - if (n > pulse_width) - w = 127; - else - w = -127; - break; - case WAVE_NOISE: - noise = (noise >> 1) ^ (-(noise & 1) & 0xB400u); - w = noise>>8; - break; - } - } - return w; - } - - /** Set the wave type - */ - inline - void setType(WaveType x) - { - wavetype = x; - } - - WaveType getType() { return wavetype; } - - /** Set the pulse width for rectangle wave - */ - inline - void setPulseWidth(unsigned char x) - { - pulse_width = x; - } - - /** Set the oscillator frequency with an unsigned int. This is faster than using a - float, so it's useful when processor time is tight, but it can be tricky with - low and high frequencies, depending on the size of the wavetable being used. If - you're not getting the results you expect, try explicitly using a float, or try - setFreq_Q24n8() or or setFreq_Q16n16(). - @param frequency to play the wave table. - */ - inline - void setFreq (unsigned int frequency) { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - phase_increment_fractional = ((((unsigned long)NUM_TABLE_CELLS<<ADJUST_FOR_NUM_TABLE_CELLS)*frequency)/UPDATE_RATE) << (OSCIL_F_BITS - ADJUST_FOR_NUM_TABLE_CELLS); - } - } - - - /** Set the oscillator frequency with a float. Using a float is the most reliable - way to set frequencies, -Might- be slower than using an int but you need either - this, setFreq_Q24n8() or setFreq_Q16n16() for fractional frequencies. - @param frequency to play the wave table. - */ - inline - void setFreq(float frequency) - { // 1 us - using float doesn't seem to incur measurable overhead with the oscilloscope - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - phase_increment_fractional = (unsigned long)((((float)NUM_TABLE_CELLS * frequency)/UPDATE_RATE) * OSCIL_F_BITS_AS_MULTIPLIER); - } - } - - - /** Set the frequency using Q24n8 fixed-point number format. - This might be faster than the float version for setting low frequencies such as - 1.5 Hz, or other values which may not work well with your table size. A Q24n8 - representation of 1.5 is 384 (ie. 1.5 * 256). Can't be used with UPDATE_RATE - less than 64 Hz. - @param frequency in Q24n8 fixed-point number format. - */ - inline - void setFreq_Q24n8(Q24n8 frequency) - { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - //phase_increment_fractional = (frequency* (NUM_TABLE_CELLS>>3)/(UPDATE_RATE>>6)) << (F_BITS-(8-3+6)); - phase_increment_fractional = (((((unsigned long)NUM_TABLE_CELLS<<ADJUST_FOR_NUM_TABLE_CELLS)>>3)*frequency)/(UPDATE_RATE>>6)) - << (OSCIL_F_BITS - ADJUST_FOR_NUM_TABLE_CELLS - (8-3+6)); - } - } - - - /** Set the frequency using Q16n16 fixed-point number format. This is useful in - combination with Q16n16_mtof(), a fast alternative to mtof(), using Q16n16 - fixed-point format instead of floats. Note: this should work OK with tables 2048 cells or smaller and - frequencies up to 4096 Hz. Can't be used with UPDATE_RATE less than 64 Hz. - @param frequency in Q16n16 fixed-point number format. - */ - inline - void setFreq_Q16n16(Q16n16 frequency) - { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - //phase_increment_fractional = ((frequency * (NUM_TABLE_CELLS>>7))/(UPDATE_RATE>>6)) << (F_BITS-16+1); - phase_increment_fractional = (((((unsigned long)NUM_TABLE_CELLS<<ADJUST_FOR_NUM_TABLE_CELLS)>>7)*frequency)/(UPDATE_RATE>>6)) - << (OSCIL_F_BITS - ADJUST_FOR_NUM_TABLE_CELLS - 16 + 1); - - } - } - -private: - /** Increments the phase of the oscillator without returning a sample. - */ - inline - void incrementPhase() - { - //phase_fractional += (phase_increment_fractional | 1); // odd phase incr, attempt to reduce frequency spurs in output - phase_fractional += phase_increment_fractional; - } - - unsigned long phase_fractional; - volatile unsigned long phase_increment_fractional; - - unsigned char pulse_width; - uint16_t noise; - - WaveType wavetype; -}; - -#endif /* WAVE_H_ */ diff --git a/WaveClass3PolyPlusLPF_BETA/WaveClass3PolyPlusLPF_BETA.ino b/WaveClass3PolyPlusLPF_BETA/WaveClass3PolyPlusLPF_BETA.ino deleted file mode 100644 index fec5fc5..0000000 --- a/WaveClass3PolyPlusLPF_BETA/WaveClass3PolyPlusLPF_BETA.ino +++ /dev/null @@ -1,419 +0,0 @@ -/* Example of a sound being triggered by MIDI input. - * - * Demonstrates playing notes with Mozzi in response to MIDI input, - * using the standard Arduino MIDI library: - * http://playground.arduino.cc/Main/MIDILibrary - * - * Mozzi help/discussion/announcements: - * https://groups.google.com/forum/#!forum/mozzi-users - * - * Tim Barrass 2013. - * This example code is in the public domain. - * - * sgreen - modified to use standard Arduino midi library, added saw wave, lowpass filter - * Audio output from pin 9 (pwm) - * Midi plug pin 2 (centre) to Arduino gnd, pin 5 to RX (0) - * http://www.philrees.co.uk/midiplug.htm - * Now with drums! (still has all this code in there, commented out : ) - -S Green: -mod controller/ribbon is low pass filter cut-off -big button switches between tri/rectangle/noise/saw -(noise is at constant frequency) - -NB quite easy to crash the filter with loud sounds, hit reset! - - */ - - -#include <MIDI.h> -#include <MozziGuts.h> -#include <Oscil.h> // oscillator template -#include <Line.h> // for envelope -#include <Sample.h> -#include <mozzi_utils.h> -#include <mozzi_analog.h> - -#include <tables/sin2048_int8.h> // sine table for oscillator -//#include <tables/saw2048_int8.h> -//#include <tables/triangle2048_int8.h> - -#include <mozzi_midi.h> -#include <ADSR.h> -#include <fixedMath.h> -#include <LowPassFilter.h> -#include "Wave.h" - -#define MAX_NOTES 3 -//Dave G: seems to do 3 note polyphony without clicking - -#define DRUM_SAMPLES 0 - -#if DRUM_SAMPLES -#include "kick909.h" -#include "snare909.h" -#include "hihatc909.h" -#include "hihato909.h" -#endif - -// use #define for CONTROL_RATE, not a constant -#define CONTROL_RATE 128 // powers of 2 please - -#define ENABLE_MIDI 1 -#define DEBUG 0 -#define BPM 120 -#define STEPS_PER_BEAT 4 - -unsigned long stepCounter = 0; -unsigned long ticksPerStep = (60*CONTROL_RATE) / (BPM*STEPS_PER_BEAT); - -// audio sinewave oscillator -//Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> osc(SIN2048_DATA); -//Oscil <SAW2048_NUM_CELLS, AUDIO_RATE> osc(SAW2048_DATA); -//Oscil <TRIANGLE2048_NUM_CELLS, AUDIO_RATE> osc(TRIANGLE2048_DATA); -//Wave myosc; -//Wave lfo; -Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> lfo(SIN2048_DATA); - -struct Channel { - Wave osc; - //Oscil <TRIANGLE2048_NUM_CELLS, AUDIO_RATE> osc; - ADSR <CONTROL_RATE> env; - byte note; -}; -Channel chan[MAX_NOTES]; -byte currentChan = 0; - -// envelope generator -//ADSR <CONTROL_RATE> envelope; -LowPassFilter lpf; -int crushCtrl = 0; -int gain = 32; -float octave = 1.0f; - -boolean enableDrums = false; - -int step = 0; -int waveType = 1; - -int button0_old = 0; -int button1_old = 0; - -#if DRUM_SAMPLES -// drums -Sample <kick909_NUM_CELLS, AUDIO_RATE> kickSamp(kick909_DATA); -Sample <snare909_NUM_CELLS, AUDIO_RATE> snareSamp(snare909_DATA); -Sample <hihatc909_NUM_CELLS, AUDIO_RATE> hihatcSamp(hihatc909_DATA); -Sample <hihato_NUM_CELLS, AUDIO_RATE> hihatoSamp(hihato_DATA); -#endif - -byte pattern[4][16] = { - //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 hhc - 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, // 1 hho - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, // 2 s - 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 // 3 k -}; - -// pin defines -#define LED 13 // to see if MIDI is being recieved -#define BUTTON0_PIN 2 -#define BUTTON1_PIN 3 - -// forward declarations -void HandleNoteOn(byte channel, byte note, byte velocity); -void HandleNoteOff(byte channel, byte note, byte velocity); -void HandleControlChange (byte channel, byte number, byte value); -void HandlePitchBend (byte channel, int bend); - -void setup() { - // init IO pins - pinMode(LED, OUTPUT); - -#if 0 - pinMode(BUTTON0_PIN, INPUT); - digitalWrite(BUTTON0_PIN, HIGH); // turn on pull-up resistor - - pinMode(BUTTON1_PIN, INPUT); - digitalWrite(BUTTON1_PIN, HIGH); // turn on pull-up resistor -#endif - -#if DEBUG - Serial.begin(57600); // for debugging -#endif - -#if ENABLE_MIDI - // Initiate MIDI communications, listen to all channels - MIDI.begin(MIDI_CHANNEL_OMNI); - - // Connect the HandleNoteOn function to the library, so it is called upon reception of a NoteOn. - MIDI.setHandleNoteOn(HandleNoteOn); // Put only the name of the function - MIDI.setHandleNoteOff(HandleNoteOff); // Put only the name of the function - MIDI.setHandleControlChange(HandleControlChange); - MIDI.setHandlePitchBend(HandlePitchBend); - MIDI.setHandleContinue(HandleContinue); - MIDI.setHandleStop(HandleStop); -#endif - -#if 0 - //osc.setFreq(440u); // default frequency - //myosc.setFreq(440.0f); - myosc.setFreq(440.0f*4.0f); - myosc.setPulseWidth(32); - - envelope.setADLevels(255, 200); - envelope.setTimes(50, 200, 65535, 200); -#endif - - for(int i=0; i<MAX_NOTES; i++) - { - chan[i].osc.setType(WAVE_TRI); - //chan[i].osc.setTable(TRIANGLE2048_DATA); - chan[i].osc.setPulseWidth(16); - chan[i].env.setADLevels(128, 100); - chan[i].env.setTimes(100, 200, 65535, 200); - } - - //lfo.setType(WAVE_TRI); - lfo.setFreq(10.0f); - - lpf.setResonance(128); - lpf.setCutoffFreq(255); - -#if DRUM_SAMPLES - kickSamp.setFreq((float) kick909_SAMPLERATE / (float) kick909_NUM_CELLS); - snareSamp.setFreq((float) snare909_SAMPLERATE / (float) snare909_NUM_CELLS); - hihatcSamp.setFreq((float) hihatc909_SAMPLERATE / (float) hihatc909_NUM_CELLS); - hihatoSamp.setFreq((float) hihato_SAMPLERATE / (float) hihato_NUM_CELLS); - //snareSamp.start(); -#endif - - //setupFastAnalogRead(); // optional - adcEnableInterrupt(); // for analog reads - - startMozzi(CONTROL_RATE); -} - -void HandleNoteOn(byte channel, byte note, byte velocity) { - //osc.setFreq(mtof(note)); // simple but less accurate frequency - //osc.setFreq_Q16n16(Q16n16_mtof(Q8n0_to_Q16n16(note))); // accurate frequency - //myosc.setFreq(mtof(note)); // accurate frequency - //envelope.noteOn(); - - // start note on next channel - NB no "note priority" at this stage - chan[currentChan].note = note; - chan[currentChan].osc.setFreq( mtof(note) ); // accurate frequency - chan[currentChan].env.noteOn(); - currentChan = (currentChan + 1) % MAX_NOTES; // just wraps around for now - - digitalWrite(LED,HIGH); -} - -void HandleNoteOff(byte channel, byte note, byte velocity) { - //envelope.noteOff(); - - // find which channel was playing this note - for(int i=0; i<MAX_NOTES; i++) { - if (chan[i].note == note) { - // kill it - chan[i].env.noteOff(); - } - } - - digitalWrite(LED,LOW); -} - -void HandleControlChange (byte channel, byte number, byte value) -{ - // http://www.indiana.edu/~emusic/cntrlnumb.html - switch(number) { - case 1: // modulation wheel - //gain = value*2; - lpf.setCutoffFreq(value*2); // control messages are in [0, 127] range - break; - - case 105: - lpf.setCutoffFreq(value*2); // control messages are in [0, 127] range - break; - case 106: - //lpf.setResonance(value*2); - crushCtrl = value; - break; - } -} - -// pitchbend = control strip + button on Keytar -void HandlePitchBend (byte channel, int bend) -{ - //bend value from +/-8192 - //lfo.setFreq((unsigned int) (bend+8192)>>7); - for(int i=0; i<MAX_NOTES; i++) { - chan[i].osc.setPulseWidth((bend+8192) >> 8); - } - -} - -void HandleStop () { //this is the Back button on the Xbox keyboard -// octave *= 2.0f; -// if (octave > 16.0f) octave = 1.0f; -//Dave G: no longer used : ) -} - -void HandleContinue () { // the big round button on all keytars - - // change wave - waveType = (waveType + 1) & 3; - - for(int i=0; i<MAX_NOTES; i++) - { -#if 0 - switch(waveType) { - case 0: - chan[i].osc.setTable(TRIANGLE2048_DATA); - break; - case 1: - chan[i].osc.setTable(SAW2048_DATA); - break; - case 2: - chan[i].osc.setTable(SIN2048_DATA); - break; - } -#else - for(int i=0; i<MAX_NOTES; i++) - { - chan[i].osc.setType((WaveType) waveType); - } -#endif - } -} - -void updateControl(){ -#if ENABLE_MIDI - MIDI.read(); -#endif - - //envelope.update(); - - // update playing envelopes - for(int i=0; i<MAX_NOTES; i++) { - chan[i].env.update(); - } - -#if 0 - // push buttons - int button0 = !digitalRead(BUTTON0_PIN); // active low - int button1 = !digitalRead(BUTTON1_PIN); - - /* - if (button0) { - // trigger - //envelope.noteOn(); - //lpf.reset(); - digitalWrite(LED, HIGH); - } else { - digitalWrite(LED, LOW); - } - */ - - if (button0 && !button0_old) { - lfo.setType((WaveType) ((((int) lfo.getType()) + 1) % 3)); - } - button0_old = button0; - - if (button1 & !button1_old) { - waveType = (waveType + 1) & 3; - //myosc.setType((WaveType) waveType); - for(int i=0; i<MAX_NOTES; i++) - { - chan[i].osc.setType((WaveType) waveType); - } - } - button1_old = button1; -#endif - -#if DRUM_SAMPLES - if (enableDrums) { - // drums - stepCounter++; - if (stepCounter > ticksPerStep) { - step = (step+1) & 0xf; - stepCounter = 0; - if (pattern[0][step]) hihatcSamp.start(); - if (pattern[1][step]) hihatoSamp.start(); - if (pattern[2][step]) snareSamp.start(); - if (pattern[3][step]) kickSamp.start(); - } - } -#endif - -#if 0 - // knobs - int knob0 = adcGetResult(0); // [0, 1023] - int knob1 = adcGetResult(1); - //lpf.setCutoffFreq(knob0>>2); - //lpf.setResonance(knob1>>2); - - //crushCtrl = knob1>>7; - lfo.setFreq((float) knob0); - //myosc.setFreq((float) knob1); - //myosc.setFreq((unsigned int) knob0*20); - //myosc.setPulseWidth((unsigned char) (knob1>>2)); - - // start the next read cycle in the background - adcReadAllChannels(); -#endif - -#if DEBUG - Serial.println(knob0); -#endif -} - -// strip the low bits off! -int bitCrush(int x, int a) -{ - return (x>>a)<<a; -} - -int updateAudio() -{ - //int x = (int) (envelope.next() * osc.next())>>8; - //int x = (int) (envelope.next() * myosc.next())>>8; - //int x = (int) (envelope.next() * (lfo.next() * myosc.next())>>8)>>8; - //int x = (int) lfo.next(); - //int x = (int) (lfo.next() * myosc.next())>>8; - //int x = (int) (envelope.next() * lpf.next(myosc.next()))>>8; - //int x = (envelope.next() * lpf.next(osc.next()))>>8; - //x = bitCrush(x, crushCtrl>>4); - //x = bitCrush(x, crushCtrl); - //x = (x * crushCtrl)>>4; // simple gain - //x = x>>2; - //x = lpf.next(x); - - // sum up channels - int x = 0; - for(int i=0; i<MAX_NOTES; i++) { - x += (int) (chan[i].env.next() * chan[i].osc.next())>>8; - } -//Dave G: might crash less if this went through some sort of waveshaper here? - - //x = (x*gain)>>8; - //x = (x * lfo.next())>>8; - x = lpf.next(x); - -#if DRUM_SAMPLES - if (enableDrums) { - // drums please! - int drums = kickSamp.next() + snareSamp.next() + hihatcSamp.next() + hihatoSamp.next(); - //drums = (drums>>4)<<4; - x += drums*2; - } -#endif - - return x; -} - - -void loop() { - audioHook(); // required here -} - diff --git a/WaveClass3PolyPlusLPF_BETA/hihatc909.h b/WaveClass3PolyPlusLPF_BETA/hihatc909.h deleted file mode 100644 index d52992d..0000000 --- a/WaveClass3PolyPlusLPF_BETA/hihatc909.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef hihatc909_H_ -#define hihatc909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define hihatc909_NUM_CELLS 1024 -#define hihatc909_SAMPLERATE 16384 - -const char __attribute__((progmem)) hihatc909_DATA [] = {1, -2, 1, -2, 2, 0, -4, -13, -18, 2, 3, 3, -1, 4, -9, 7, -5, -2, 4, -22, 23, -7, -8, -2, 7, -5, -8, 12, --4, 7, 7, -21, 12, -3, -18, 8, 1, 4, -20, 4, -5, -4, -2, 0, -2, -7, 3, -3, -3, --4, 3, -9, 12, -5, 20, 2, -25, 19, 0, 8, -12, -6, 4, 0, 15, -7, 8, 19, -9, -6, -0, -1, 0, -3, 12, -12, 7, 9, -18, 2, 4, 1, -7, -4, 7, 2, -3, 0, -3, 1, -2, -4, --4, -11, 7, -8, -2, 11, 2, 8, -1, 4, -3, -1, -2, -9, -6, -3, 3, -9, -9, 4, 1, --5, 1, 5, 0, 2, 2, -3, 9, 6, -7, 3, 5, 0, -2, 0, 7, -3, -2, -2, -3, 4, -2, 2, --3, 2, 0, -14, 4, 3, -4, 0, -5, 3, -2, -9, 3, 0, -1, -1, -5, -1, 5, -4, -6, 7, -1, -2, 2, 0, 4, -1, -7, 1, 3, 3, -1, -1, 6, 1, -2, 0, 3, -5, -9, 1, -1, -2, 0, --2, -1, 2, -1, -7, -2, -1, 1, -1, -4, 7, -5, -4, 5, 1, 1, 1, -2, 3, 2, -4, 0, 1, -3, -3, 1, -2, 0, 2, -1, 2, -2, -2, 0, -4, -3, 3, -3, 0, -1, -3, 2, -3, -6, 6, --2, 0, 1, 2, 0, -2, 2, 1, 1, -5, 1, -3, -2, -4, 3, -2, -2, 0, -2, 2, -4, 1, 4, --4, -1, 1, -1, -1, -2, 2, 1, 1, -4, 5, -4, 0, 1, -4, 3, -2, -1, 3, 0, -3, 0, -1, --1, -1, 0, -4, 3, -1, -3, 2, -1, -1, 0, 0, 1, 1, -1, 1, -2, -1, -1, -4, -1, 4, --1, -2, 1, 0, 1, 0, 0, -1, 1, 0, 0, -1, 1, -3, 0, -1, -3, 2, -2, 1, 0, -2, -3, -1, -1, -3, 1, -1, -2, 1, 1, -2, -1, 0, 0, -2, 0, -1, -2, 2, -1, 0, -2, 1, -2, 0, -0, -4, 1, -1, -2, 1, 0, -2, 0, -2, 3, 0, -2, 1, 0, -1, -1, 1, -1, 0, 0, -1, 0, -0, 0, -2, -1, 0, -1, 0, 0, -2, 0, 0, -2, -2, 0, -1, -1, 1, 0, -2, 0, 1, -1, 1, --1, 0, -1, 0, -1, -1, -1, -2, 1, 0, 0, 0, 0, 0, 0, -2, 0, 0, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, 1, -3, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -2, 0, 0, 0, --2, -1, 1, -1, 0, 0, -1, 0, 0, 0, -1, -2, 0, -2, -1, 0, 0, -1, 0, 0, -2, 0, -1, --1, -1, 0, -1, 0, 0, 0, -1, -1, 0, -1, 0, 0, 0, -2, 0, -1, -1, 0, -1, -1, 0, -1, --1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, -1, 1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -0, -1, -1, 0, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, -0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, --1, 0, 0, -1, 0, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, --1, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, 0, 0, -1, -1, 0, -1, 0, 0, -1, -1, 0, --1, 0, 0, -1, 0, 0, 0, -1, -1, -1, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, 0, --1, 0, -1, 0, 0, -1, -1, 0, 0, -1, -1, -1, 0, 0, 0, -1, -1, -1, -1, 0, -1, 0, 0, --1, -1, 0, 0, 0, -1, 0, -1, -1, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, 0, 0, 0, -1, -1, 0, -1, -1, 0, -1, 0, 0, 0, 0, -1, 0, 0, -1, -0, -1, -1, 0, -1, -1, 0, -1, -1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, --1, 0, -1, -1, -1, 0, 0, 0, -1, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, -1, 0, -1, --1, 0, -1, 0, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, 0, --1, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, 0, 0, -1, 0, -1, 0, -0, -1, 0, -1, -1, 0, -1, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, --1, 0, 0, -1, -1, 0, -1, -1, 0, -1, 0, 0, -1, -1, -1, 0, -1, -1, 0, 0, 0, 0, 0, --1, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, 0, -1, -1, 0, -1, 0, -1, -1, 0, --1, 0, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, 0, -1, -1, 0, -1, -1, -0, -1, 0, -1, 0, -1, -1, -1, 0, 0, -1, -1, -1, 0, -1, 0, -1, -1, -1, 0, 0, -1, -0, 0, 0, -1, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, 0, -0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, --1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, -0, 0, -1, 0, -1, 0, -1, 0, 0, 0, -1, -1, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, -1, -0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, }; - - #endif /* hihatc909_H_ */ diff --git a/WaveClass3PolyPlusLPF_BETA/hihato909.h b/WaveClass3PolyPlusLPF_BETA/hihato909.h deleted file mode 100644 index a36f866..0000000 --- a/WaveClass3PolyPlusLPF_BETA/hihato909.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef hihato_H_ -#define hihato_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define hihato_NUM_CELLS 2048 -#define hihato_SAMPLERATE 16384 - -const char __attribute__((progmem)) hihato_DATA [] = {0, -1, 0, -1, 0, -1, 0, --1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -2, 4, -4, -1, 3, 1, -8, 7, -2, -9, 3, -1, -1, -3, 0, -2, 4, -3, -4, -1, -3, 3, -2, -5, -1, 2, -1, -3, -1, 4, -2, 4, -3, -2, -4, -1, 6, 0, 8, -5, -5, 2, -2, 2, -2, -2, 7, -4, 6, -11, -6, 11, -6, 1, 4, 0, --14, 11, -6, -1, -2, -8, 5, -13, 1, 0, -8, 2, 7, 3, 1, -8, 5, 2, 2, -2, -8, 11, --1, 0, 2, -1, -3, 2, -3, -9, 2, -4, 6, -3, 1, 9, -7, -3, 2, -2, -2, -13, 2, 9, --3, 4, -3, 4, -6, 3, -1, -7, 13, -5, 3, 1, 1, -5, -13, 1, -2, 8, 0, 2, -4, 6, --1, 2, 3, -12, 4, -16, 0, -7, 2, 0, -3, 10, -6, 6, -3, -9, -2, 11, -7, -7, 11, -9, -3, 1, -1, -5, -6, -4, 2, -11, 8, 2, -4, 14, 0, -9, 7, -4, 6, -2, -10, -3, 1, -4, -12, 10, -1, 1, 0, 2, -3, 0, 5, 0, 5, -6, 0, -1, 0, -8, -3, -1, -1, 1, -3, 3, --3, 4, 8, -12, 0, -2, -7, 9, 2, 3, -6, -1, -4, 2, -7, -5, 12, -4, 7, 0, -2, 3, --1, -2, -3, 1, -3, -1, 2, -1, 2, -8, 1, 7, -8, -3, 1, 5, 4, -3, -3, 1, -3, -13, -2, 0, 1, 2, -13, 4, 4, 4, 0, 6, 2, -6, -9, -5, 12, -3, 1, -10, 10, -1, -7, 3, --2, 9, -18, 0, -5, 11, -4, 0, 6, -13, 3, -13, 14, 3, -5, 0, -3, 3, 1, -2, 1, 7, -5, -8, 6, 0, -8, 2, -3, 4, -6, 1, -14, 7, 8, -10, 7, -11, 10, -8, -13, 13, -3, -1, -2, 4, -4, -2, 0, 0, 8, -8, 2, 3, 5, -2, -1, -1, 4, 1, -13, 2, 2, -3, -5, 2, --1, 2, -2, 0, 0, 4, -6, -5, 6, -1, 2, -5, 1, 10, -8, -7, 8, -6, 6, 3, -15, 2, 0, --8, 6, 5, -4, 2, 0, -6, 5, -2, -4, 2, -3, -1, 5, -2, -2, 0, 1, 4, -8, 2, 4, 0, -0, -2, -1, -3, -1, -5, -3, 6, -18, 5, 10, -6, 10, -3, -4, 3, 1, -11, 4, -3, 5, --2, -7, 7, -5, 3, -4, 4, -3, 3, -3, -2, 6, -2, 4, -5, 5, -3, -9, -3, -4, 1, -2, -5, 2, -2, 7, -4, -5, 3, 0, 2, 2, -5, -2, 6, 5, -11, 3, -6, 2, 0, -3, 5, -4, 5, --6, 7, -11, 4, -3, -5, 1, -8, 4, -11, 17, 1, -3, -6, -2, 7, -2, -1, -5, 13, -5, --8, 1, 5, 3, -10, 5, -5, -4, 7, -7, 8, 5, 1, -2, -8, 7, -8, -2, 2, 1, 4, -5, -5, --2, 10, -10, -2, 1, -8, 0, -2, 5, 8, -4, -2, -4, 0, 4, -4, 1, -2, 5, 0, 8, -2, -1, -2, -4, 3, -6, 3, 0, -2, 2, 2, -5, -1, -7, -3, 1, 2, -6, 3, 0, -5, 6, -6, -1, -4, -2, -9, 4, 1, 3, 3, -2, 2, -1, -5, -2, 8, -1, -4, -6, 7, 2, 0, -3, 1, 2, -2, -1, -7, 5, -9, -2, 3, -4, 3, -1, -8, -3, 1, 0, -7, 5, 3, -3, -7, 2, 6, -2, 3, -7, -8, -7, 2, 1, 3, 7, -6, -1, -1, -2, -3, 5, -6, 3, 1, 0, -2, -1, -6, -5, 1, 3, 2, --4, 2, -2, -1, 0, -1, -3, -2, -5, -3, 3, 4, -1, 8, 0, -2, 0, -5, 1, 2, -3, -2, -8, -4, 0, -5, -2, -1, -3, 0, 5, 3, -8, 0, 0, 7, -7, -2, -1, -3, -3, -1, 1, 7, 5, --7, 1, 1, 4, -4, -3, 2, 5, -2, -6, 1, 1, -3, -7, -1, 3, -8, 3, -1, 2, 6, -11, 4, -1, -2, 0, -2, -3, 6, 6, -6, -1, 1, 2, 1, -1, -2, -1, -1, -5, 3, 0, -1, -1, -7, -0, -5, -1, 4, 0, 6, 0, -3, 1, 6, -5, 0, -3, -7, 6, -2, -2, 1, 5, -4, 4, -7, -4, -6, -3, 1, 0, -1, -4, -5, 2, -2, -5, 3, 1, 4, -1, 0, 1, 4, -1, -5, -1, -6, 2, -4, --1, 2, -1, 1, -4, -2, 0, 1, 2, -1, 0, 2, -2, 0, 4, 0, -4, 1, -5, 1, -2, 1, 4, 0, -2, 1, -3, -9, 0, -1, 2, -6, -2, 4, 1, -1, -4, 1, -1, 0, -3, 1, 1, 1, 0, 0, 6, --1, -8, -2, 1, 0, -2, -2, 5, 1, -3, -2, 5, 0, -3, -5, -8, 2, 1, 1, 0, 2, 2, -4, --1, -2, 2, -5, 0, 6, -4, 5, 0, -4, 1, -4, -8, 6, -3, -4, 4, -3, 3, 0, -1, -2, 1, --2, -2, 1, -2, -1, 0, 3, 1, 2, -1, -2, 0, -5, -1, 0, 7, 2, -4, 0, -2, -1, -2, --1, 0, 1, -4, -3, 5, 2, -2, 2, -4, 2, -6, -6, 6, -1, 4, -2, 0, 1, -1, -1, -1, 2, --3, 2, -5, -1, 4, -2, -1, -2, 2, -4, -5, 1, 2, 3, -1, 4, 1, -3, -2, -2, -2, 0, -2, -5, -2, 2, -1, 4, -4, -5, 3, -7, 2, 3, -3, 1, 2, 1, 1, -2, -3, 2, -4, 1, 0, --1, 4, 1, -4, 2, -3, -3, 2, -7, 0, 4, -1, -2, 1, 1, -7, 4, -1, -1, -1, -6, 3, 4, -0, -1, 1, -4, 3, -5, -3, 4, -2, 1, 0, 0, 1, 0, -2, -2, -2, -3, -2, -1, 0, 3, -1, -0, 0, -1, -1, -4, 1, 1, 1, 2, -2, 2, 0, -2, 0, -3, -2, -2, 0, 2, 1, -1, 0, -1, --2, 0, -3, 1, 1, -2, -3, 1, 0, 0, 1, -1, 1, -4, -1, 1, 3, 0, -1, 0, -1, -1, -4, -1, -1, 1, -1, -1, 3, -3, 0, -1, 2, -3, -2, 1, -3, 2, 2, -2, 0, 1, -6, 1, -1, 0, -3, -2, 0, 2, -2, -4, 1, -2, -2, -2, 2, -2, 2, 0, 0, 3, -2, 1, -2, 0, -3, 0, 1, --1, 0, -1, 2, -4, -2, 1, -4, 2, 0, -2, 1, 3, -2, 0, -1, -2, -3, -2, 1, -1, 0, 1, -4, -2, 2, -2, -4, 1, -3, -2, 1, 0, -2, 0, 0, -1, 0, -2, -2, 1, 0, 1, 0, 2, 1, --4, -2, 0, 0, -4, 1, -2, 1, 1, -4, 5, -1, -1, -2, -3, -1, 0, -3, -1, 4, -2, 0, -1, -1, 0, -2, -1, 2, -2, 1, 2, -1, 2, -1, -2, -1, -2, -5, -1, 1, 0, 0, 1, -2, 0, --1, -2, -1, 1, 0, -4, 1, 0, 1, -1, 2, -2, -4, -1, -1, 4, 0, -2, 0, -1, 0, 0, -5, -1, 1, -3, 0, 0, -2, 3, -1, -2, 3, -5, 0, 2, 0, 0, -2, -2, 1, 2, -6, 0, 1, -1, 1, --3, -1, 3, -2, -3, 2, 0, -3, 0, -2, 2, 1, -4, 2, 1, -2, -2, 1, -1, 4, -4, -4, 2, -2, -1, -1, -1, -4, 2, -3, 2, 2, -2, 0, -1, 0, 2, -3, -2, 2, 0, -4, -1, 1, -2, 2, --2, -1, 0, -2, -1, 1, -1, -1, 3, 0, -1, -1, 0, -1, -2, 1, -1, 1, -1, 2, 1, -1, --2, -1, 0, -5, 1, 0, -1, 2, 0, -2, -3, -1, 1, -2, -1, 1, 0, 1, 1, -2, 2, 0, -3, --1, 0, -2, -1, 2, -1, -1, 2, -3, -1, 2, -3, -2, -1, -1, -1, 1, -2, 1, 1, -1, 0, --2, 0, -2, 1, -1, 1, 1, 0, 0, -2, 0, -2, -1, -4, 0, 1, 0, 1, -1, 0, -1, -4, -2, --1, -1, -1, 0, 1, 2, -1, -3, 1, 0, 0, -1, -1, 0, 1, -3, 0, 2, 0, -2, -4, -1, 1, --1, -2, 2, 2, -1, -1, 0, -2, 1, -3, -3, 2, 0, -1, -1, 2, 1, -1, -2, -1, 0, -1, --2, 0, 1, -1, -2, 0, 2, -3, -1, 0, -2, 1, -1, 0, 3, -1, 0, -1, 0, -1, -1, -2, --1, 1, -1, 1, -3, -1, -1, -1, -1, -1, -1, -3, 2, -2, -1, 1, -1, 1, -2, -2, 1, 1, -0, -1, 1, -1, 0, -2, 1, 2, -3, 0, 0, -1, 0, -1, -2, 1, 0, -4, -1, 1, 0, 2, -3, --1, 1, -1, -2, 1, -1, 2, -1, -2, 1, -2, 0, -2, 0, 1, -2, -1, 0, 2, 0, -2, -1, 0, --1, -2, -1, 1, 3, -3, -2, 0, 0, -1, 0, 0, -1, -1, -3, -1, 1, 0, -2, 0, -1, 0, --2, 0, 0, 1, -1, 0, 1, -1, 3, -2, 0, 0, -3, 0, 2, -2, -1, 2, -1, -1, -1, -2, 0, --2, -2, 0, -1, -3, 0, 0, 0, 0, -3, 0, -1, 0, 0, 0, 1, 1, -1, -3, 0, 0, 0, -1, --3, 0, 1, -2, -1, 2, -2, -1, 0, -4, 1, 0, -2, 1, -1, 1, -1, 0, 0, 0, -1, -1, 0, --1, 1, -1, -1, 1, -1, -1, -2, -1, -1, -2, 0, 1, 0, -1, 1, -1, 0, 1, -1, -2, 1, -0, -2, 3, 0, 0, 0, -2, 0, -1, -1, -1, 0, -1, -1, -2, -1, 0, -2, -1, 0, -1, 0, 0, -0, 1, -1, 0, 0, -3, 0, 0, -1, 0, -1, 1, -1, 0, -1, -1, 0, -2, -1, 0, -1, -2, -1, -2, -1, -1, -1, -1, 1, -2, 1, -1, 0, 1, 0, -2, 0, 0, -3, 2, -2, -1, 0, -1, 0, 1, -1, -3, 1, -1, -2, 1, -3, 0, 1, -1, 0, 0, -2, 1, 0, -2, 0, -1, -1, 0, -2, -1, -1, --1, 0, -1, -1, 0, 0, -2, 1, -1, -1, 0, -1, 1, -1, 0, -1, 1, -1, -3, 1, -1, 0, --1, 0, 0, 0, 0, -2, -1, -1, 1, -3, -1, 2, -1, 0, -1, 0, 0, -2, -1, 1, -1, 0, -1, --2, 1, -1, -2, 0, 0, -1, -2, -2, 1, 1, -1, -2, 1, 0, -2, 0, 0, 0, 0, -2, 0, 1, --1, 0, -1, 0, -2, -1, -1, 1, 0, -1, 0, -1, 0, -1, -2, 1, -1, -2, 1, 0, 1, 0, -1, -0, 0, -2, -1, 1, -1, 0, -1, 0, 0, -1, -1, -1, 1, -3, -1, 0, 0, 0, -1, 1, 1, 0, --3, 0, 0, -1, 0, -1, 1, -1, 0, -1, 1, 1, -3, -2, 0, 0, 0, -1, 0, 1, -2, -2, -1, -0, -1, -1, -1, 1, 0, -1, 1, -1, 0, -1, -1, -2, 1, -2, 0, 1, -1, 1, -1, 0, -1, 0, --1, 0, 0, -1, 1, -1, 1, 0, -1, -2, 0, 0, -3, 0, -1, 1, -1, -2, 0, -1, 0, -1, -1, -0, -1, 0, 0, 1, -1, 1, -1, -2, 1, -2, 0, 0, -1, 0, 0, -1, -1, 1, -2, -2, 0, -1, -0, -1, 0, -1, 0, -1, -1, -1, -1, 0, -1, 1, 0, 0, 0, -1, -1, 0, 1, -1, 0, 0, -1, -0, -1, 0, 0, -1, -2, 0, -1, -1, 0, -1, 1, 0, -1, 0, -1, -2, 0, 0, -1, 0, -1, -1, -0, -1, -1, -2, 0, 1, -1, -1, 0, 0, 0, -1, 0, 0, 0, -1, -1, 0, -1, 0, -1, -1, -1, --1, 0, 1, -1, -2, 1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -1, 1, 0, 0, 0, -1, -1, 0, --2, 0, -1, 0, 1, -2, -1, -1, 0, 0, -3, 1, 0, -1, 0, 0, 0, -2, 0, -2, 1, -1, -2, -1, 0, 0, -2, 0, 1, -2, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 0, -1, 0, -1, 0, 0, -1, -1, 0, 0, -1, 0, -2, 0, -1, 0, -1, 1, 0, -2, -2, 0, 0, -3, -1, 0, -1, 0, 0, --1, 0, }; - - #endif /* hihato_H_ */ diff --git a/WaveClass3PolyPlusLPF_BETA/kick909.h b/WaveClass3PolyPlusLPF_BETA/kick909.h deleted file mode 100644 index 3ddf8cd..0000000 --- a/WaveClass3PolyPlusLPF_BETA/kick909.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef kick909_H_ -#define kick909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define kick909_NUM_CELLS 2048 -#define kick909_SAMPLERATE 16384 - -const char __attribute__((progmem)) kick909_DATA [] = {-1, 0, -1, 0, -1, 0, 0, -0, 0, 0, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, -1, -2, -2, -3, -3, -2, -2, -2, -1, -1, --1, -1, 0, 0, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 8, 9, 9, 10, 14, 17, -20, 24, 29, 50, 57, 49, 53, 54, 53, 53, 54, 53, 53, 53, 52, 51, 50, 48, 46, 45, -44, 42, 40, 38, 35, 33, 30, 26, 23, 19, 15, 12, 8, 5, 1, -2, -6, -9, -11, -13, --16, -17, -18, -20, -22, -23, -24, -24, -25, -26, -27, -27, -27, -27, -28, -28, --28, -28, -27, -27, -27, -26, -25, -24, -24, -23, -21, -20, -19, -17, -15, -13, --12, -10, -8, -5, -3, -1, 1, 3, 6, 8, 10, 12, 14, 17, 19, 21, 24, 25, 28, 30, -32, 33, 35, 36, 37, 37, 38, 38, 39, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, -40, 40, 39, 38, 38, 37, 37, 36, 36, 35, 34, 33, 32, 32, 30, 29, 28, 26, 24, 22, -20, 18, 17, 15, 13, 11, 9, 8, 6, 5, 3, 1, -1, -2, -4, -5, -7, -8, -9, -11, -13, --14, -16, -17, -18, -19, -20, -21, -22, -24, -25, -25, -26, -27, -27, -28, -29, --29, -30, -30, -30, -30, -31, -31, -31, -31, -31, -32, -31, -32, -32, -32, -32, --32, -32, -32, -32, -32, -32, -32, -32, -31, -31, -31, -30, -30, -30, -29, -28, --28, -27, -27, -26, -26, -25, -25, -24, -23, -22, -21, -20, -20, -19, -18, -17, --16, -15, -14, -13, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, 0, 1, 2, 3, 4, 6, -6, 8, 9, 10, 11, 12, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 27, -28, 29, 30, 30, 31, 32, 33, 33, 34, 34, 34, 34, 35, 35, 35, 36, 36, 36, 36, 36, -36, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 36, -36, 35, 35, 35, 34, 34, 34, 33, 33, 32, 32, 32, 32, 31, 31, 30, 30, 29, 29, 28, -28, 27, 27, 26, 25, 25, 24, 23, 23, 21, 21, 20, 19, 18, 17, 16, 15, 14, 12, 11, -10, 9, 8, 7, 7, 6, 5, 4, 3, 2, 1, 0, -2, -3, -4, -4, -5, -6, -7, -8, -8, -9, --10, -11, -12, -12, -13, -14, -15, -16, -16, -17, -18, -19, -20, -20, -21, -22, --23, -23, -24, -25, -25, -26, -26, -27, -27, -28, -29, -29, -29, -30, -30, -31, --31, -32, -32, -32, -32, -33, -33, -33, -33, -33, -33, -34, -34, -34, -34, -34, --34, -34, -34, -34, -34, -34, -34, -34, -35, -35, -35, -35, -35, -35, -35, -35, --35, -35, -35, -35, -34, -34, -34, -34, -33, -33, -33, -33, -33, -32, -32, -32, --32, -31, -31, -31, -31, -31, -30, -30, -30, -29, -29, -29, -28, -28, -28, -27, --27, -26, -26, -25, -25, -24, -24, -23, -23, -22, -21, -21, -20, -19, -19, -18, --17, -17, -16, -15, -14, -14, -13, -12, -12, -11, -10, -9, -9, -8, -7, -6, -5, --5, -4, -3, -2, -1, -1, 0, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 12, 13, -14, 15, 16, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, -29, 29, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 32, 33, 33, 34, 34, 34, 34, -34, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, -35, 35, 35, 35, 35, 35, 35, 35, 35, 34, 34, 34, 34, 33, 33, 32, 33, 33, 32, 32, -32, 31, 31, 31, 31, 30, 30, 30, 29, 29, 29, 28, 28, 28, 27, 27, 26, 26, 26, 25, -25, 24, 24, 23, 22, 22, 21, 20, 20, 19, 18, 17, 17, 16, 15, 14, 13, 12, 11, 11, -10, 9, 8, 7, 6, 5, 4, 4, 3, 2, 1, 0, -1, -1, -2, -3, -4, -5, -5, -6, -7, -8, -9, --9, -10, -11, -12, -12, -13, -14, -14, -15, -16, -17, -17, -18, -19, -19, -20, --21, -21, -22, -23, -23, -24, -24, -25, -26, -26, -27, -27, -28, -28, -29, -30, --30, -30, -31, -31, -32, -32, -32, -33, -33, -33, -34, -34, -34, -34, -34, -35, --35, -35, -35, -35, -35, -35, -35, -36, -36, -36, -36, -36, -36, -36, -36, -36, --36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, --35, -35, -35, -35, -35, -34, -34, -34, -34, -34, -33, -33, -33, -33, -32, -32, --32, -32, -31, -31, -31, -31, -30, -30, -30, -29, -29, -29, -28, -28, -27, -27, --26, -26, -26, -25, -24, -24, -23, -23, -22, -21, -21, -20, -19, -19, -18, -17, --17, -16, -15, -15, -14, -13, -12, -12, -11, -10, -9, -9, -8, -7, -6, -6, -5, --4, -3, -3, -2, -1, 0, 0, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 11, 11, 12, 13, -14, 15, 15, 16, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 25, 26, 26, 27, 28, -28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 33, 32, -33, 33, 34, 33, 33, 32, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, -34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 33, 33, 32, 33, 33, 32, 32, 32, 32, 31, -31, 31, 31, 30, 30, 30, 29, 29, 29, 29, 28, 28, 28, 27, 27, 26, 26, 26, 25, 25, -24, 24, 23, 23, 22, 22, 21, 20, 20, 19, 18, 18, 17, 16, 15, 14, 13, 12, 12, 11, -10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 0, -1, -2, -3, -3, -4, -5, -6, -7, -7, -8, -9, --10, -10, -11, -12, -12, -13, -14, -14, -15, -15, -16, -17, -17, -18, -18, -19, --19, -20, -20, -21, -21, -22, -22, -23, -23, -24, -24, -25, -25, -25, -26, -26, --27, -27, -27, -27, -28, -28, -28, -28, -29, -29, -29, -29, -29, -29, -29, -29, --29, -29, -29, -30, -30, -30, -30, -30, -29, -29, -29, -29, -29, -29, -29, -29, --29, -29, -29, -29, -29, -29, -29, -29, -29, -28, -28, -28, -28, -28, -28, -28, --28, -27, -27, -27, -27, -27, -26, -26, -26, -26, -26, -25, -25, -25, -25, -25, --24, -24, -24, -24, -23, -23, -23, -23, -23, -22, -22, -22, -21, -21, -21, -21, --20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -15, -15, --15, -14, -14, -13, -13, -13, -12, -12, -12, -11, -11, -10, -10, -10, -9, -9, --8, -8, -8, -7, -7, -7, -6, -6, -5, -5, -5, -4, -4, -4, -3, -3, -3, -2, -2, -1, --1, -1, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, -7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, -6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, -2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, -3, --4, -4, -4, -4, -4, -5, -5, -5, -5, -6, -6, -6, -6, -6, -6, -7, -7, -7, -7, -7, --8, -8, -8, -8, -8, -8, -8, -9, -9, -9, -9, -9, -9, -9, -9, -10, -10, -10, -10, --10, -10, -10, -10, -10, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -12, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, --11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -10, -10, --10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -9, -9, --9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -8, -8, -8, -8, -8, -8, -8, --8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -6, --6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, --3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, --3, -2, -3, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, }; - - #endif /* kick909_H_ */ diff --git a/WaveClass3PolyPlusLPF_BETA/snare909.h b/WaveClass3PolyPlusLPF_BETA/snare909.h deleted file mode 100644 index d42b2e3..0000000 --- a/WaveClass3PolyPlusLPF_BETA/snare909.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef snare909_H_ -#define snare909_H_ - -#include "Arduino.h" -#include <avr/pgmspace.h> - -#define snare909_NUM_CELLS 2048 -#define snare909_SAMPLERATE 16384 - -const char __attribute__((progmem)) snare909_DATA [] = {0, -1, 0, -1, 0, -1, 0, --1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, --1, 0, 0, -2, -2, 0, -2, -1, -3, -2, 4, -3, -7, -2, 1, -7, 6, -3, -2, -6, -8, 8, --6, 0, -3, -1, -7, 0, -4, -11, -2, 3, -7, -9, 19, -1, 33, 43, 22, 60, 57, 49, -58, 55, 68, 65, 62, 60, 60, 69, 64, 61, 57, 58, 43, 50, 39, 37, 27, 17, 21, 15, -11, -2, -6, -12, -6, -23, -7, -22, -30, -22, -25, -27, -26, -31, -31, -21, -18, --8, -18, -4, 3, 1, 8, 12, 12, 19, 14, 42, 28, 21, 43, 45, 49, 46, 46, 43, 55, -44, 47, 44, 30, 46, 34, 38, 42, 24, 34, 27, 45, 23, 28, 38, 35, 36, 23, 30, 28, -40, 23, 32, 35, 29, 31, 31, 30, 28, 30, 30, 12, 13, 18, 8, 7, -2, 5, 6, -1, -7, --5, -9, -10, -11, -13, -17, -22, -25, -24, -24, -33, -28, -24, -30, -20, -28, --41, -28, -29, -26, -27, -37, -26, -29, -32, -20, -31, -26, -15, -20, -9, -14, --15, -12, -6, -7, -3, 8, 6, 15, 16, 12, 21, 30, 25, 35, 35, 29, 46, 44, 38, 49, -34, 48, 44, 44, 55, 38, 50, 41, 52, 43, 43, 53, 44, 56, 46, 39, 41, 44, 42, 42, -44, 41, 43, 35, 38, 39, 26, 30, 36, 31, 27, 26, 21, 20, 15, 9, 8, -2, 0, 10, --10, -13, -3, -17, -14, -14, -18, -7, -30, -24, -32, -26, -28, -37, -23, -35, --25, -40, -31, -34, -46, -30, -42, -38, -26, -37, -33, -32, -27, -32, -23, -23, --20, -13, -11, -10, -18, 0, -13, -3, -8, 3, -6, 4, 19, -1, 12, 14, 19, 10, 13, -9, 20, 19, 21, 23, 21, 34, 21, 24, 34, 20, 31, 28, 31, 36, 24, 33, 23, 31, 27, -30, 35, 37, 26, 17, 21, 19, 27, 21, 24, 17, 23, 19, 24, 19, 4, 23, 7, 15, 17, -14, 24, 8, 15, 10, 5, 6, 11, 12, -5, 9, 9, 10, 9, 1, 5, 0, -2, -2, 1, 1, -7, 0, -3, -2, -2, -8, -8, -19, -4, -18, -6, -4, -11, -5, -15, -1, -28, -12, -19, -10, --15, -23, -19, -23, -9, -25, -22, -21, -22, -18, -23, -18, -16, -31, -28, -23, --20, -27, -15, -26, -23, -22, -23, -16, -22, -29, -20, -11, -29, -12, -17, -14, --15, -12, -16, -22, -21, -8, -11, -16, -8, -13, -12, -8, -15, -14, -9, -14, -2, --13, 3, -9, -12, 9, 3, 0, 7, -3, 0, 9, 2, 9, 7, 5, 4, 18, 12, 3, 14, 17, 16, 19, -14, 6, 21, 24, 23, 18, 24, 18, 11, 25, 25, 20, 24, 22, 5, 27, 20, 13, 25, 28, -17, 19, 11, 14, 24, 10, 23, 10, 23, 19, 16, 9, 14, 9, 14, 17, 6, 13, 8, 11, -1, -17, 9, 0, 6, 4, -1, 3, -12, -10, -4, -12, -9, -14, -5, -24, -11, -14, -21, -16, --13, -18, -30, -17, -29, -25, -21, -21, -29, -30, -15, -34, -30, -21, -29, -25, --26, -28, -36, -27, -30, -28, -25, -21, -11, -31, -18, -21, -12, -12, -12, -13, --17, -15, -17, 0, -21, -9, 3, -3, -1, -7, 2, -3, 3, 3, -9, 13, 8, 5, -3, 9, 13, -3, 18, 6, 13, 13, 15, 12, 7, 10, 14, 12, 11, 3, 12, 15, 17, 6, 7, 26, -1, 16, -19, 8, 16, 12, 15, 1, 10, 20, 7, 7, 8, 17, 1, 3, 12, 8, 7, 10, 9, -4, 1, -3, 5, -1, 0, 1, 4, 3, -6, 1, -2, -2, -10, -7, -1, -3, -4, -19, 0, -10, -13, -4, -15, --8, -4, -13, -24, -10, -8, -13, -10, -11, -24, -14, -18, -6, -9, -24, -20, -10, --12, -18, -11, -14, -13, -18, -17, -28, -8, -27, -20, -14, -15, -11, -18, -9, --16, -15, -17, -16, -6, -13, -17, 3, -25, -1, -11, -4, -6, -8, -5, -14, 0, -11, -5, -3, 0, 0, -1, -12, 0, -2, -5, 6, 5, 4, 4, -11, 2, 3, -4, 12, 1, 5, -2, 3, -3, -0, 2, 6, 7, -7, 2, 1, 6, 5, -2, 0, 2, 1, 9, 1, 9, -5, -6, 7, -2, 5, -3, 16, -1, -1, 2, 4, 10, -3, 17, -2, 6, 7, 2, 9, -2, 1, -6, 10, -5, -1, 3, -8, 11, -6, 7, --1, -7, 2, -3, -6, 1, -3, -11, -3, -3, -7, -12, -4, -7, -10, -9, -18, -6, -11, --20, -3, -12, -6, -10, -24, -9, -16, -18, -9, -18, -20, -11, -9, -15, -24, -10, --20, -27, -13, -14, -13, -19, -18, -23, -21, -17, -14, -22, -15, -21, -19, -14, --19, -11, -15, -15, -17, -17, -18, -12, -12, -12, -8, -10, -17, -9, -14, -3, -5, --10, -9, -10, -8, -10, 7, -5, -3, 0, -2, 3, -3, 6, -6, -7, -1, 3, 5, 1, 4, -12, -8, 5, -1, 11, 6, -4, 3, 6, -1, 10, 1, 7, 2, 7, 6, -6, 2, 3, 3, 1, 6, 0, -3, 5, -5, 7, 1, -3, -2, -2, 6, 2, -3, 0, 3, 4, -4, 2, -5, -1, -2, -4, 0, -8, -8, -5, 2, --9, -6, -1, -2, -9, -6, -12, 1, -10, -14, -9, -13, -10, -10, -9, -10, -7, -17, --3, -13, -7, -12, -15, -16, -10, -9, -16, -7, -11, -11, -13, -14, -9, -11, -16, --17, -12, -10, -16, -10, -11, -14, -4, -14, -17, -7, -12, -6, -16, -2, -7, -9, --10, -9, -5, -18, 1, -8, 0, 1, -9, -16, -4, -3, -6, 4, -9, -2, -10, 0, 1, -10, -3, -1, -3, -2, -4, 0, 3, -3, 0, -1, 0, 2, -4, 2, -3, -8, 0, -5, 5, -7, -4, 3, --9, 6, -10, 5, 1, -4, 2, -8, 2, -6, 2, -1, 2, -2, -6, 1, -6, -5, -3, 7, -8, -5, -2, -7, -1, -8, 3, 0, 0, 1, -6, -3, -5, -3, -3, -9, -6, 1, -7, -5, -3, -3, -6, --11, -5, -1, -8, -15, -1, -8, -8, 0, -13, -9, 0, -14, -10, -9, -9, -11, -3, -11, --14, -7, -5, -4, -12, -18, -16, -2, -19, -7, -13, -5, -12, -10, -6, -23, -4, --10, -11, -8, -10, -14, -12, -5, -14, -13, -3, -8, -16, -10, -8, -15, -6, -13, --10, -11, -8, -6, -12, -9, -8, -10, -10, -8, -4, -13, -5, -6, -11, 2, -14, -2, --6, -7, -1, -11, 1, -4, -9, 3, -3, 2, -8, -1, -2, -7, -1, 0, 4, -3, 3, -7, 2, --3, -1, 1, -3, -2, -1, 7, -4, 1, -2, -2, -4, -3, 8, -9, 1, -1, -3, 4, -6, 3, 3, -0, -1, -5, -7, -2, 1, -4, 3, 0, -9, 0, -4, 4, -5, -4, 1, -3, -4, -5, -3, -7, -8, --7, 2, -9, -8, -2, -7, -3, -10, -6, -4, -12, -6, -10, -7, -10, -10, -5, -11, -3, --7, -13, -10, -8, -6, -15, -7, -7, -11, -9, -11, -8, -10, -11, -8, -6, -12, -8, --10, -8, -6, -10, -7, -8, -7, -8, -11, -3, -4, -5, -6, -12, -8, -6, -6, -3, -6, --6, -6, -2, 1, -12, -5, -4, -6, -1, -1, -7, -5, -4, -3, 1, -6, 2, -6, 0, -5, -9, -4, -7, -2, 2, -3, 1, -3, -4, -4, -1, -2, -4, 3, -5, -2, -3, -4, -1, -4, 1, -1, --10, 1, 0, -9, 2, -3, -6, -2, 6, -5, -6, -2, -3, -3, -4, -4, -6, -1, -5, -6, -1, --2, -9, -1, -2, -5, -3, 0, -5, -7, -5, -8, -1, -7, -6, -4, -2, -6, -7, -7, -8, --5, 0, -4, -12, -4, -10, -3, -4, -11, -3, -6, -6, -6, -9, -7, -9, -7, -5, -7, --2, -10, -10, -3, -10, -5, -7, -10, -6, -12, -6, -9, -4, -7, -8, -5, -12, -6, --5, -4, -9, -4, -7, -5, -5, -8, -7, -7, -9, -7, -5, -11, -3, -6, -3, -5, -8, -4, --3, -6, -8, -6, -5, -4, -5, -6, -2, -6, -6, -2, -5, -3, -4, -5, -7, -3, -2, -2, --2, -9, 1, -3, -8, 0, -3, 0, -5, -3, -2, -1, 0, -3, -3, -4, 1, -2, -8, 3, -1, --5, 1, 0, -3, -4, -4, -1, 0, -3, 2, -6, -1, -3, -6, 2, -4, -3, -3, -1, -1, -5, --3, 0, 0, -6, -1, -4, -5, -3, 0, -1, -4, -8, -4, 0, -9, 0, -4, -5, -4, -1, -5, --6, -4, -6, -3, -6, -6, -9, -4, -4, -7, -4, -3, -10, -6, -6, -5, -5, -8, -5, -9, --5, -6, -5, -6, -9, -8, -4, -5, -10, -3, -7, -6, -6, -4, -6, -9, -4, -6, -2, -7, --2, -3, -7, -4, -7, -3, -5, -3, -4, -7, -4, -3, -3, -2, -1, -5, -4, -3, -4, -3, --3, -2, -3, -1, -3, -7, 0, -3, 2, -1, -5, -3, -1, -3, -5, 1, -8, 2, -5, 0, -1, --6, -1, -2, 2, -5, -1, -1, -2, -2, -1, -6, 0, -5, -2, 0, -5, -2, -4, 1, -5, -4, --2, 0, -5, -3, 0, -5, -1, -2, -3, -3, -4, -2, -3, -3, -5, -4, -2, -6, -3, -6, --4, -3, -6, -3, -2, -5, -5, -5, -4, -5, -3, -3, -8, -2, -6, -3, -4, -9, -1, -8, --4, -4, -7, -2, -6, -3, -5, -4, -3, -5, -3, -8, -4, -8, -5, -3, -8, -1, -7, -2, --4, -6, -5, -3, -4, -3, -4, -4, -1, -5, -2, -5, -2, -3, -4, -3, -5, -2, -4, -1, --4, -4, -1, -3, -1, -4, -4, -3, -2, -3, -1, -3, -5, -2, -1, -3, -2, 0, -4, -2, --3, -4, -2, -3, -2, -2, -1, -3, -4, -2, -3, -2, -3, 0, -5, -2, -1, -3, -1, -2, --1, -5, -2, -1, -2, -2, -2, -1, -2, -2, -3, -2, -4, -2, -1, -3, -2, -2, -2, -2, --1, -4, -4, -1, -3, -2, -1, -6, -1, -4, -4, -2, -5, -1, -4, -1, -4, -4, -2, -3, --4, -2, -4, -4, -3, -4, -1, -5, -5, -3, -3, -4, -4, -5, -3, -3, -6, -4, -4, -3, --4, -4, -3, -4, -3, -5, -5, -4, -6, -2, -6, -3, -4, -4, -3, -5, -2, -5, -5, -3, --3, -4, -4, -4, -2, -3, -4, -4, -4, -2, -3, -3, -3, -3, -3, -2, -2, -4, -1, -2, --3, -1, -3, -1, -2, -3, -3, -1, -4, -3, -1, -2, -2, -1, -2, -2, -2, -3, -1, -2, --1, -1, -3, -2, -1, -2, -2, -2, -1, -1, -1, -2, -2, -1, -2, -1, -2, -2, -1, -2, --2, -2, -1, -2, -2, -1, -2, -2, -1, -2, -2, -2, -2, -1, -2, -3, -2, -2, -2, -2, --2, -2, -2, -2, -3, -3, -2, -2, -3, -2, -3, -3, -3, -3, -2, -3, -2, -3, -3, -3, --3, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -3, -3, -3, --3, -3, -3, -3, -3, -3, -2, -3, -3, -2, -3, -2, -2, -2, -2, -2, -3, -2, -2, -3, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --1, -2, -2, -2, -2, -1, -2, -1, -1, -2, -2, -1, -2, -1, -2, -2, -2, -2, -1, -2, --2, -2, -2, -1, -1, -2, -1, -2, -1, -2, -2, -1, -1, -1, -2, -1, -2, -1, -2, -1, --1, -2, -1, -1, -1, -1, -1, -1, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, --2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, }; - - #endif /* snare909_H_ */ diff --git a/WaveClass4PolyPlusLPF_BETA/ADSRslow.h b/WaveClass4PolyPlusLPF_BETA/ADSRslow.h deleted file mode 100644 index 760d136..0000000 --- a/WaveClass4PolyPlusLPF_BETA/ADSRslow.h +++ /dev/null @@ -1,307 +0,0 @@ -/* - * ADSR.h - * - * Copyright 2012 Tim Barrass. - * - * This file is part of Mozzi. - * - * Mozzi is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Mozzi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Mozzi. If not, see <http://www.gnu.org/licenses/>. - * - */ - -#ifndef ADSR_H_ -#define ADSR_H_ - -#include "Arduino.h" -//#include <util/atomic.h> -#include "Line.h" -#include "mozzi_fixmath.h" - -/** A simple ADSR envelope generator. -@todo Test whether using the template parameter makes any difference to speed, -and rationalise which units which do and don't need them. -Template objects are messy when you try to use pointers to them, -you have to include the whole template shebang in the pointer handling. -*/ -template <unsigned int CONTROL_UPDATE_RATE> -class ADSR -{ -private: - - const unsigned int AUDIO_TICKS_PER_CONTROL; - - unsigned int phase_control_step_counter; - unsigned int phase_num_control_steps; - - enum {ATTACK,DECAY,SUSTAIN,RELEASE,IDLE}; - - - struct phase{ - byte phase_type; - unsigned int control_steps; - unsigned long audio_steps; - Q8n0 level; - }attack,decay,sustain,release,idle; - - phase * current_phase; - - // Linear audio rate transitions for envelope - Line <unsigned long> transition; - - inline - unsigned int convertMsecToControlSteps(unsigned int msec){ - return (uint) (((ulong)msec*CONTROL_UPDATE_RATE)>>10); // approximate /1000 with shift - } - - inline - void setPhase(phase * next_phase) { - phase_control_step_counter = 0; - phase_num_control_steps = next_phase->control_steps; - transition.set(Q8n0_to_Q16n16(next_phase->level),next_phase-> control_steps); - current_phase = next_phase; - } - - - - inline - void checkForAndSetNextPhase(phase * next_phase) { - if (++phase_control_step_counter >= phase_num_control_steps){ - setPhase(next_phase); - } - } - - - inline - void checkForAndSetIdle() { - if (++phase_control_step_counter >= phase_num_control_steps){ - transition.set(0,0,1); - current_phase = &idle; - } - } - - - -inline - void setTime(phase * p, unsigned int msec) - { - p->control_steps=convertMsecToControlSteps(msec); - p->audio_steps = (ulong) p->control_steps * AUDIO_TICKS_PER_CONTROL; - } - - -public: - - /** Constructor. - */ - ADSR():AUDIO_TICKS_PER_CONTROL(AUDIO_RATE/CONTROL_UPDATE_RATE) - { - attack.phase_type = ATTACK; - decay.phase_type = DECAY; - sustain.phase_type = SUSTAIN; - release.phase_type = RELEASE; - idle.phase_type = IDLE; - release.level = 0; - } - - -/** Updates the internal controls of the ADSR. - Call this in updateControl(). - */ - void update(){ // control rate - - switch(current_phase->phase_type) { - - case ATTACK: - checkForAndSetNextPhase(&decay); - break; - - case DECAY: - checkForAndSetNextPhase(&sustain); - break; - - case SUSTAIN: - checkForAndSetNextPhase(&release); - break; - - case RELEASE: - checkForAndSetIdle(); - break; - - } - } - - /** Advances one audio step along the ADSR and returns the level. - Call this in updateAudio(). - @return the next value, as an unsigned int. - */ - inline - unsigned int next() - { - return Q16n16_to_Q16n0(transition.next()); - } - - - - /** Start the attack phase of the ADSR. THis will restart the ADSR no matter what phase it is up to. - */ - inline - void noteOn(){ - setPhase(&attack); - } - - - - /** Start the release phase of the ADSR. - @todo fix release for rate rather than steps (time), so it releases at the same rate whatever the current level. - */ - inline - void noteOff(){ - setPhase(&release); - } - - - - - - /** Set the attack level of the ADSR. - @param value the attack level. - */ - inline - void setAttackLevel(byte value) - { - attack.level=value; - } - - - - /** Set the decay level of the ADSR. - @param value the decay level. - */ - inline - void setDecayLevel(byte value) - { - decay.level=value; - } - - - /** Set the sustain level of the ADSR. - @param value the sustain level. Usually the same as the decay level, - for a steady sustained note. - */ - inline - void setSustainLevel(byte value) - { - sustain.level=value; - } - - /** Set the release level of the ADSR. Normally you'd make this 0, - but you have the option of some other value. - @param value the release level (normally 0). - */ - inline - void setReleaseLevel(byte value) - { - release.level=value; - } - - - - /** Set the attack and decay levels of the ADSR. This assumes a conventional - ADSR where the sustain continues at the same level as the decay, till the release ramps to 0. - @param attack the new attack level. - @param value the new sustain level. - */ - inline - void setADLevels(byte attack, byte decay) - { - setAttackLevel(attack); - setDecayLevel(decay); - setSustainLevel(decay); - setReleaseLevel(0); - } - - - - - - - - /** Set the attack time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - @param value the unsigned int attack time in milliseconds. - */ - inline - void setAttackTime(unsigned int msec) - { - setTime(&attack, msec); - } - - - /** Set the decay time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - @param value the unsigned int decay time in milliseconds. - */ - inline - void setDecayTime(unsigned int msec) - { - setTime(&decay, msec); - } - - - /** Set the sustain time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - The sustain phase will finish if the ADSR recieves a noteOff(). - @param value the unsigned int sustain time in milliseconds. - */ - inline - void setSustainTime(unsigned int msec) - { - setTime(&sustain, msec); - } - - - - /** Set the release time of the ADSR in milliseconds. - The actual time taken will be resolved within the resolution of CONTROL_RATE. - @param value the unsigned int release time in milliseconds. - */ - inline - void setReleaseTime(unsigned int msec) - { - setTime(&release, msec); - } - - - - /** Set the attack, decay and release times of the ADSR in milliseconds. - The actual times will be resolved within the resolution of CONTROL_RATE. - @param attack_ms the new attack time in milliseconds. - @param decay_ms the new decay time in milliseconds. - @param decay_ms the new sustain time in milliseconds. - @param release_ms the new release time in milliseconds. - */ - inline - void setTimes(unsigned int attack_ms, unsigned int decay_ms, unsigned int sustain_ms, unsigned int release_ms) - { - setAttackTime(attack_ms); - setDecayTime(decay_ms); - setSustainTime(sustain_ms); - setReleaseTime(release_ms); - } - - -}; - -#endif /* ADSR_H_ */ - diff --git a/WaveClass4PolyPlusLPF_BETA/Wave.h b/WaveClass4PolyPlusLPF_BETA/Wave.h deleted file mode 100644 index a9afd72..0000000 --- a/WaveClass4PolyPlusLPF_BETA/Wave.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Wave.h - * - * Simon Green 2013. - * - * Based on Mozzi "Oscil.h" - */ - -#ifndef WAVE_H_ -#define WAVE_H_ - -#include "Arduino.h" -#include "mozzi_fixmath.h" -#include <util/atomic.h> - -// fractional bits for oscillator index precision -#define OSCIL_F_BITS 16 -#define OSCIL_F_BITS_AS_MULTIPLIER 65536 -#define NUM_TABLE_CELLS 256 -#define ADJUST_FOR_NUM_TABLE_CELLS 8 -#define UPDATE_RATE AUDIO_RATE - -/** Generate waveform -*/ - -enum WaveType { WAVE_SAW=0, WAVE_TRI, WAVE_RECT, WAVE_NOISE }; - -class Wave -{ -public: - /** Constructor. "Wave mywave;" makes a Wave oscillator - */ - Wave () { - phase_fractional = 0; - phase_increment_fractional = 0; - wavetype = WAVE_SAW; - noise = 0xACE1; - pulse_width = 128; - } - - /** Increments one step along the phase. - @return the next value. - */ - inline - char next() - { - incrementPhase(); - - char w; - //ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - int n = (phase_fractional >> OSCIL_F_BITS) & (NUM_TABLE_CELLS-1); - switch(wavetype) { - case WAVE_SAW: - w = n - 128; - break; - case WAVE_TRI: - if (n & 0x80) // >= 128 - w = ((n^0xFF)<<1)-128; - else - w = (n<<1)-128; - break; - case WAVE_RECT: - if (n > pulse_width) - w = 127; - else - w = -127; - break; - case WAVE_NOISE: - noise = (noise >> 1) ^ (-(noise & 1) & 0xB400u); - w = noise>>8; - break; - } - } - return w; - } - - /** Set the wave type - */ - inline - void setType(WaveType x) - { - wavetype = x; - } - - WaveType getType() { return wavetype; } - - /** Set the pulse width for rectangle wave - */ - inline - void setPulseWidth(unsigned char x) - { - pulse_width = x; - } - - /** Set the oscillator frequency with an unsigned int. This is faster than using a - float, so it's useful when processor time is tight, but it can be tricky with - low and high frequencies, depending on the size of the wavetable being used. If - you're not getting the results you expect, try explicitly using a float, or try - setFreq_Q24n8() or or setFreq_Q16n16(). - @param frequency to play the wave table. - */ - inline - void setFreq (unsigned int frequency) { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - phase_increment_fractional = ((((unsigned long)NUM_TABLE_CELLS<<ADJUST_FOR_NUM_TABLE_CELLS)*frequency)/UPDATE_RATE) << (OSCIL_F_BITS - ADJUST_FOR_NUM_TABLE_CELLS); - } - } - - - /** Set the oscillator frequency with a float. Using a float is the most reliable - way to set frequencies, -Might- be slower than using an int but you need either - this, setFreq_Q24n8() or setFreq_Q16n16() for fractional frequencies. - @param frequency to play the wave table. - */ - inline - void setFreq(float frequency) - { // 1 us - using float doesn't seem to incur measurable overhead with the oscilloscope - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - phase_increment_fractional = (unsigned long)((((float)NUM_TABLE_CELLS * frequency)/UPDATE_RATE) * OSCIL_F_BITS_AS_MULTIPLIER); - } - } - - - /** Set the frequency using Q24n8 fixed-point number format. - This might be faster than the float version for setting low frequencies such as - 1.5 Hz, or other values which may not work well with your table size. A Q24n8 - representation of 1.5 is 384 (ie. 1.5 * 256). Can't be used with UPDATE_RATE - less than 64 Hz. - @param frequency in Q24n8 fixed-point number format. - */ - inline - void setFreq_Q24n8(Q24n8 frequency) - { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - //phase_increment_fractional = (frequency* (NUM_TABLE_CELLS>>3)/(UPDATE_RATE>>6)) << (F_BITS-(8-3+6)); - phase_increment_fractional = (((((unsigned long)NUM_TABLE_CELLS<<ADJUST_FOR_NUM_TABLE_CELLS)>>3)*frequency)/(UPDATE_RATE>>6)) - << (OSCIL_F_BITS - ADJUST_FOR_NUM_TABLE_CELLS - (8-3+6)); - } - } - - - /** Set the frequency using Q16n16 fixed-point number format. This is useful in - combination with Q16n16_mtof(), a fast alternative to mtof(), using Q16n16 - fixed-point format instead of floats. Note: this should work OK with tables 2048 cells or smaller and - frequencies up to 4096 Hz. Can't be used with UPDATE_RATE less than 64 Hz. - @param frequency in Q16n16 fixed-point number format. - */ - inline - void setFreq_Q16n16(Q16n16 frequency) - { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - //phase_increment_fractional = ((frequency * (NUM_TABLE_CELLS>>7))/(UPDATE_RATE>>6)) << (F_BITS-16+1); - phase_increment_fractional = (((((unsigned long)NUM_TABLE_CELLS<<ADJUST_FOR_NUM_TABLE_CELLS)>>7)*frequency)/(UPDATE_RATE>>6)) - << (OSCIL_F_BITS - ADJUST_FOR_NUM_TABLE_CELLS - 16 + 1); - - } - } - -private: - /** Increments the phase of the oscillator without returning a sample. - */ - inline - void incrementPhase() - { - //phase_fractional += (phase_increment_fractional | 1); // odd phase incr, attempt to reduce frequency spurs in output - phase_fractional += phase_increment_fractional; - } - - unsigned long phase_fractional; - volatile unsigned long phase_increment_fractional; - - unsigned char pulse_width; - uint16_t noise; - - WaveType wavetype; -}; - -#endif /* WAVE_H_ */ diff --git a/WaveClass4PolyPlusLPF_BETA/WaveClass4PolyPlusLPF_BETA.ino b/WaveClass4PolyPlusLPF_BETA/WaveClass4PolyPlusLPF_BETA.ino deleted file mode 100644 index 8469753..0000000 --- a/WaveClass4PolyPlusLPF_BETA/WaveClass4PolyPlusLPF_BETA.ino +++ /dev/null @@ -1,434 +0,0 @@ - -/* Example of a sound being triggered by MIDI input. - * - * Demonstrates playing notes with Mozzi in response to MIDI input, - * using the standard Arduino MIDI library: - * http://playground.arduino.cc/Main/MIDILibrary - * - * Mozzi help/discussion/announcements: - * https://groups.google.com/forum/#!forum/mozzi-users - * - * Tim Barrass 2013. - * This example code is in the public domain. - * - * sgreen - modified to use standard Arduino midi library, added saw wave, lowpass filter - * Audio output from pin 9 (pwm) - * Midi plug pin 2 (centre) to Arduino gnd, pin 5 to RX (0) - * http://www.philrees.co.uk/midiplug.htm - * Now with drums! (still has all this code in there, commented out : ) - -S Green: -mod controller/ribbon is low pass filter cut-off -big button switches between tri/rectangle/noise/saw -(noise is at constant frequency) - -NB think mostly fixed, but may still be possible to crash filter with loud sounds, hit reset! - - */ - - -#include <MIDI.h> -#include <MozziGuts.h> -#include <Oscil.h> // oscillator template -#include <Line.h> // for envelope -#include <Sample.h> -#include <mozzi_utils.h> -#include <mozzi_analog.h> - -#include <tables/sin2048_int8.h> // sine table for oscillator -//#include <tables/saw2048_int8.h> -//#include <tables/triangle2048_int8.h> - -#include <mozzi_midi.h> -#include <ADSRslow.h> -#include <fixedMath.h> -#include <LowPassFilter.h> -#include "Wave.h" -#include <WaveShaper.h> -#include <tables/waveshape_compress_512_to_488_int16.h> - -#define MAX_NOTES 4 -//Dave G: now seems to do 4 note polyphony without clicking (higher notes are a bit grainy) -int threshold=255/MAX_NOTES; - -#define DRUM_SAMPLES 0 - -/* -#if DRUM_SAMPLES -#include "kick909.h" -#include "snare909.h" -#include "hihatc909.h" -#include "hihato909.h" -#endif -*/ - -// use #define for CONTROL_RATE, not a constant -#define CONTROL_RATE 128 // powers of 2 please - -#define ENABLE_MIDI 1 -#define DEBUG 0 -#define BPM 120 -#define STEPS_PER_BEAT 4 - -unsigned long stepCounter = 0; -unsigned long ticksPerStep = (60*CONTROL_RATE) / (BPM*STEPS_PER_BEAT); - -// audio sinewave oscillator -//Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> osc(SIN2048_DATA); -//Oscil <SAW2048_NUM_CELLS, AUDIO_RATE> osc(SAW2048_DATA); -//Oscil <TRIANGLE2048_NUM_CELLS, AUDIO_RATE> osc(TRIANGLE2048_DATA); -//Wave myosc; -//Wave lfo; -Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> lfo(SIN2048_DATA); -WaveShaper <int> aCompress(WAVESHAPE_COMPRESS_512_TO_488_DATA); // to compress instead of dividing by 2 after adding signals - -struct Channel { - Wave osc; - //Oscil <TRIANGLE2048_NUM_CELLS, AUDIO_RATE> osc; - ADSR <CONTROL_RATE> env; - byte note; - byte gain; -}; -Channel chan[MAX_NOTES]; -byte currentChan = 0; - -// envelope generator -//ADSR <CONTROL_RATE> envelope; -LowPassFilter lpf; -int crushCtrl = 0; -int gain = 32; -float octave = 1.0f; - -boolean enableDrums = false; - -int step = 0; -int waveType = 1; - -int button0_old = 0; -int button1_old = 0; - -#if DRUM_SAMPLES -// drums -Sample <kick909_NUM_CELLS, AUDIO_RATE> kickSamp(kick909_DATA); -Sample <snare909_NUM_CELLS, AUDIO_RATE> snareSamp(snare909_DATA); -Sample <hihatc909_NUM_CELLS, AUDIO_RATE> hihatcSamp(hihatc909_DATA); -Sample <hihato_NUM_CELLS, AUDIO_RATE> hihatoSamp(hihato_DATA); -#endif - -byte pattern[4][16] = { - //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 hhc - 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, // 1 hho - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, // 2 s - 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 // 3 k -}; - -// pin defines -#define LED 13 // to see if MIDI is being recieved -#define BUTTON0_PIN 2 -#define BUTTON1_PIN 3 - -// forward declarations -void HandleNoteOn(byte channel, byte note, byte velocity); -void HandleNoteOff(byte channel, byte note, byte velocity); -void HandleControlChange (byte channel, byte number, byte value); -void HandlePitchBend (byte channel, int bend); - -void setup() { - // init IO pins - pinMode(LED, OUTPUT); - -#if 0 - pinMode(BUTTON0_PIN, INPUT); - digitalWrite(BUTTON0_PIN, HIGH); // turn on pull-up resistor - - pinMode(BUTTON1_PIN, INPUT); - digitalWrite(BUTTON1_PIN, HIGH); // turn on pull-up resistor -#endif - -#if DEBUG - Serial.begin(57600); // for debugging -#endif - -#if ENABLE_MIDI - // Initiate MIDI communications, listen to all channels - MIDI.begin(MIDI_CHANNEL_OMNI); - - // Connect the HandleNoteOn function to the library, so it is called upon reception of a NoteOn. - MIDI.setHandleNoteOn(HandleNoteOn); // Put only the name of the function - MIDI.setHandleNoteOff(HandleNoteOff); // Put only the name of the function - MIDI.setHandleControlChange(HandleControlChange); - MIDI.setHandlePitchBend(HandlePitchBend); - MIDI.setHandleContinue(HandleContinue); - MIDI.setHandleStop(HandleStop); -#endif - -#if 0 - //osc.setFreq(440u); // default frequency - //myosc.setFreq(440.0f); - myosc.setFreq(440.0f*4.0f); - myosc.setPulseWidth(32); - - envelope.setADLevels(255, 200); - envelope.setTimes(50, 200, 65535, 200); -#endif - - for(int i=0; i<MAX_NOTES; i++) - { - chan[i].osc.setType(WAVE_TRI); - //chan[i].osc.setTable(TRIANGLE2048_DATA); - chan[i].osc.setPulseWidth(16); - chan[i].env.setADLevels(128, 100); - chan[i].env.setTimes(100, 200, 65535, 200); - } - - //lfo.setType(WAVE_TRI); - lfo.setFreq(10.0f); - - lpf.setResonance(128); - lpf.setCutoffFreq(255); - -#if DRUM_SAMPLES - kickSamp.setFreq((float) kick909_SAMPLERATE / (float) kick909_NUM_CELLS); - snareSamp.setFreq((float) snare909_SAMPLERATE / (float) snare909_NUM_CELLS); - hihatcSamp.setFreq((float) hihatc909_SAMPLERATE / (float) hihatc909_NUM_CELLS); - hihatoSamp.setFreq((float) hihato_SAMPLERATE / (float) hihato_NUM_CELLS); - //snareSamp.start(); -#endif - - //setupFastAnalogRead(); // optional - adcEnableInterrupt(); // for analog reads - - startMozzi(CONTROL_RATE); -} - -void HandleNoteOn(byte channel, byte note, byte velocity) { - //osc.setFreq(mtof(note)); // simple but less accurate frequency - //osc.setFreq_Q16n16(Q16n16_mtof(Q8n0_to_Q16n16(note))); // accurate frequency - //myosc.setFreq(mtof(note)); // accurate frequency - //envelope.noteOn(); - - // start note on next channel - NB no "note priority" at this stage - chan[currentChan].note = note; - chan[currentChan].osc.setFreq( mtof(note) ); // accurate frequency - chan[currentChan].env.noteOn(); - currentChan = (currentChan + 1) % MAX_NOTES; // just wraps around for now - - digitalWrite(LED,HIGH); -} - -void HandleNoteOff(byte channel, byte note, byte velocity) { - //envelope.noteOff(); - - // find which channel was playing this note - for(int i=0; i<MAX_NOTES; i++) { - if (chan[i].note == note) { - // kill it - chan[i].env.noteOff(); - } - } - - digitalWrite(LED,LOW); -} - -void HandleControlChange (byte channel, byte number, byte value) -{ - // http://www.indiana.edu/~emusic/cntrlnumb.html - switch(number) { - case 1: // modulation wheel - //gain = value*2; - lpf.setCutoffFreq( int(value*1.5f) ); // control messages are in [0, 127] range - break; -/* - case 105: - lpf.setCutoffFreq(value*2); // control messages are in [0, 127] range - break; -*/ - case 106: - //lpf.setResonance(value*2); - crushCtrl = value; - break; - } -} - -// pitchbend = control strip + button on Keytar -void HandlePitchBend (byte channel, int bend) -{ - //bend value from +/-8192 - //lfo.setFreq((unsigned int) (bend+8192)>>7); - for(int i=0; i<MAX_NOTES; i++) { - chan[i].osc.setPulseWidth((bend+8192) >> 8); - } - -} - -void HandleStop () { //this is the Back button on the Xbox keyboard -// octave *= 2.0f; -// if (octave > 16.0f) octave = 1.0f; -//Dave G: no longer used : ) -} - -void HandleContinue () { // the big round button on all keytars - - // change wave - waveType = (waveType + 1) & 3; - - for(int i=0; i<MAX_NOTES; i++) - { -#if 0 - switch(waveType) { - case 0: - chan[i].osc.setTable(TRIANGLE2048_DATA); - break; - case 1: - chan[i].osc.setTable(SAW2048_DATA); - break; - case 2: - chan[i].osc.setTable(SIN2048_DATA); - break; - } -#else - for(int i=0; i<MAX_NOTES; i++) - { - chan[i].osc.setType((WaveType) waveType); - } -#endif - } -} - -void updateControl(){ -#if ENABLE_MIDI - MIDI.read(); -#endif - - //envelope.update(); - - // update playing envelopes - for(int i=0; i<MAX_NOTES; i++) { - chan[i].env.update(); - chan[i].gain=chan[i].env.next(); - if (chan[i].gain>threshold) {chan[i].gain=threshold;} - // threshold=255/MAX_NOTES, genuinely not sure if this is best approach but stops crashes :) - } - -#if 0 - // push buttons - int button0 = !digitalRead(BUTTON0_PIN); // active low - int button1 = !digitalRead(BUTTON1_PIN); - - /* - if (button0) { - // trigger - //envelope.noteOn(); - //lpf.reset(); - digitalWrite(LED, HIGH); - } else { - digitalWrite(LED, LOW); - } - */ - - if (button0 && !button0_old) { - lfo.setType((WaveType) ((((int) lfo.getType()) + 1) % 3)); - } - button0_old = button0; - - if (button1 & !button1_old) { - waveType = (waveType + 1) & 3; - //myosc.setType((WaveType) waveType); - for(int i=0; i<MAX_NOTES; i++) - { - chan[i].osc.setType((WaveType) waveType); - } - } - button1_old = button1; -#endif - -#if DRUM_SAMPLES - if (enableDrums) { - // drums - stepCounter++; - if (stepCounter > ticksPerStep) { - step = (step+1) & 0xf; - stepCounter = 0; - if (pattern[0][step]) hihatcSamp.start(); - if (pattern[1][step]) hihatoSamp.start(); - if (pattern[2][step]) snareSamp.start(); - if (pattern[3][step]) kickSamp.start(); - } - } -#endif - -#if 0 - // knobs - int knob0 = adcGetResult(0); // [0, 1023] - int knob1 = adcGetResult(1); - //lpf.setCutoffFreq(knob0>>2); - //lpf.setResonance(knob1>>2); - - //crushCtrl = knob1>>7; - lfo.setFreq((float) knob0); - //myosc.setFreq((float) knob1); - //myosc.setFreq((unsigned int) knob0*20); - //myosc.setPulseWidth((unsigned char) (knob1>>2)); - - // start the next read cycle in the background - adcReadAllChannels(); -#endif - -#if DEBUG - Serial.println(knob0); -#endif -} - -// strip the low bits off! -int bitCrush(int x, int a) -{ - return (x>>a)<<a; -} - -int updateAudio() -{ - //int x = (int) (envelope.next() * osc.next())>>8; - //int x = (int) (envelope.next() * myosc.next())>>8; - //int x = (int) (envelope.next() * (lfo.next() * myosc.next())>>8)>>8; - //int x = (int) lfo.next(); - //int x = (int) (lfo.next() * myosc.next())>>8; - //int x = (int) (envelope.next() * lpf.next(myosc.next()))>>8; - //int x = (envelope.next() * lpf.next(osc.next()))>>8; - //x = bitCrush(x, crushCtrl>>4); - //x = bitCrush(x, crushCtrl); - //x = (x * crushCtrl)>>4; // simple gain - //x = x>>2; - //x = lpf.next(x); - - // sum up channels - int x = 0; - for(int i=0; i<MAX_NOTES; i++) { - x += (int) (chan[i].gain * chan[i].osc.next())>>8; - } -//Dave G: helps crash less if goes through some sort of waveshaper here? - x = aCompress.next(256u + x); - - //x = (x*gain)>>8; - //x = (x * lfo.next())>>8; - x = lpf.next(x); - -#if DRUM_SAMPLES - if (enableDrums) { - // drums please! - int drums = kickSamp.next() + snareSamp.next() + hihatcSamp.next() + hihatoSamp.next(); - //drums = (drums>>4)<<4; - x += drums*2; - } -#endif - - return x; -} - - -void loop() { - audioHook(); // required here -} - - - diff --git a/fm_v1_ino/fm_v1_ino.ino b/arduino-monosynth.ino index 4c1b965..f399fb5 100644 --- a/fm_v1_ino/fm_v1_ino.ino +++ b/arduino-monosynth.ino @@ -27,7 +27,7 @@ #include <mozzi_fixmath.h> #include <Portamento.h> #include <tables/cos2048_int8.h> // table for Oscils to play -#include <tables/square_analogue2048_int8.h> // table for Oscils to play +#include <tables/saw_analogue512_int8.h> // table for Oscils to play // use #define for CONTROL_RATE, not a constant #define CONTROL_RATE 256 // powers of 2 please @@ -35,14 +35,16 @@ // Mozzi example uses COS waves for carrier and modulator // Shit gets brutal very fast if you use a saw/square carrier // Shit gets subtly more brutal if you use smaller wavetables (fewer samples per cycle) -Oscil<SQUARE_ANALOGUE2048_NUM_CELLS, AUDIO_RATE> oscCarrier(SQUARE_ANALOGUE2048_DATA); +Oscil<SAW_ANALOGUE512_NUM_CELLS, AUDIO_RATE> oscCarrier(SAW_ANALOGUE512_DATA); Oscil<COS2048_NUM_CELLS, AUDIO_RATE> oscModulator(COS2048_DATA); Oscil<COS2048_NUM_CELLS, AUDIO_RATE> oscLFO(COS2048_DATA); // envelope generator -ADSR <CONTROL_RATE> envelope; +ADSR <CONTROL_RATE, AUDIO_RATE> envelope; Portamento <CONTROL_RATE>aPortamento; +MIDI_CREATE_DEFAULT_INSTANCE(); + #define LED 13 // to see if MIDI is being recieved unsigned long vibrato = 0; @@ -75,7 +77,7 @@ void setup() MIDI.setHandleContinue(HandleContinue); envelope.setADLevels(255, 174); - envelope.setTimes(10, 50, 20000, 10); // 20000 is so the note will sustain 20 seconds unless a noteOff comes + envelope.setTimes(10, 50, 20000, 200); // 20000 is so the note will sustain 20 seconds unless a noteOff comes aPortamento.setTime(50u); oscLFO.setFreq(10); // default frequency @@ -165,3 +167,4 @@ void loop() audioHook(); } + |
