From 3b0ccb90da36d1c92928b0b33412bdbfd40e3ce1 Mon Sep 17 00:00:00 2001 From: Jakob Bak Date: Sat, 25 Aug 2012 16:02:48 +0200 Subject: [PATCH] Added software folder, soudn and MIDI library and arduino example code --- .DS_Store | Bin 0 -> 6148 bytes Software/CFO/.DS_Store | Bin 0 -> 6148 bytes Software/CFO/CFOMidi.h | 77 +++ Software/CFO/CFOMusic.cpp | 602 ++++++++++++++++++ Software/CFO/CFOMusic.h | 159 +++++ Software/CFO/CFOWavetable.h | 289 +++++++++ Software/CFO/CFOmidi.cpp | 186 ++++++ .../Example code/Basic_MIDI/Basic_MIDI.ino | 39 ++ .../MUSIC_LIBRARY_DOCUMENTATION.ino | 88 +++ Software/Example code/Minimal/Minimal.ino | 19 + .../Repeating_note_with_envelope.ino | 50 ++ .../Spaghetti_tones/Spaghetti_tones.ino | 64 ++ .../Example code/Up_and_down/Up_and_down.ino | 62 ++ .../sketch_jun26c/sketch_jun26c.ino | 62 ++ .../Up_and_down__square.ino | 68 ++ Software/README | 9 + 16 files changed, 1774 insertions(+) create mode 100644 .DS_Store create mode 100644 Software/CFO/.DS_Store create mode 100755 Software/CFO/CFOMidi.h create mode 100755 Software/CFO/CFOMusic.cpp create mode 100755 Software/CFO/CFOMusic.h create mode 100755 Software/CFO/CFOWavetable.h create mode 100755 Software/CFO/CFOmidi.cpp create mode 100644 Software/Example code/Basic_MIDI/Basic_MIDI.ino create mode 100644 Software/Example code/MUSIC_LIBRARY_DOCUMENTATION/MUSIC_LIBRARY_DOCUMENTATION.ino create mode 100644 Software/Example code/Minimal/Minimal.ino create mode 100644 Software/Example code/Repeating_note_with_envelope/Repeating_note_with_envelope.ino create mode 100644 Software/Example code/Spaghetti_tones/Spaghetti_tones.ino create mode 100644 Software/Example code/Up_and_down/Up_and_down.ino create mode 100644 Software/Example code/Up_and_down/sketch_jun26c/sketch_jun26c.ino create mode 100644 Software/Example code/Up_and_down__square/Up_and_down__square.ino create mode 100644 Software/README diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5b7b9747a153d09f0495aed02b0cd7e24f25792e GIT binary patch literal 6148 zcmeHK%}T>S5T0$TZv25>1idYui=-6m#X|@cJPIlFU_}#CX`wWwNy(u^BfgN2;8XZK z&g^bQsa`yYlo^=)hS`~2=G(BF0RZ98<0e2I03<45#lhhlp?T63saQ`HQRp>t2w?_; zIK3OMM6=^RGC*f1VW`h7hEL}gC5b*m2>~Q<57}}u%F}5yP9jWviKgRGnz`MbkPv(<2y$Xg&9*p8a6wa=-orT#v^~0H-xeT)*&S<-fJEGmU(Y;Ze z4R7j)i$(jS)lkirTQt<7>9$WB>eOu)h2u!4{wnv6j?XT-Ve#--J{g7uevDf7EH2?0 zjg@-nW2Iu3Ny}hHW`G%B2G*AWd*jKS^(~PrV+NRkUot@VgF+?rES3iK)q#U<0T65G z)`B+m5|pDXdKOEAID;ZgDxyghw#5)89sSD2c@|59CLM%rK7`#_*bYVL-En=T!$Eik zd1MBdfv*fu?}t*S_y7Fo{$B_2zzi@0>&bwqb%KtMwb{3IrAm5h73wW23B{ELKT^=p iPcg>QQ+$A`1^tQ)M9*Sr5IrdTBcN&Eff@Ky2HpWySWzwj literal 0 HcmV?d00001 diff --git a/Software/CFO/.DS_Store b/Software/CFO/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0. + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + author: Jakob Bak + + contact: j.bak@ciid.dk + */ + +//synth parameters as MIDI controller numbers +#define ENV_ATTACK 4 +#define ENV_DECAY 5 +#define ENV_SUSTAIN 6 +#define ENV_RELEASE 7 +#define DETUNE 12 +#define WAVEFORM 13 + +// Synth parameters used in MIDI code +#define ENV_MAX_GAIN (65536 * 4 - 1) + + +class MMidi { +public: + void init(); + void checkMidi(); + void midiHandler(); + void noteOff(uint8_t channel, uint8_t note, uint8_t vel); + void noteOn(uint8_t channel, uint8_t note, uint8_t vel); + void aftertouch(uint8_t channel, uint8_t note, uint8_t pressure); + void controller(uint8_t channel, uint8_t number, uint8_t value); + void programChange(uint8_t channel, uint8_t number); + void channelPressure(uint8_t channel, uint8_t pressure); + void pitchWheel(uint8_t channel, uint8_t highBits, uint8_t lowBits); + + + +private: + // MIDI + uint16_t midiBuffer[4]; + int midiBufferIndex; + uint16_t frequency; + //uint32_t midiTime; + //bool midiNotePlayed; + + //synth + //bool noteTriggered; + //bool noteReleased; + //bool envSustainReached; + uint8_t notePlayed; + //uint16_t noteFrequency; + //uint8_t envGain; // maybe another name for the variable + //uint32_t envAttack; + //uint32_t envDecay; + //uint8_t envSustain; + //uint32_t envRelease; + //uint32_t envTime; + //uint32_t envTriggerTime; + //uint32_t envReleaseTime; + //uint32_t portamento; + +}; + +extern MMidi Midi; \ No newline at end of file diff --git a/Software/CFO/CFOMusic.cpp b/Software/CFO/CFOMusic.cpp new file mode 100755 index 0000000..810a64d --- /dev/null +++ b/Software/CFO/CFOMusic.cpp @@ -0,0 +1,602 @@ +/* + Music.cpp - Music library + Copyright (c) 2012 Copenhagen Institute of Interaction Design. + All right reserved. + + This library is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This library 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 Lesser Public License for more details. + + You should have received a copy of the GNU Lesser Public License + along with Foobar. If not, see . + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + author: Jakob Bak + + contact: j.bak@ciid.dk + */ + +#include +#include + +#include +#include +#include + +// Table of MIDI note values to frequency in Hertz +prog_uint16_t hertsTable[] PROGMEM = {8,8,9,9,10,10,11,12,12,13,14,15,16,17,18,19,20,21,23,24,25,27,29,30,32,34,36,38,41,43,46,48,51,54,58,61,65,69,73,77,82,87,92,97,103,109,116,123,130,138,146,155,164,174,184,195,207,219,233,246,261,277,293,311,329,349,369,391,415,440,466,493,523,554,587,622,659,698,739,783,830,880,932,987,1046,1108,1174,1244,1318,1396,1479,1567,1661,1760,1864,1975,2093,2217,2349,2489,2637,2793,2959,3135,3322,3520,3729,3951,4186,4434,4698,4978,5274,5587,5919,6271,6644,7040,7458,7902,8372,8869,9397,9956,10548,11175,11839,12543}; + +prog_uint32_t envTimeTable[] PROGMEM = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,33,34,35,36,37,38,39,41,42,43,45,46,48,49,51,53,55,57,59,61,63,65,67,70,73,75,78,81,85,88,92,96,100,104,109,114,119,125,131,138,146,154,163,172,183,195,209,225,242,261,284,310,341,379,425,482,556,654,792,998,1342,2030,4095}; + +CFOMusic Music; + +// Defining which pins the SPI interface is connected to. +#define SPI_SCK 5 +#define SPI_MOSI 3 + +// timer 2 is audio interrupt timer +ISR(TIMER2_COMPA_vect) { + + OCR2A = 127; + + Music.synthInterrupt(); + +} + + + + +///////////////////////////////////// +// +// INITIALIZING FUNCTION +// +///////////////////////////////////// + +void CFOMusic::init() +{ + // clear interrupts. to make sure the interrupt timer doesn't start until we've set it up. + cli(); + + // set up syntheziser + // this is the timer 2 audio rate timer, fires an interrupt at 15625 Hz sampling rate + TIMSK2 = 1< 127) note = 127; + uint16_t freq; + memcpy_P(&freq, &hertsTable[note],2); + return freq; +} + + + +///////////////////////////////////// +// +// ENVELOPE FUNCTIONS +// +///////////////////////////////////// + +void CFOMusic::enableEnvelope() +{ + envelopeOn = true; +} + + +void CFOMusic::disableEnvelope() +{ + envelopeOn = false; +} + + +void CFOMusic::setEnvStage(uint8_t stage) +{ + envStage = stage; +} + + +void CFOMusic::setAttack16bit(uint16_t att) +{ + attack = att; +} + + +void CFOMusic::setDecay16bit(uint16_t dec) +{ + decay = dec; +} + + +void CFOMusic::setSustain16bit(uint16_t sus) +{ + sustain = sus; +} + + +void CFOMusic::setRelease16bit(uint16_t rel) +{ + release = rel; +} + + +void CFOMusic::setAttack(uint8_t att) +{ + if(att>127) att = 127; + memcpy_P(&attack, &envTimeTable[127 - att],2); + //attack = envTimeTable[127 - att]; +} + + +void CFOMusic::setDecay(uint8_t dec) +{ + if(dec>127) dec = 127; + memcpy_P(&decay, &envTimeTable[127 - dec],2); + //decay = envTimeTable[127 - dec]; +} + + +void CFOMusic::setSustain(uint8_t sus) +{ + sustain = sus * (MAX_ENV_GAIN/128); +} + + +void CFOMusic::setRelease(uint8_t rel) +{ + if(rel>127) rel = 127; + memcpy_P(&release, &envTimeTable[127 - rel],2); + //release = envTimeTable[127 - rel]; +} + + +void CFOMusic::setVelSustain(uint8_t vel) +{ + velSustain = vel * (sustain / 128); +} + + + + +///////////////////////////////////// +// +// AUDIO INTERRUPT SERVICE ROUTINE +// +///////////////////////////////////// + + +void CFOMusic::synthInterrupt() +{ + // Frame sync low for SPI (making it low here so that we can measure lenght of interrupt with scope) + PORTB &= ~(1<<2); + + // The accumulator (16bit) keeps track of the pitch by adding the + // the amount of "index" points that the frequency has "travelled" + // since the last sample was sent to the DAC, i.e. the current phase + // of the waveform. + accumulator1 = accumulator1 + period1; + accumulator2 = accumulator2 + period2; + accumulator3 = accumulator3 + period3; + + // To use the accumulator position to find the right index in the + // waveform look-up table, we truncate it to 12bit. + index1 = accumulator1 >> 4; + index2 = accumulator2 >> 4; + index3 = accumulator3 >> 4; + + // SINE WAVE + // Because the waveform look-up table resides in program memory + // we most use memcpy_P to copy the data from that table to our + // oscilator variable. + if(sine) { + memcpy_P(&oscil1, &sineTable[index1],2); + memcpy_P(&oscil2, &sineTable[index2],2); + memcpy_P(&oscil3, &sineTable[index3],2); + } + + // SAWTOOTH WAVE + // Just using the index for the oscillator produces a sawtooth shaped waveform + else if(saw) { + oscil1 = index1; + oscil2 = index2; + oscil3 = index3; + } + + // SQUARE WAVE + else if(square) { + oscil1 = index1; + oscil2 = index2; + oscil3 = index3; + oscil1 &= 0x0800; + oscil1 ^= 0x0100; + oscil2 &= 0x0800; + oscil2 ^= 0x0100; + oscil3 &= 0x0800; + oscil3 ^= 0x0100; + } + + // The DAC formatting routine below assumes the sample to be transmitted + // is in the higher 12 bits of the 2 byte variable, so we shift the + // sample up 2 bits each which adds up to 4 bits. + // The individual gains for each oscillator is added. + sample = (oscil1 * gain1) << 2; + sample += (oscil2 * gain2) << 2; + sample += (oscil3 * gain3) << 2; + sample >>= 16; + + + // AMPLIFICATION ENVELOPE + // Amplification envelope is calculated here + if(envelopeOn) { + + if(envStage == 1) { + env += attack; + if(MAX_ENV_GAIN < env) { + env = MAX_ENV_GAIN; + envStage = 2; + } + } + else if(envStage == 2) { + env -= decay; + if(env < velSustain || MAX_ENV_GAIN < env) { + env = velSustain; + envStage = 3; + } + } + else if (envStage == 3) { + env = velSustain; + } + else if (envStage == 4) { + env -= release; + if(MAX_ENV_GAIN < env) { + env = 0; + envStage = 0; + } + } + else if (envStage == 0) { + env = 0; + accumulator1 = 0; + accumulator2 = 0; + accumulator3 = 0; + } + + } else { + env = 65535; + } + + // Adding the amplification envelope (16bit) we bring it back to the 16bit frame again afterwards. + sample = (env * sample) >> 16; + + + // Formatting the samples to be transfered to the MCP4921 DAC + dacSPI0 = sample >> 8; + dacSPI0 >>= 4; + dacSPI0 |= 0x30; + dacSPI1 = sample >> 4; + + SPCR |= (1 << MSTR); + + // transmit value out the SPI port + SPDR = dacSPI0; + while (!(SPSR & (1<. + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + author: Jakob Bak + + contact: j.bak@ciid.dk + */ + + +// current sample rate is 15625 as defined in the init() section +#define SAMPLE_RATE 15625 + +// Number of oscillators. Set not higher than 4. +#define NUM_OSCILLATORS 2 + +// Maximum possible value for amplification envelope +#define MAX_ENV_GAIN 65535 + +class CFOMusic { +public: + + // INITIALIZER + void init(); + + // AUDIO INTERRUPT SERVICE ROUTINE + void synthInterrupt(); + + // FREQUENCY AND DETUNE FUNCTIONS + void setFrequency(float frequency); + void setFrequency1(float frequency1); + void setFrequency2(float frequency2); + void setFrequency3(float frequency3); + void setDetune(float detune); + void setDetune1(float detune); + void setDetune2(float detune); + void setDetune3(float detune); + void pitchBend(float b); + + // WAVEFORM FUNCTIONS + void setSine(); + void setSaw(); + void setSquare(); + + // GAIN FUNCTIONS + void setGainFloat(float value); // 0.0 - 1.0 + void setGain16bit(uint16_t value); // 0 - 65535 + void setGain(uint16_t value); // 0 - 65535 + void setGain(float value); // 0.0 - 1.0 + void setGain1(uint16_t value); // 0 - 65535 + void setGain2(uint16_t value); // 0 - 65535 + void setGain3(uint16_t value); // 0 - 65535 + void setGain1(float value); // 0.0 - 1.0 + void setGain2(float value); // 0.0 - 1.0 + void setGain3(float value); // 0.0 - 1.0 + float getGainFloat(); + uint16_t getGain(); + + // NOTE FUNCTIONS + void noteOn(uint8_t note, uint8_t vel); // 0 - 127 + void noteOn(uint8_t note); // 0 - 127 + void noteOff(uint8_t note); // 0 - 127 + void noteOff(); + uint16_t getNoteFrequency(uint8_t note); // 0 - 127 + + // ENVELOPE FUNCTIONS + void enableEnvelope(); + void disableEnvelope(); + void setEnvStage(uint8_t stage); // 0 - 4 + + void setAttack16bit(uint16_t att); // 0 - 65535 + void setDecay16bit(uint16_t dec); // 0 - 65535 + void setSustain16bit(uint16_t sus); // 0 - 65535 + void setRelease16bit(uint16_t rel); // 0 - 65535 + + void setAttack(uint8_t att); // 0 - 127 + void setDecay(uint8_t dec); // 0 - 127 + void setSustain(uint8_t sus); // 0 - 127 + void setRelease(uint8_t rel); // 0 - 127 + + void setVelSustain(uint8_t vel); // 0 -255 + + + +private: + + // WAVEFORM VARIABLES + uint8_t waveForm; + bool sine; + bool saw; + bool square; + + // FREQUENCY VARIABLES + uint16_t period1; + uint16_t period2; + uint16_t period3; + uint16_t frequency16bit; + float frequency; + float frequency1; + float frequency2; + float frequency3; + float detune1; + float detune2; + float detune3; + float bend; + + // OSCILLATOR VARIABLES + uint16_t accumulator1; + uint16_t accumulator2; + uint16_t accumulator3; + uint16_t index1; + uint16_t index2; + uint16_t index3; + uint32_t oscil1; + uint32_t oscil2; + uint32_t oscil3; + uint16_t gain; + uint16_t gain1; + uint16_t gain2; + uint16_t gain3; + + // ENVELOPE VARIABLES + bool envelopeOn; + uint32_t env; + uint8_t envStage; + + uint16_t attack; + uint16_t decay; + uint16_t sustain; + uint16_t release; + uint16_t velSustain; + + // NOTE VARIABLE + uint8_t notePlayed; + + // final sample that goes to the DAC + uint32_t sample; + + // the two bytes that go to the DAC over SPI + uint8_t dacSPI0; + uint8_t dacSPI1; + +}; + +extern CFOMusic Music; diff --git a/Software/CFO/CFOWavetable.h b/Software/CFO/CFOWavetable.h new file mode 100755 index 0000000..a9dde99 --- /dev/null +++ b/Software/CFO/CFOWavetable.h @@ -0,0 +1,289 @@ +/* + Music.h - Music library + Copyright (c) 2012 Copenhagen Institute of Interaction Design. + All right reserved. + + This library is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This library 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 Lesser Public License for more details. + + You should have received a copy of the GNU Lesser Public License + along with Foobar. If not, see . + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + author: Jakob Bak + + contact: j.bak@ciid.dk + */ + +//uint32_t envTimeTable[] = {1,2,5,8,11,14,18,22,27,31,36,41,46,52,58,64,70,76,82,89,96,103,110,117,125,132,140,148,156,164,172,181,189,198,207,216,225,234,243,252,262,272,281,291,301,311,322,332,343,353,364,374,385,396,407,419,430,441,453,464,476,488,500,512,524,536,548,560,573,585,598,610,623,636,649,662,675,688,702,715,729,742,756,769,783,797,811,825,839,853,868,882,896,911,925,940,955,970,985,1000,1015,1030,1045,1060,1075,1091,1106,1122,1137,1153,1169,1185,1201,1217,1233,1249,1265,1281,1298,1314,1331,1347,1364,1380,1397,1414,1431,1448,1465,1482,1499,1516,1533,1551,1568,1586,1603,1621,1638,1656,1674,1692,1710,1728,1746,1764,1782,1800,1818,1837,1855,1873,1892,1911,1929,1948,1967,1986,2004,2023,2042,2061,2081,2100,2119,2138,2158,2177,2197,2216,2236,2255,2275,2295,2315,2334,2354,2374,2394,2414,2435,2455,2475,2495,2516,2536,2557,2577,2598,2618,2639,2660,2681,2702,2723,2744,2765,2786,2807,2828,2849,2870,2892,2913,2935,2956,2978,2999,3021,3043,3064,3086,3108,3130,3152,3174,3196,3218,3240,3263,3285,3307,3330,3352,3375,3397,3420,3442,3465,3488,3510,3533,3556,3579,3602,3625,3648,3671,3694,3718,3741,3764,3787,3811,3834,3858,3881,3905,3929,3952,3976,4000,4024,4048,4072,4095}; + +//prog_uint16_t hertzTable[] PROGMEM = {8,8,9,9,10,10,11,12,12,13,14,15,16,17,18,19,20,21,23,24,25,27,29,30,32,34,36,38,41,43,46,48,51,54,58,61,65,69,73,77,82,87,92,97,103,109,116,123,130,138,146,155,164,174,184,195,207,219,233,246,261,277,293,311,329,349,369,391,415,440,466,493,523,554,587,622,659,698,739,783,830,880,932,987,1046,1108,1174,1244,1318,1396,1479,1567,1661,1760,1864,1975,2093,2217,2349,2489,2637,2793,2959,3135,3322,3520,3729,3951,4186,4434,4698,4978,5274,5587,5919,6271,6644,7040,7458,7902,8372,8869,9397,9956,10548,11175,11839,12543}; + +// Look-up table for sine waveform in 12 bit resolution in +// both amplitude and time. + +prog_uint16_t sineTable[] PROGMEM ={ + + 0x7FF, 0x802, 0x806, 0x809, 0x80C, 0x80F, 0x812, 0x815, 0x818, 0x81C, 0x81F, 0x822, 0x825, 0x828, 0x82B, 0x82E, + 0x832, 0x835, 0x838, 0x83B, 0x83E, 0x841, 0x844, 0x847, 0x84B, 0x84E, 0x851, 0x854, 0x857, 0x85A, 0x85D, 0x861, + 0x864, 0x867, 0x86A, 0x86D, 0x870, 0x873, 0x877, 0x87A, 0x87D, 0x880, 0x883, 0x886, 0x889, 0x88C, 0x890, 0x893, + 0x896, 0x899, 0x89C, 0x89F, 0x8A2, 0x8A6, 0x8A9, 0x8AC, 0x8AF, 0x8B2, 0x8B5, 0x8B8, 0x8BB, 0x8BF, 0x8C2, 0x8C5, + 0x8C8, 0x8CB, 0x8CE, 0x8D1, 0x8D4, 0x8D8, 0x8DB, 0x8DE, 0x8E1, 0x8E4, 0x8E7, 0x8EA, 0x8ED, 0x8F1, 0x8F4, 0x8F7, + 0x8FA, 0x8FD, 0x900, 0x903, 0x906, 0x909, 0x90D, 0x910, 0x913, 0x916, 0x919, 0x91C, 0x91F, 0x922, 0x926, 0x929, + 0x92C, 0x92F, 0x932, 0x935, 0x938, 0x93B, 0x93E, 0x941, 0x945, 0x948, 0x94B, 0x94E, 0x951, 0x954, 0x957, 0x95A, + 0x95D, 0x960, 0x964, 0x967, 0x96A, 0x96D, 0x970, 0x973, 0x976, 0x979, 0x97C, 0x97F, 0x982, 0x985, 0x989, 0x98C, + 0x98F, 0x992, 0x995, 0x998, 0x99B, 0x99E, 0x9A1, 0x9A4, 0x9A7, 0x9AA, 0x9AE, 0x9B1, 0x9B4, 0x9B7, 0x9BA, 0x9BD, + 0x9C0, 0x9C3, 0x9C6, 0x9C9, 0x9CC, 0x9CF, 0x9D2, 0x9D5, 0x9D8, 0x9DB, 0x9DF, 0x9E2, 0x9E5, 0x9E8, 0x9EB, 0x9EE, + 0x9F1, 0x9F4, 0x9F7, 0x9FA, 0x9FD, 0xA00, 0xA03, 0xA06, 0xA09, 0xA0C, 0xA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D, 0xA6A, 0xA67, 0xA64, 0xA61, 0xA5E, 0xA5B, 0xA58, 0xA55, + 0xA52, 0xA4F, 0xA4C, 0xA49, 0xA46, 0xA43, 0xA40, 0xA3D, 0xA3A, 0xA37, 0xA34, 0xA31, 0xA2E, 0xA2A, 0xA27, 0xA24, + 0xA21, 0xA1E, 0xA1B, 0xA18, 0xA15, 0xA12, 0xA0F, 0xA0C, 0xA09, 0xA06, 0xA03, 0xA00, 0x9FD, 0x9FA, 0x9F7, 0x9F4, + 0x9F1, 0x9EE, 0x9EB, 0x9E8, 0x9E5, 0x9E2, 0x9DF, 0x9DB, 0x9D8, 0x9D5, 0x9D2, 0x9CF, 0x9CC, 0x9C9, 0x9C6, 0x9C3, + 0x9C0, 0x9BD, 0x9BA, 0x9B7, 0x9B4, 0x9B1, 0x9AE, 0x9AA, 0x9A7, 0x9A4, 0x9A1, 0x99E, 0x99B, 0x998, 0x995, 0x992, + 0x98F, 0x98C, 0x989, 0x985, 0x982, 0x97F, 0x97C, 0x979, 0x976, 0x973, 0x970, 0x96D, 0x96A, 0x967, 0x964, 0x960, + 0x95D, 0x95A, 0x957, 0x954, 0x951, 0x94E, 0x94B, 0x948, 0x945, 0x941, 0x93E, 0x93B, 0x938, 0x935, 0x932, 0x92F, + 0x92C, 0x929, 0x926, 0x922, 0x91F, 0x91C, 0x919, 0x916, 0x913, 0x910, 0x90D, 0x909, 0x906, 0x903, 0x900, 0x8FD, + 0x8FA, 0x8F7, 0x8F4, 0x8F1, 0x8ED, 0x8EA, 0x8E7, 0x8E4, 0x8E1, 0x8DE, 0x8DB, 0x8D8, 0x8D4, 0x8D1, 0x8CE, 0x8CB, + 0x8C8, 0x8C5, 0x8C2, 0x8BF, 0x8BB, 0x8B8, 0x8B5, 0x8B2, 0x8AF, 0x8AC, 0x8A9, 0x8A6, 0x8A2, 0x89F, 0x89C, 0x899, + 0x896, 0x893, 0x890, 0x88C, 0x889, 0x886, 0x883, 0x880, 0x87D, 0x87A, 0x877, 0x873, 0x870, 0x86D, 0x86A, 0x867, + 0x864, 0x861, 0x85D, 0x85A, 0x857, 0x854, 0x851, 0x84E, 0x84B, 0x847, 0x844, 0x841, 0x83E, 0x83B, 0x838, 0x835, + 0x832, 0x82E, 0x82B, 0x828, 0x825, 0x822, 0x81F, 0x81C, 0x818, 0x815, 0x812, 0x80F, 0x80C, 0x809, 0x806, 0x802, + 0x7FF, 0x7FC, 0x7F9, 0x7F6, 0x7F3, 0x7F0, 0x7EC, 0x7E9, 0x7E6, 0x7E3, 0x7E0, 0x7DD, 0x7DA, 0x7D6, 0x7D3, 0x7D0, + 0x7CD, 0x7CA, 0x7C7, 0x7C4, 0x7C0, 0x7BD, 0x7BA, 0x7B7, 0x7B4, 0x7B1, 0x7AE, 0x7AA, 0x7A7, 0x7A4, 0x7A1, 0x79E, + 0x79B, 0x798, 0x794, 0x791, 0x78E, 0x78B, 0x788, 0x785, 0x782, 0x77F, 0x77B, 0x778, 0x775, 0x772, 0x76F, 0x76C, + 0x769, 0x765, 0x762, 0x75F, 0x75C, 0x759, 0x756, 0x753, 0x750, 0x74C, 0x749, 0x746, 0x743, 0x740, 0x73D, 0x73A, + 0x737, 0x733, 0x730, 0x72D, 0x72A, 0x727, 0x724, 0x721, 0x71E, 0x71A, 0x717, 0x714, 0x711, 0x70E, 0x70B, 0x708, + 0x705, 0x701, 0x6FE, 0x6FB, 0x6F8, 0x6F5, 0x6F2, 0x6EF, 0x6EC, 0x6E9, 0x6E5, 0x6E2, 0x6DF, 0x6DC, 0x6D9, 0x6D6, + 0x6D3, 0x6D0, 0x6CD, 0x6C9, 0x6C6, 0x6C3, 0x6C0, 0x6BD, 0x6BA, 0x6B7, 0x6B4, 0x6B1, 0x6AE, 0x6AA, 0x6A7, 0x6A4, + 0x6A1, 0x69E, 0x69B, 0x698, 0x695, 0x692, 0x68F, 0x68C, 0x688, 0x685, 0x682, 0x67F, 0x67C, 0x679, 0x676, 0x673, + 0x670, 0x66D, 0x66A, 0x667, 0x663, 0x660, 0x65D, 0x65A, 0x657, 0x654, 0x651, 0x64E, 0x64B, 0x648, 0x645, 0x642, + 0x63F, 0x63C, 0x638, 0x635, 0x632, 0x62F, 0x62C, 0x629, 0x626, 0x623, 0x620, 0x61D, 0x61A, 0x617, 0x614, 0x611, + 0x60E, 0x60B, 0x608, 0x605, 0x602, 0x5FE, 0x5FB, 0x5F8, 0x5F5, 0x5F2, 0x5EF, 0x5EC, 0x5E9, 0x5E6, 0x5E3, 0x5E0, + 0x5DD, 0x5DA, 0x5D7, 0x5D4, 0x5D1, 0x5CE, 0x5CB, 0x5C8, 0x5C5, 0x5C2, 0x5BF, 0x5BC, 0x5B9, 0x5B6, 0x5B3, 0x5B0, + 0x5AD, 0x5AA, 0x5A7, 0x5A4, 0x5A1, 0x59E, 0x59B, 0x598, 0x595, 0x592, 0x58F, 0x58C, 0x589, 0x586, 0x583, 0x580, + 0x57D, 0x57A, 0x577, 0x574, 0x571, 0x56E, 0x56B, 0x568, 0x565, 0x562, 0x55F, 0x55C, 0x559, 0x556, 0x553, 0x550, + 0x54D, 0x54A, 0x547, 0x545, 0x542, 0x53F, 0x53C, 0x539, 0x536, 0x533, 0x530, 0x52D, 0x52A, 0x527, 0x524, 0x521, + 0x51E, 0x51B, 0x518, 0x515, 0x513, 0x510, 0x50D, 0x50A, 0x507, 0x504, 0x501, 0x4FE, 0x4FB, 0x4F8, 0x4F5, 0x4F3, + 0x4F0, 0x4ED, 0x4EA, 0x4E7, 0x4E4, 0x4E1, 0x4DE, 0x4DB, 0x4D8, 0x4D6, 0x4D3, 0x4D0, 0x4CD, 0x4CA, 0x4C7, 0x4C4, + 0x4C1, 0x4BF, 0x4BC, 0x4B9, 0x4B6, 0x4B3, 0x4B0, 0x4AD, 0x4AB, 0x4A8, 0x4A5, 0x4A2, 0x49F, 0x49C, 0x499, 0x497, + 0x494, 0x491, 0x48E, 0x48B, 0x488, 0x486, 0x483, 0x480, 0x47D, 0x47A, 0x477, 0x475, 0x472, 0x46F, 0x46C, 0x469, + 0x467, 0x464, 0x461, 0x45E, 0x45B, 0x459, 0x456, 0x453, 0x450, 0x44D, 0x44B, 0x448, 0x445, 0x442, 0x43F, 0x43D, + 0x43A, 0x437, 0x434, 0x432, 0x42F, 0x42C, 0x429, 0x427, 0x424, 0x421, 0x41E, 0x41C, 0x419, 0x416, 0x413, 0x411, + 0x40E, 0x40B, 0x408, 0x406, 0x403, 0x400, 0x3FE, 0x3FB, 0x3F8, 0x3F5, 0x3F3, 0x3F0, 0x3ED, 0x3EB, 0x3E8, 0x3E5, + 0x3E2, 0x3E0, 0x3DD, 0x3DA, 0x3D8, 0x3D5, 0x3D2, 0x3D0, 0x3CD, 0x3CA, 0x3C8, 0x3C5, 0x3C2, 0x3C0, 0x3BD, 0x3BA, + 0x3B8, 0x3B5, 0x3B2, 0x3B0, 0x3AD, 0x3AA, 0x3A8, 0x3A5, 0x3A3, 0x3A0, 0x39D, 0x39B, 0x398, 0x395, 0x393, 0x390, + 0x38E, 0x38B, 0x388, 0x386, 0x383, 0x381, 0x37E, 0x37B, 0x379, 0x376, 0x374, 0x371, 0x36E, 0x36C, 0x369, 0x367, + 0x364, 0x362, 0x35F, 0x35C, 0x35A, 0x357, 0x355, 0x352, 0x350, 0x34D, 0x34B, 0x348, 0x346, 0x343, 0x340, 0x33E, + 0x33B, 0x339, 0x336, 0x334, 0x331, 0x32F, 0x32C, 0x32A, 0x327, 0x325, 0x322, 0x320, 0x31D, 0x31B, 0x318, 0x316, + 0x313, 0x311, 0x30E, 0x30C, 0x30A, 0x307, 0x305, 0x302, 0x300, 0x2FD, 0x2FB, 0x2F8, 0x2F6, 0x2F3, 0x2F1, 0x2EF, + 0x2EC, 0x2EA, 0x2E7, 0x2E5, 0x2E2, 0x2E0, 0x2DE, 0x2DB, 0x2D9, 0x2D6, 0x2D4, 0x2D2, 0x2CF, 0x2CD, 0x2CA, 0x2C8, + 0x2C6, 0x2C3, 0x2C1, 0x2BF, 0x2BC, 0x2BA, 0x2B8, 0x2B5, 0x2B3, 0x2B0, 0x2AE, 0x2AC, 0x2A9, 0x2A7, 0x2A5, 0x2A2, + 0x2A0, 0x29E, 0x29B, 0x299, 0x297, 0x294, 0x292, 0x290, 0x28E, 0x28B, 0x289, 0x287, 0x284, 0x282, 0x280, 0x27E, + 0x27B, 0x279, 0x277, 0x274, 0x272, 0x270, 0x26E, 0x26B, 0x269, 0x267, 0x265, 0x262, 0x260, 0x25E, 0x25C, 0x259, + 0x257, 0x255, 0x253, 0x251, 0x24E, 0x24C, 0x24A, 0x248, 0x246, 0x243, 0x241, 0x23F, 0x23D, 0x23B, 0x239, 0x236, + 0x234, 0x232, 0x230, 0x22E, 0x22C, 0x229, 0x227, 0x225, 0x223, 0x221, 0x21F, 0x21D, 0x21A, 0x218, 0x216, 0x214, + 0x212, 0x210, 0x20E, 0x20C, 0x20A, 0x207, 0x205, 0x203, 0x201, 0x1FF, 0x1FD, 0x1FB, 0x1F9, 0x1F7, 0x1F5, 0x1F3, + 0x1F1, 0x1EF, 0x1ED, 0x1EB, 0x1E8, 0x1E6, 0x1E4, 0x1E2, 0x1E0, 0x1DE, 0x1DC, 0x1DA, 0x1D8, 0x1D6, 0x1D4, 0x1D2, + 0x1D0, 0x1CE, 0x1CC, 0x1CA, 0x1C8, 0x1C6, 0x1C4, 0x1C2, 0x1C0, 0x1BF, 0x1BD, 0x1BB, 0x1B9, 0x1B7, 0x1B5, 0x1B3, + 0x1B1, 0x1AF, 0x1AD, 0x1AB, 0x1A9, 0x1A7, 0x1A5, 0x1A3, 0x1A2, 0x1A0, 0x19E, 0x19C, 0x19A, 0x198, 0x196, 0x194, + 0x192, 0x191, 0x18F, 0x18D, 0x18B, 0x189, 0x187, 0x185, 0x184, 0x182, 0x180, 0x17E, 0x17C, 0x17A, 0x179, 0x177, + 0x175, 0x173, 0x171, 0x170, 0x16E, 0x16C, 0x16A, 0x168, 0x167, 0x165, 0x163, 0x161, 0x160, 0x15E, 0x15C, 0x15A, + 0x159, 0x157, 0x155, 0x153, 0x152, 0x150, 0x14E, 0x14C, 0x14B, 0x149, 0x147, 0x146, 0x144, 0x142, 0x141, 0x13F, + 0x13D, 0x13C, 0x13A, 0x138, 0x137, 0x135, 0x133, 0x132, 0x130, 0x12E, 0x12D, 0x12B, 0x129, 0x128, 0x126, 0x124, + 0x123, 0x121, 0x120, 0x11E, 0x11C, 0x11B, 0x119, 0x118, 0x116, 0x114, 0x113, 0x111, 0x110, 0x10E, 0x10D, 0x10B, + 0x10A, 0x108, 0x106, 0x105, 0x103, 0x102, 0x100, 0x0FF, 0x0FD, 0x0FC, 0x0FA, 0x0F9, 0x0F7, 0x0F6, 0x0F4, 0x0F3, + 0x0F1, 0x0F0, 0x0EE, 0x0ED, 0x0EB, 0x0EA, 0x0E8, 0x0E7, 0x0E6, 0x0E4, 0x0E3, 0x0E1, 0x0E0, 0x0DE, 0x0DD, 0x0DC, + 0x0DA, 0x0D9, 0x0D7, 0x0D6, 0x0D5, 0x0D3, 0x0D2, 0x0D0, 0x0CF, 0x0CE, 0x0CC, 0x0CB, 0x0CA, 0x0C8, 0x0C7, 0x0C5, + 0x0C4, 0x0C3, 0x0C1, 0x0C0, 0x0BF, 0x0BD, 0x0BC, 0x0BB, 0x0BA, 0x0B8, 0x0B7, 0x0B6, 0x0B4, 0x0B3, 0x0B2, 0x0B0, + 0x0AF, 0x0AE, 0x0AD, 0x0AB, 0x0AA, 0x0A9, 0x0A8, 0x0A6, 0x0A5, 0x0A4, 0x0A3, 0x0A1, 0x0A0, 0x09F, 0x09E, 0x09D, + 0x09B, 0x09A, 0x099, 0x098, 0x097, 0x095, 0x094, 0x093, 0x092, 0x091, 0x090, 0x08E, 0x08D, 0x08C, 0x08B, 0x08A, + 0x089, 0x088, 0x086, 0x085, 0x084, 0x083, 0x082, 0x081, 0x080, 0x07F, 0x07E, 0x07D, 0x07B, 0x07A, 0x079, 0x078, + 0x077, 0x076, 0x075, 0x074, 0x073, 0x072, 0x071, 0x070, 0x06F, 0x06E, 0x06D, 0x06C, 0x06B, 0x06A, 0x069, 0x068, + 0x067, 0x066, 0x065, 0x064, 0x063, 0x062, 0x061, 0x060, 0x05F, 0x05E, 0x05D, 0x05C, 0x05B, 0x05A, 0x05A, 0x059, + 0x058, 0x057, 0x056, 0x055, 0x054, 0x053, 0x052, 0x051, 0x051, 0x050, 0x04F, 0x04E, 0x04D, 0x04C, 0x04B, 0x04B, + 0x04A, 0x049, 0x048, 0x047, 0x046, 0x046, 0x045, 0x044, 0x043, 0x042, 0x042, 0x041, 0x040, 0x03F, 0x03E, 0x03E, + 0x03D, 0x03C, 0x03B, 0x03B, 0x03A, 0x039, 0x038, 0x038, 0x037, 0x036, 0x035, 0x035, 0x034, 0x033, 0x033, 0x032, + 0x031, 0x031, 0x030, 0x02F, 0x02F, 0x02E, 0x02D, 0x02D, 0x02C, 0x02B, 0x02B, 0x02A, 0x029, 0x029, 0x028, 0x027, + 0x027, 0x026, 0x026, 0x025, 0x024, 0x024, 0x023, 0x023, 0x022, 0x022, 0x021, 0x020, 0x020, 0x01F, 0x01F, 0x01E, + 0x01E, 0x01D, 0x01D, 0x01C, 0x01C, 0x01B, 0x01B, 0x01A, 0x01A, 0x019, 0x019, 0x018, 0x018, 0x017, 0x017, 0x016, + 0x016, 0x015, 0x015, 0x014, 0x014, 0x013, 0x013, 0x013, 0x012, 0x012, 0x011, 0x011, 0x010, 0x010, 0x010, 0x00F, + 0x00F, 0x00F, 0x00E, 0x00E, 0x00D, 0x00D, 0x00D, 0x00C, 0x00C, 0x00C, 0x00B, 0x00B, 0x00B, 0x00A, 0x00A, 0x00A, + 0x009, 0x009, 0x009, 0x008, 0x008, 0x008, 0x008, 0x007, 0x007, 0x007, 0x007, 0x006, 0x006, 0x006, 0x006, 0x005, + 0x005, 0x005, 0x005, 0x004, 0x004, 0x004, 0x004, 0x004, 0x003, 0x003, 0x003, 0x003, 0x003, 0x002, 0x002, 0x002, + 0x002, 0x002, 0x002, 0x002, 0x001, 0x001, 0x001, 0x001, 0x001, 0x001, 0x001, 0x001, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x001, 0x001, 0x001, 0x001, 0x001, 0x001, 0x001, 0x001, 0x002, 0x002, 0x002, + 0x002, 0x002, 0x002, 0x002, 0x003, 0x003, 0x003, 0x003, 0x003, 0x004, 0x004, 0x004, 0x004, 0x004, 0x005, 0x005, + 0x005, 0x005, 0x006, 0x006, 0x006, 0x006, 0x007, 0x007, 0x007, 0x007, 0x008, 0x008, 0x008, 0x008, 0x009, 0x009, + 0x009, 0x00A, 0x00A, 0x00A, 0x00B, 0x00B, 0x00B, 0x00C, 0x00C, 0x00C, 0x00D, 0x00D, 0x00D, 0x00E, 0x00E, 0x00F, + 0x00F, 0x00F, 0x010, 0x010, 0x010, 0x011, 0x011, 0x012, 0x012, 0x013, 0x013, 0x013, 0x014, 0x014, 0x015, 0x015, + 0x016, 0x016, 0x017, 0x017, 0x018, 0x018, 0x019, 0x019, 0x01A, 0x01A, 0x01B, 0x01B, 0x01C, 0x01C, 0x01D, 0x01D, + 0x01E, 0x01E, 0x01F, 0x01F, 0x020, 0x020, 0x021, 0x022, 0x022, 0x023, 0x023, 0x024, 0x024, 0x025, 0x026, 0x026, + 0x027, 0x027, 0x028, 0x029, 0x029, 0x02A, 0x02B, 0x02B, 0x02C, 0x02D, 0x02D, 0x02E, 0x02F, 0x02F, 0x030, 0x031, + 0x031, 0x032, 0x033, 0x033, 0x034, 0x035, 0x035, 0x036, 0x037, 0x038, 0x038, 0x039, 0x03A, 0x03B, 0x03B, 0x03C, + 0x03D, 0x03E, 0x03E, 0x03F, 0x040, 0x041, 0x042, 0x042, 0x043, 0x044, 0x045, 0x046, 0x046, 0x047, 0x048, 0x049, + 0x04A, 0x04B, 0x04B, 0x04C, 0x04D, 0x04E, 0x04F, 0x050, 0x051, 0x051, 0x052, 0x053, 0x054, 0x055, 0x056, 0x057, + 0x058, 0x059, 0x05A, 0x05A, 0x05B, 0x05C, 0x05D, 0x05E, 0x05F, 0x060, 0x061, 0x062, 0x063, 0x064, 0x065, 0x066, + 0x067, 0x068, 0x069, 0x06A, 0x06B, 0x06C, 0x06D, 0x06E, 0x06F, 0x070, 0x071, 0x072, 0x073, 0x074, 0x075, 0x076, + 0x077, 0x078, 0x079, 0x07A, 0x07B, 0x07D, 0x07E, 0x07F, 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x088, + 0x089, 0x08A, 0x08B, 0x08C, 0x08D, 0x08E, 0x090, 0x091, 0x092, 0x093, 0x094, 0x095, 0x097, 0x098, 0x099, 0x09A, + 0x09B, 0x09D, 0x09E, 0x09F, 0x0A0, 0x0A1, 0x0A3, 0x0A4, 0x0A5, 0x0A6, 0x0A8, 0x0A9, 0x0AA, 0x0AB, 0x0AD, 0x0AE, + 0x0AF, 0x0B0, 0x0B2, 0x0B3, 0x0B4, 0x0B6, 0x0B7, 0x0B8, 0x0BA, 0x0BB, 0x0BC, 0x0BD, 0x0BF, 0x0C0, 0x0C1, 0x0C3, + 0x0C4, 0x0C5, 0x0C7, 0x0C8, 0x0CA, 0x0CB, 0x0CC, 0x0CE, 0x0CF, 0x0D0, 0x0D2, 0x0D3, 0x0D5, 0x0D6, 0x0D7, 0x0D9, + 0x0DA, 0x0DC, 0x0DD, 0x0DE, 0x0E0, 0x0E1, 0x0E3, 0x0E4, 0x0E6, 0x0E7, 0x0E8, 0x0EA, 0x0EB, 0x0ED, 0x0EE, 0x0F0, + 0x0F1, 0x0F3, 0x0F4, 0x0F6, 0x0F7, 0x0F9, 0x0FA, 0x0FC, 0x0FD, 0x0FF, 0x100, 0x102, 0x103, 0x105, 0x106, 0x108, + 0x10A, 0x10B, 0x10D, 0x10E, 0x110, 0x111, 0x113, 0x114, 0x116, 0x118, 0x119, 0x11B, 0x11C, 0x11E, 0x120, 0x121, + 0x123, 0x124, 0x126, 0x128, 0x129, 0x12B, 0x12D, 0x12E, 0x130, 0x132, 0x133, 0x135, 0x137, 0x138, 0x13A, 0x13C, + 0x13D, 0x13F, 0x141, 0x142, 0x144, 0x146, 0x147, 0x149, 0x14B, 0x14C, 0x14E, 0x150, 0x152, 0x153, 0x155, 0x157, + 0x159, 0x15A, 0x15C, 0x15E, 0x160, 0x161, 0x163, 0x165, 0x167, 0x168, 0x16A, 0x16C, 0x16E, 0x170, 0x171, 0x173, + 0x175, 0x177, 0x179, 0x17A, 0x17C, 0x17E, 0x180, 0x182, 0x184, 0x185, 0x187, 0x189, 0x18B, 0x18D, 0x18F, 0x191, + 0x192, 0x194, 0x196, 0x198, 0x19A, 0x19C, 0x19E, 0x1A0, 0x1A2, 0x1A3, 0x1A5, 0x1A7, 0x1A9, 0x1AB, 0x1AD, 0x1AF, + 0x1B1, 0x1B3, 0x1B5, 0x1B7, 0x1B9, 0x1BB, 0x1BD, 0x1BF, 0x1C0, 0x1C2, 0x1C4, 0x1C6, 0x1C8, 0x1CA, 0x1CC, 0x1CE, + 0x1D0, 0x1D2, 0x1D4, 0x1D6, 0x1D8, 0x1DA, 0x1DC, 0x1DE, 0x1E0, 0x1E2, 0x1E4, 0x1E6, 0x1E8, 0x1EB, 0x1ED, 0x1EF, + 0x1F1, 0x1F3, 0x1F5, 0x1F7, 0x1F9, 0x1FB, 0x1FD, 0x1FF, 0x201, 0x203, 0x205, 0x207, 0x20A, 0x20C, 0x20E, 0x210, + 0x212, 0x214, 0x216, 0x218, 0x21A, 0x21D, 0x21F, 0x221, 0x223, 0x225, 0x227, 0x229, 0x22C, 0x22E, 0x230, 0x232, + 0x234, 0x236, 0x239, 0x23B, 0x23D, 0x23F, 0x241, 0x243, 0x246, 0x248, 0x24A, 0x24C, 0x24E, 0x251, 0x253, 0x255, + 0x257, 0x259, 0x25C, 0x25E, 0x260, 0x262, 0x265, 0x267, 0x269, 0x26B, 0x26E, 0x270, 0x272, 0x274, 0x277, 0x279, + 0x27B, 0x27E, 0x280, 0x282, 0x284, 0x287, 0x289, 0x28B, 0x28E, 0x290, 0x292, 0x294, 0x297, 0x299, 0x29B, 0x29E, + 0x2A0, 0x2A2, 0x2A5, 0x2A7, 0x2A9, 0x2AC, 0x2AE, 0x2B0, 0x2B3, 0x2B5, 0x2B8, 0x2BA, 0x2BC, 0x2BF, 0x2C1, 0x2C3, + 0x2C6, 0x2C8, 0x2CA, 0x2CD, 0x2CF, 0x2D2, 0x2D4, 0x2D6, 0x2D9, 0x2DB, 0x2DE, 0x2E0, 0x2E2, 0x2E5, 0x2E7, 0x2EA, + 0x2EC, 0x2EF, 0x2F1, 0x2F3, 0x2F6, 0x2F8, 0x2FB, 0x2FD, 0x300, 0x302, 0x305, 0x307, 0x30A, 0x30C, 0x30E, 0x311, + 0x313, 0x316, 0x318, 0x31B, 0x31D, 0x320, 0x322, 0x325, 0x327, 0x32A, 0x32C, 0x32F, 0x331, 0x334, 0x336, 0x339, + 0x33B, 0x33E, 0x340, 0x343, 0x346, 0x348, 0x34B, 0x34D, 0x350, 0x352, 0x355, 0x357, 0x35A, 0x35C, 0x35F, 0x362, + 0x364, 0x367, 0x369, 0x36C, 0x36E, 0x371, 0x374, 0x376, 0x379, 0x37B, 0x37E, 0x381, 0x383, 0x386, 0x388, 0x38B, + 0x38E, 0x390, 0x393, 0x395, 0x398, 0x39B, 0x39D, 0x3A0, 0x3A3, 0x3A5, 0x3A8, 0x3AA, 0x3AD, 0x3B0, 0x3B2, 0x3B5, + 0x3B8, 0x3BA, 0x3BD, 0x3C0, 0x3C2, 0x3C5, 0x3C8, 0x3CA, 0x3CD, 0x3D0, 0x3D2, 0x3D5, 0x3D8, 0x3DA, 0x3DD, 0x3E0, + 0x3E2, 0x3E5, 0x3E8, 0x3EB, 0x3ED, 0x3F0, 0x3F3, 0x3F5, 0x3F8, 0x3FB, 0x3FE, 0x400, 0x403, 0x406, 0x408, 0x40B, + 0x40E, 0x411, 0x413, 0x416, 0x419, 0x41C, 0x41E, 0x421, 0x424, 0x427, 0x429, 0x42C, 0x42F, 0x432, 0x434, 0x437, + 0x43A, 0x43D, 0x43F, 0x442, 0x445, 0x448, 0x44B, 0x44D, 0x450, 0x453, 0x456, 0x459, 0x45B, 0x45E, 0x461, 0x464, + 0x467, 0x469, 0x46C, 0x46F, 0x472, 0x475, 0x477, 0x47A, 0x47D, 0x480, 0x483, 0x486, 0x488, 0x48B, 0x48E, 0x491, + 0x494, 0x497, 0x499, 0x49C, 0x49F, 0x4A2, 0x4A5, 0x4A8, 0x4AB, 0x4AD, 0x4B0, 0x4B3, 0x4B6, 0x4B9, 0x4BC, 0x4BF, + 0x4C1, 0x4C4, 0x4C7, 0x4CA, 0x4CD, 0x4D0, 0x4D3, 0x4D6, 0x4D8, 0x4DB, 0x4DE, 0x4E1, 0x4E4, 0x4E7, 0x4EA, 0x4ED, + 0x4F0, 0x4F3, 0x4F5, 0x4F8, 0x4FB, 0x4FE, 0x501, 0x504, 0x507, 0x50A, 0x50D, 0x510, 0x513, 0x515, 0x518, 0x51B, + 0x51E, 0x521, 0x524, 0x527, 0x52A, 0x52D, 0x530, 0x533, 0x536, 0x539, 0x53C, 0x53F, 0x542, 0x545, 0x547, 0x54A, + 0x54D, 0x550, 0x553, 0x556, 0x559, 0x55C, 0x55F, 0x562, 0x565, 0x568, 0x56B, 0x56E, 0x571, 0x574, 0x577, 0x57A, + 0x57D, 0x580, 0x583, 0x586, 0x589, 0x58C, 0x58F, 0x592, 0x595, 0x598, 0x59B, 0x59E, 0x5A1, 0x5A4, 0x5A7, 0x5AA, + 0x5AD, 0x5B0, 0x5B3, 0x5B6, 0x5B9, 0x5BC, 0x5BF, 0x5C2, 0x5C5, 0x5C8, 0x5CB, 0x5CE, 0x5D1, 0x5D4, 0x5D7, 0x5DA, + 0x5DD, 0x5E0, 0x5E3, 0x5E6, 0x5E9, 0x5EC, 0x5EF, 0x5F2, 0x5F5, 0x5F8, 0x5FB, 0x5FE, 0x602, 0x605, 0x608, 0x60B, + 0x60E, 0x611, 0x614, 0x617, 0x61A, 0x61D, 0x620, 0x623, 0x626, 0x629, 0x62C, 0x62F, 0x632, 0x635, 0x638, 0x63C, + 0x63F, 0x642, 0x645, 0x648, 0x64B, 0x64E, 0x651, 0x654, 0x657, 0x65A, 0x65D, 0x660, 0x663, 0x667, 0x66A, 0x66D, + 0x670, 0x673, 0x676, 0x679, 0x67C, 0x67F, 0x682, 0x685, 0x688, 0x68C, 0x68F, 0x692, 0x695, 0x698, 0x69B, 0x69E, + 0x6A1, 0x6A4, 0x6A7, 0x6AA, 0x6AE, 0x6B1, 0x6B4, 0x6B7, 0x6BA, 0x6BD, 0x6C0, 0x6C3, 0x6C6, 0x6C9, 0x6CD, 0x6D0, + 0x6D3, 0x6D6, 0x6D9, 0x6DC, 0x6DF, 0x6E2, 0x6E5, 0x6E9, 0x6EC, 0x6EF, 0x6F2, 0x6F5, 0x6F8, 0x6FB, 0x6FE, 0x701, + 0x705, 0x708, 0x70B, 0x70E, 0x711, 0x714, 0x717, 0x71A, 0x71E, 0x721, 0x724, 0x727, 0x72A, 0x72D, 0x730, 0x733, + 0x737, 0x73A, 0x73D, 0x740, 0x743, 0x746, 0x749, 0x74C, 0x750, 0x753, 0x756, 0x759, 0x75C, 0x75F, 0x762, 0x765, + 0x769, 0x76C, 0x76F, 0x772, 0x775, 0x778, 0x77B, 0x77F, 0x782, 0x785, 0x788, 0x78B, 0x78E, 0x791, 0x794, 0x798, + 0x79B, 0x79E, 0x7A1, 0x7A4, 0x7A7, 0x7AA, 0x7AE, 0x7B1, 0x7B4, 0x7B7, 0x7BA, 0x7BD, 0x7C0, 0x7C4, 0x7C7, 0x7CA, + 0x7CD, 0x7D0, 0x7D3, 0x7D6, 0x7DA, 0x7DD, 0x7E0, 0x7E3, 0x7E6, 0x7E9, 0x7EC, 0x7F0, 0x7F3, 0x7F6, 0x7F9, 0x7FC +}; \ No newline at end of file diff --git a/Software/CFO/CFOmidi.cpp b/Software/CFO/CFOmidi.cpp new file mode 100755 index 0000000..cf817fb --- /dev/null +++ b/Software/CFO/CFOmidi.cpp @@ -0,0 +1,186 @@ +/* + Midi.cpp - Music library + Copyright (c) 2012 Copenhagen Institute of Interaction Design. + All right reserved. + + This library is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This library 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 Lesser Public License for more details. + + You should have received a copy of the GNU Lesser Public License + along with Foobar. If not, see . + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + author: Jakob Bak + + contact: j.bak@ciid.dk + */ + +#include +#include +#include +//#include +#include +#include + +prog_uint16_t hertzTable[] PROGMEM = {8,8,9,9,10,10,11,12,12,13,14,15,16,17,18,19,20,21,23,24,25,27,29,30,32,34,36,38,41,43,46,48,51,54,58,61,65,69,73,77,82,87,92,97,103,109,116,123,130,138,146,155,164,174,184,195,207,219,233,246,261,277,293,311,329,349,369,391,415,440,466,493,523,554,587,622,659,698,739,783,830,880,932,987,1046,1108,1174,1244,1318,1396,1479,1567,1661,1760,1864,1975,2093,2217,2349,2489,2637,2793,2959,3135,3322,3520,3729,3951,4186,4434,4698,4978,5274,5587,5919,6271,6644,7040,7458,7902,8372,8869,9397,9956,10548,11175,11839,12543}; + +MMidi Midi; + +void MMidi::init() +{ + Serial.begin(115200); + + midiBufferIndex = 0; + //notePlayed = 0; + + + +} + + +void MMidi::checkMidi() +{ + while(Serial.available() > 0) { + + midiBuffer[midiBufferIndex] = Serial.read(); + if(midiBuffer[midiBufferIndex] == 0xFF) { + midiHandler(); + midiBufferIndex = 0; + } + else midiBufferIndex++; + + } + +} + + +void MMidi::midiHandler() { + + //midiTime = millis(); + uint8_t midiChannel = (midiBuffer[0] & 0x0F); + + + switch(midiBuffer[0] & 0xF0) { // bit mask with &0xF0 ? + case 0x80: + noteOff (midiBuffer[0] & 0x0F, // midi channel 0-16 + midiBuffer[1] & 0x7F, // note value 0-127 + midiBuffer[2] & 0x7F); // note velocity 0-127 + break; + + case 0x90: + noteOn (midiBuffer[0] & 0x0F, // midi channel 0-16 + midiBuffer[1] & 0x7F, // note value 0-127 + midiBuffer[2] & 0x7F); // note velocity 0-127 + break; + + case 0xA0: + aftertouch (midiBuffer[0] & 0x0F, // midi channel 0-16 + midiBuffer[1] & 0x7F, // note value 0-127 + midiBuffer[2] & 0x7F);// note velocity 0-127 + break; + + case 0xB0: + controller (midiBuffer[0] & 0x0F, // midi channel 0-16 + midiBuffer[1] & 0x7F, // controller number 0-127 + midiBuffer[2] & 0x7F);// controller value 0-127 + break; + + case 0xC0: + programChange (midiBuffer[0] & 0x0F, // midi channel 0-16 + midiBuffer[1] & 0x7F); // program number 0-127 + break; + + case 0xD0: + channelPressure (midiBuffer[0] & 0x0F, // midi channel 0-16 + midiBuffer[1] & 0x7F); // pressure amount 0-127 + break; + + case 0xE0: + pitchWheel (midiBuffer[0] & 0x0F, // midi channel 0-16 + midiBuffer[1] & 0x7F, // higher bits 0-6 + midiBuffer[2] & 0x7F);// lower bits 7-13 + break; + + default: + break; + } +} + + +void MMidi::noteOff(uint8_t channel, uint8_t note, uint8_t vel) { + + + if(notePlayed == note) { + Music.setEnvStage(4); + //ampGain = 0; + //fltGain = 0; + } + +} + + +void MMidi::noteOn(uint8_t channel, uint8_t note, uint8_t vel) { + + Music.setEnvStage(1); + //ampGain = 2 * vel << 8; + //fltGain = 2 * vel << 8; + Music.setVelSustain(vel); + notePlayed = note; + memcpy_P(&frequency, &hertzTable[notePlayed],2); + Music.setFrequency1(frequency); + Music.setFrequency2(frequency); + Music.setFrequency3(frequency); + +} + +void MMidi::aftertouch(uint8_t channel, uint8_t note, uint8_t pressure) { + // Write code here for Aftertouch +} + +void MMidi::controller(uint8_t channel, uint8_t number, uint8_t value) { + + switch(number) { + case ENV_ATTACK: + Music.setAttack(value); + break; + case ENV_DECAY: + Music.setDecay(value); + break; + case ENV_SUSTAIN: + Music.setSustain(value); + break; + case ENV_RELEASE: + Music.setRelease(value); + break; + case DETUNE: + Music.setDetune(value/5120.0); + break; + case WAVEFORM: + value = value / 43; + if(value == 0) Music.setSine(); + else if(value == 1) Music.setSaw(); + else if(value == 2) Music.setSquare(); + break; + default: + break; + } + +} + +void MMidi::programChange(uint8_t channel, uint8_t number) { + // Write code here for Program Change +} + +void MMidi::channelPressure(uint8_t channel, uint8_t pressure) { + // Write code here for Channel Pressure +} + +void MMidi::pitchWheel(uint8_t channel, uint8_t highBits, uint8_t lowBits) { + // Write code here for Pitch Wheel +} \ No newline at end of file diff --git a/Software/Example code/Basic_MIDI/Basic_MIDI.ino b/Software/Example code/Basic_MIDI/Basic_MIDI.ino new file mode 100644 index 0000000..4b2d95a --- /dev/null +++ b/Software/Example code/Basic_MIDI/Basic_MIDI.ino @@ -0,0 +1,39 @@ + +// This needs to be in all sketches at the moment +#include + +// The Music and Midi objects are automatically instantiated when the header file is included. +// Make calls to the Music and Midi objects with "Music.function(args)" and "Midi.function(args)" +// You still need to call Music.init() and Midi.init() in the setup() function below. +#include +#include + +// variables for this sketch + +void setup() { + + // We initialise the sound engine by calling Music.init() which outputs a tone + Music.init(); + + // We initialize the MIDI engine by calling Midi.init() + Midi.init(); + + // Choosing the sine wave oscillator (optional since this is already the default). + Music.setSaw(); + + // Detuning the three oscillators heavily to create more movement in the sound. + Music.setDetune(0.01); + + // Enabling envelope, otherwise the synth would just play constant tones. + Music.enableEnvelope(); + +} + +void loop() { + + // The MIDI must be used with the external + // "IAC2Serial.pde" Processing sketch. + Midi.checkMidi(); + +} + diff --git a/Software/Example code/MUSIC_LIBRARY_DOCUMENTATION/MUSIC_LIBRARY_DOCUMENTATION.ino b/Software/Example code/MUSIC_LIBRARY_DOCUMENTATION/MUSIC_LIBRARY_DOCUMENTATION.ino new file mode 100644 index 0000000..3f46436 --- /dev/null +++ b/Software/Example code/MUSIC_LIBRARY_DOCUMENTATION/MUSIC_LIBRARY_DOCUMENTATION.ino @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////// +// DON'T TRY TO RUN THIS SKETCH, IT IS FOR DOCUMENTATION PURPOSES ONLY // +///////////////////////////////////////////////////////////////////////// + +// These are the music functions that are available for you to use in you sketches. +// You can see examples of how some of them are used (the most basic ones) in the +// Apps folder that downloaded with the MM library. + +// In the following you can see the variable type that the function takes as an argument (float, uint8_t or uint16_t) +// The weirdly looking "uint16_t" and "uint8_t" is just unsigned 16 and 8 bit integers. So instead of having +// both negative and positive values, they only have positive values from 0 - 255 (8bit) and 0 - 65535 (16bit). +// If you copy a function from here to your arduino sketch, just change the word "float", "uint8_t", etc into the +// variable name that you uses in your sketch. + + +// INITIALIZER +// Use this to start the synth engine. It defaults to a sine tone at 110Hz, no envelope and no detune. +Music.init(); + + +// FREQUENCY AND DETUNE FUNCTIONS +// Use these functions to set the frequency and detune parameters of the synth. +Music.setFrequency(float); // Set frequencies of all oscillators at once. Does _not_ affect detune. +Music.setFrequency1(float); // Set frequency of individual oscillators. +Music.setFrequency2(float); // +Music.setFrequency3(float); // +Music.setDetune(float); // Set the detune of all oscillators at once. Does _not_ affect the base frequencies. +Music.setDetune2(float); // Set the detune of oscillator 2 and 3 individually (oscillator 1 stays fixed) +Music.setDetune3(float); +Music.pitchBend(float); // This function detunes the pitch without affecting the detune parameters' individual + // 'spread'. Takes a float. + + +// WAVEFORM FUNCTIONS +// Switch between the different waveforms for the oscillators. It sets all of them at once. +Music.setSine(); +Music.setSaw(); +Music.setSquare(); + + +// GAIN FUNCTIONS +// Set the gain of the oscillators all at once or individually. You can send either floats or uint16_t to the +// function and it figures out to use the correct function automagically :) +Music.setGain(float); // 0.0 - 1.0 +Music.setGain1(float); // 0.0 - 1.0 +Music.setGain2(float); // 0.0 - 1.0 +Music.setGain3(float); // 0.0 - 1.0 +// using floats in your own calculations can be heavy on the processor, so there is the option of passing 16bit integers +// instead, since this is what it gets converted to anyway internally in the sound engine. +Music.setGain(uint16_t value); // 0 - 65535 +Music.setGain1(uint16_t value); // 0 - 65535 +Music.setGain2(uint16_t value); // 0 - 65535 +Music.setGain3(uint16_t value); // 0 - 65535 + + +// NOTE FUNCTIONS +// These functions triggers a note to be played. The noteOff() functions turns the note off again. +// They come both with note and velocity information (for noteOn). If you don't know what that is, +// just use the ones with the least arguments. +// To get a proper note sound call Music.enableEnvelopes() [see below] before calling the noteOn function. +// You just have to do that once in the setup for example. +Music.noteOn(uint8_t note, uint8_t vel); // 0 - 127 +Music.noteOn(uint8_t note); // 0 - 127 +Music.noteOff(uint8_t note); // 0 - 127 +Music.noteOff(); +// This function returns the frequency of a MIDI note number sent to it. +Music.getNoteFrequency(uint8_t); // 0 - 127 + + +// ENVELOPE FUNCTIONS +// These functions enables and sets the parameters of the internal envelope which creates dynamics for the notes +// being played. You can read about ADSR envelopes here: http://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope +// When using the envelope you can only hear sound when you are triggering the notes with the note functions. In order +// to get dynamics without triggering the note object you must have the envelope turned off, for example using +// the Music.disableEnvelope() function [already set by default in the init() function]. You can then control the +// dynamics of the sound with the overall or individual setGain() functions. +Music.enableEnvelope(); +Music.disableEnvelope(); +// Setting the parameters for the envelope you send an 8bit number between 0 and 127 to the functions below. 0 is a very fast +// rise or decay in sound, whereas 127 is very long. Sustain is the sound level where 0 is silent and 127 is full gain. +// You must experiment with what suits your musical taste :) +// These parameters can of course be adjusted during the physics code for interesting results, but be aware that when +// using the sine wave oscillator (which is more processor intensive) the sound can hang or have glitches if you alter +// these parameters too quickly or set them at extremes. Try it out. +Music.setAttack(uint8_t att); // 0 - 127 +Music.setDecay(uint8_t dec); // 0 - 127 +Music.setSustain(uint8_t sus); // 0 - 127 +Music.setRelease(uint8_t rel); // 0 - 127 diff --git a/Software/Example code/Minimal/Minimal.ino b/Software/Example code/Minimal/Minimal.ino new file mode 100644 index 0000000..9eae6a3 --- /dev/null +++ b/Software/Example code/Minimal/Minimal.ino @@ -0,0 +1,19 @@ + +// This needs to be in all sketches at the moment +#include + +// The Music and Midi objects are automatically instantiated when the header file is included. +// Make calls to the Music and Midi objects with "Music.function(args)" and "Midi.function(args)" +// You still need to call Music.init() and Midi.init() in the setup() function below. +#include + +void setup() { + // We initialise the sound engine by calling Music.init() which outputs a tone + Music.init(); + +} + +void loop() { + +} + diff --git a/Software/Example code/Repeating_note_with_envelope/Repeating_note_with_envelope.ino b/Software/Example code/Repeating_note_with_envelope/Repeating_note_with_envelope.ino new file mode 100644 index 0000000..81ecd55 --- /dev/null +++ b/Software/Example code/Repeating_note_with_envelope/Repeating_note_with_envelope.ino @@ -0,0 +1,50 @@ + +// This needs to be in all sketches at the moment +#include + +// The Music and Midi objects are automatically instantiated when the header file is included. +// Make calls to the Music and Midi objects with "Music.function(args)" and "Midi.function(args)" +// You still need to call Music.init() and Midi.init() in the setup() function below. +#include + +// variables for this sketch +boolean noteIsOn = false; +int note = 48; + +long time = 0; +long lastTime = 0; +long beatTime = 1000; + + +void setup() { + + // We initialise the sound engine by calling Music.init() which outputs a tone + Music.init(); + + // enabling the envelope lets us define an gain envelope for the synth + // without having to specify it in our loop() or physics code. + Music.enableEnvelope(); + Music.setAttack(0x0FFF); + Music.setDecay(0x0004); + Music.setSustain(0x00FF); + Music.setRelease(0x0008); + +} + +void loop() { + + // This short routine loops note over and over again + time = millis(); + if(time - lastTime > beatTime) { + if(!noteIsOn) { + Music.noteOn(note); + noteIsOn = true; + } else { + Music.noteOff(); + noteIsOn = false; + } + lastTime = time; + } + +} + diff --git a/Software/Example code/Spaghetti_tones/Spaghetti_tones.ino b/Software/Example code/Spaghetti_tones/Spaghetti_tones.ino new file mode 100644 index 0000000..9c369d8 --- /dev/null +++ b/Software/Example code/Spaghetti_tones/Spaghetti_tones.ino @@ -0,0 +1,64 @@ + +// This needs to be in all sketches at the moment +#include + +// The Music and Midi objects are automatically instantiated when the header file is included. +// Make calls to the Music and Midi objects with "Music.function(args)" and "Midi.function(args)" +// You still need to call Music.init() and Midi.init() in the setup() function below. +#include + +// variables for this sketch +float gain = 1.0; +float c = 220; // center frequency +float f1 = 1; +float f2 = 1; +float f3 = 1; +float m1 = 1.0011; +float m2 = 1.0012; +float m3 = 1.0013; + + +void setup() { + + // We initialise the sound engine by calling Music.init() which outputs a tone + Music.init(); + + // Choosing the sine wave oscillator (optional since this is already the default). + Music.setSine(); + + // Setting the initial frequency for all three oscillators. + Music.setFrequency(c); + + // Detuning the three oscillators slightly to create movement in the sound. + Music.setDetune(0.002); + +} + +void loop() { + + // This short routine creates a + + Music.setFrequency1(c*f1); + Music.setFrequency2(c*f2); + Music.setFrequency3(c*f3); + + f1 *= m1; + f2 *= m2; + f3 *= m3; + + if(f1 > 4.0) m1 = 0.9745; + if(f2 > 4.0) m2 = 0.9852; + if(f3 > 4.0) m3 = 0.9975; + + if(f1 < 0.25) m1 = 1.0754; + if(f2 < 0.25) m2 = 1.0573; + if(f3 < 0.25) m3 = 1.0386; + + if(millis() > 10000) { + Music.setGain(gain); + gain *= 0.999; + } + + +} + diff --git a/Software/Example code/Up_and_down/Up_and_down.ino b/Software/Example code/Up_and_down/Up_and_down.ino new file mode 100644 index 0000000..d48c08a --- /dev/null +++ b/Software/Example code/Up_and_down/Up_and_down.ino @@ -0,0 +1,62 @@ + +// This needs to be in all sketches at the moment +#include + +// The Music and Midi objects are automatically instantiated when the header file is included. +// Make calls to the Music and Midi objects with "Music.function(args)" and "Midi.function(args)" +// You still need to call Music.init() and Midi.init() in the setup() function below. +#include + +// variables for this sketch +boolean noteIsOn = false; +int n = 0; +int dir = 1; +int rootNote = 48; +int note[] = {0,2,3,5,7,9,10,12,14}; + +long time = 0; +long lastTime = 0; +long beatTime = 100; + + +void setup() { + + // We initialise the sound engine by calling Music.init() which outputs a tone + Music.init(); + + // enabling the envelope lets us define an gain envelope for the synth + // without having to specify it in our loop() or physics code. + Music.enableEnvelope(); + Music.setAttack(0x00FF); + Music.setDecay(0x0008); + Music.setSustain(0x00FF); + Music.setRelease(0x0008); + +} + +void loop() { + + // This short routine loops note over and over again + time = millis(); + if(time - lastTime > beatTime) { + if(!noteIsOn) { + Music.noteOn(rootNote+note[n]); + noteIsOn = true; + n = n + dir; + if(n > 7) + { + dir = -1; + } + else if(n < 1) + { + dir = 1; + } + } else { + Music.noteOff(); + noteIsOn = false; + } + lastTime = time; + } + +} + diff --git a/Software/Example code/Up_and_down/sketch_jun26c/sketch_jun26c.ino b/Software/Example code/Up_and_down/sketch_jun26c/sketch_jun26c.ino new file mode 100644 index 0000000..12ba038 --- /dev/null +++ b/Software/Example code/Up_and_down/sketch_jun26c/sketch_jun26c.ino @@ -0,0 +1,62 @@ + +// This needs to be in all sketches at the moment +#include + +// The Music and Midi objects are automatically instantiated when the header file is included. +// Make calls to the Music and Midi objects with "Music.function(args)" and "Midi.function(args)" +// You still need to call Music.init() and Midi.init() in the setup() function below. +#include + +// variables for this sketch +boolean noteIsOn = false; +int n = 0; +int dir = 1; +int rootNote = 48; +int note[] = {0,2,3,5,7,9,10,12,14}; + +long time = 0; +long lastTime = 0; +long beatTime = 100; + + +void setup() { + + // We initialise the sound engine by calling Music.init() which outputs a tone + Music.init(); + + // enabling the envelope lets us define an gain envelope for the synth + // without having to specify it in our loop() or physics code. + Music.enableEnvelope(); + Music.setAttack(8); + Music.setDecay(70); + Music.setSustain(24); + Music.setRelease(90); + +} + +void loop() { + + // This short routine loops note over and over again + time = millis(); + if(time - lastTime > beatTime) { + if(!noteIsOn) { + Music.noteOn(rootNote+note[n]); + noteIsOn = true; + n = n + dir; + if(n > 7) + { + dir = -1; + } + else if(n < 1) + { + dir = 1; + } + } else { + Music.noteOff(); + noteIsOn = false; + } + lastTime = time; + } + +} + diff --git a/Software/Example code/Up_and_down__square/Up_and_down__square.ino b/Software/Example code/Up_and_down__square/Up_and_down__square.ino new file mode 100644 index 0000000..0486f1d --- /dev/null +++ b/Software/Example code/Up_and_down__square/Up_and_down__square.ino @@ -0,0 +1,68 @@ + +// This needs to be in all sketches at the moment +#include + +// The Music and Midi objects are automatically instantiated when the header file is included. +// Make calls to the Music and Midi objects with "Music.function(args)" and "Midi.function(args)" +// You still need to call Music.init() and Midi.init() in the setup() function below. +#include + +// variables for this sketch +boolean noteIsOn = false; +int n = 0; +int dir = 1; +int rootNote = 26; +int note[] = {0,2,3,5,7,9,10,12,14}; + +long time = 0; +long lastTime = 0; +long beatTime = 100; + + +void setup() { + + // We initialise the sound engine by calling Music.init() which outputs a tone + Music.init(); + + // Choosing the square wave oscillator instead of the sine wave. + Music.setSquare(); + + // Detuning the three oscillators slightly to create movement in the sound. + Music.setDetune(0.008); + + // enabling the envelope lets us define an gain envelope for the synth + // without having to specify it in our loop() or physics code. + Music.enableEnvelope(); + Music.setAttack(8); + Music.setDecay(90); + Music.setSustain(48); + Music.setRelease(64); + +} + +void loop() { + + // This short routine loops note over and over again + time = millis(); + if(time - lastTime > beatTime) { + if(!noteIsOn) { + Music.noteOn(rootNote+note[n]); + noteIsOn = true; + n = n + dir; + if(n > 7) + { + dir = -1; + } + else if(n < 1) + { + dir = 1; + } + } else { + Music.noteOff(); + noteIsOn = false; + } + lastTime = time; + } + +} + diff --git a/Software/README b/Software/README new file mode 100644 index 0000000..6a7eb77 --- /dev/null +++ b/Software/README @@ -0,0 +1,9 @@ +CFO Music and MIDI library + +Work in progress + +Copy whole CFO folder to your "libraries" folder in your Arduino sketch folder. + +See example code in examples folder for utilizing the library. + +I am not 100% everything will work with the insects yet, but we'll see soon enough. \ No newline at end of file