Pages: [1]   Go Down
Author Topic: MIDI in problem  (Read 712 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!

I've been struggling with this for a while now. My goal is to make a metronome out of LEDs controlled by an Arduino Mega. The Mega receives midi data through serial by using Serial Midi Converter by Spiekenzielabs (http://www.spikenzielabs.com/SpikenzieLabs/Serial_MIDI.html). I started experimenting with the code by Kuk (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1187962258/0). At first I got nothing - no blinking leds even though serial was being transmitted (I debugged this by turning a status led on when serial.available > 0). I suspected the problem was with the line

Code:
if (incomingByte== 144){ // note on message starting starting

It really makes no sense, since I specifically sent a note on command (144) from Ableton Live. Then I tried this

Code:
if (incomingByte > 144){ // note on message starting starting

Which resulted in the condition coming through and I got a blinking led. I started tracing the incoming command by narrowing the byte to smaller and smaller ranges and finally got down to it being 252 - the midi command for STOP. What the..?

I just want to define four notes which would light up corresponding leds on the Arduin metronome. Any help?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As you haven't posted the code it is hard to say but MIDI consists of messages, each message is more than one byte. You have to synchronise the receiving stream so that you know that the byte you are looking at is the first one in the message.

The code in this project shows you haw it is done.
http://www.thebox.myzen.co.uk/Hardware/Glockenspiel.html
Logged

Pages: [1]   Go Up
Jump to: