1 // *****************************************************************************************************************
3 // * SpikenzieLabs.com *
5 // * Very Simple Serial to MIDI DEMO *
7 // *****************************************************************************************************************
14 // Demo sketch to play notes from middle C in the 4th octave up to B in the 5th octave and then back down.
18 // 1. Plug USB cable from Arduino into your computer.
22 // 1. Install and Set-up Serial MIDI Converter from SpikenzieLabs
23 // 2. Open, compile, and upload this sketch into your Arduino.
24 // 3. Run Serial MIDI Converter in the background.
25 // 4. Launch your music software such as Garage Band or Ableton Live, choose a software instrument and listen to the music.
29 // This code is provided as is. No guaranties or warranties are given in any form. It is up to you to determine
30 // this codes suitability for your application.
37 Serial.begin(57600); // Default speed of the Serial to MIDI Converter serial port
43 for(int note=60; note<=83; note++) // Going Up
45 MIDI_TX(144,note,127); // NOTE ON
48 MIDI_TX(128,note,127); // NOTE OFF
52 for(int note=82; note>=61; note--) // Coming Down
54 MIDI_TX(144,note,127); // NOTE ON
57 MIDI_TX(128,note,127); // NOTE OFF
64 void MIDI_TX(unsigned char MESSAGE, unsigned char PITCH, unsigned char VELOCITY)
66 Serial.print(MESSAGE);
68 Serial.print(VELOCITY);