Waterflame – “Glorious Morning 2” {MIDI to Arduino conversion}

November 15th, 2015




DOWNLOADS:

{.MP3, .INO, .C, .MID }

Code Minus song (too big)

#include <Playtune.h>

( INSERT GM_2_3.C HERE)
Playtune pt;

void setup() {
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  pinMode(A4, OUTPUT);
  pinMode(A5, OUTPUT);
  pinMode(A6, OUTPUT);
  pinMode(A7, OUTPUT);
  digitalWrite(A0, HIGH);
  delay(100);
  digitalWrite(A1, HIGH);
  delay(100);
  digitalWrite(A2, HIGH);
  delay(100);
  digitalWrite(A3, HIGH);
  delay(100);
  digitalWrite(A4, HIGH);
  delay(100);
  digitalWrite(A5, HIGH);
  delay(100);
  digitalWrite(A6, HIGH);
  delay(100);
  digitalWrite(A7, HIGH);
  delay(100);
  digitalWrite(A0, LOW);
  delay(100);
  digitalWrite(A1, LOW);
  delay(100);
  digitalWrite(A2, LOW);
  delay(100);
  digitalWrite(A3, LOW);
  delay(100);
  digitalWrite(A4, LOW);
  delay(100);
  digitalWrite(A5, LOW);
  delay(100);
  digitalWrite(A6, LOW);
  delay(100);
  digitalWrite(A7, LOW);
  delay(100);

  // Enable all 6 MEGA timers for notes that are output on digital pins 43, 45, 47, 49, 51, and 53.
  // Those pins should be wired to 500-ohm resistors, the other ends of which should be connected together
  // to one terminal of an 8-ohm speaker.  The other terminal of the speaker should be connected to ground.  
  // No other hardware is needed!

   pt.tune_initchan (2); //V
   pt.tune_initchan (3); //V
   pt.tune_initchan (4); //V
   pt.tune_initchan (5); //V
   pt.tune_initchan (6); //X
   pt.tune_initchan (7); //V
   pt.tune_initchan (8); //V
   pt.tune_initchan (9); //V
   pt.tune_initchan (10); //V
   pt.tune_initchan (11); //V
   pt.tune_initchan (12); //V
   pt.tune_initchan (13); //V


#define DBUG 1
#if DBUG
  Serial.begin(9600);
  Serial.println("Debug");
#endif
}

void loop () {
  
  pt.tune_playscore (score); /* start playing */
  while (pt.tune_playing) ;   /* wait here until playing stops */
  pt.tune_delay(1000);        /* wait a second */
}



Comments

Leave a Reply

Your email address will not be published. Required fields are marked *