342 lines
10 KiB
Arduino
342 lines
10 KiB
Arduino
|
|
||
|
// Credit:
|
||
|
// Midi to Arduino Converter
|
||
|
// - Andy Tran (extramaster), 2015
|
||
|
// https://www.extramaster.net/tools/midiToArduino/
|
||
|
//
|
||
|
// Process:
|
||
|
// Midi -> Midi tracks -> Note mappings -> Frequency
|
||
|
//
|
||
|
// CC0
|
||
|
|
||
|
// Set this to be the pin that your buzzer resides in. (Note that you can only have one buzzer actively using the PWM signal at a time).
|
||
|
int tonePin = 11;
|
||
|
void setup() {
|
||
|
|
||
|
}
|
||
|
|
||
|
void midi() {
|
||
|
|
||
|
tone(tonePin, 146, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 369, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 220, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 277, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 164, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 391, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 293, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 246, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 146, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 369, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 220, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 277, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 164, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 391, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 293, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 246, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 146, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 369, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 220, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 277, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 164, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 391, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 293, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 233, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 184, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 440, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 277, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 329, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 246, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 369, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 587, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 440, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 220, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 329, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 554, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 391, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 195, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 293, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 493, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 369, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 146, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 369, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 220, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 277, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 164, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 391, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 293, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 246, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 146, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 369, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 220, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 277, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 164, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 391, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 293, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 246, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 146, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 369, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 220, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 277, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 164, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 391, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 293, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 233, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 184, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 440, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 277, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 329, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 246, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 369, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 587, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 440, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 220, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 329, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 554, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 391, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 195, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 293, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 493, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 369, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 146, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 369, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 220, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 277, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 164, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 391, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 293, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 246, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 146, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 369, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 220, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 277, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 164, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 391, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 293, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 246, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 146, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 369, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 220, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 277, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 164, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 391, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 293, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 233, 97.977354375);
|
||
|
delay(108.863727083);
|
||
|
delay(0.227272916667);
|
||
|
tone(tonePin, 146, 392.523054375);
|
||
|
delay(436.136727083);
|
||
|
|
||
|
}
|
||
|
|
||
|
void loop() {
|
||
|
// Play midi
|
||
|
midi();
|
||
|
delay(2000);
|
||
|
}
|