Go Down

Topic: MIDI Note Player Help Needed (Read 775 times) previous topic - next topic

uniquebeef

Hi,

I am trying to set-up the MIDI Note Player example, but I don't seem to be receiving anything at the other end.

As far as I can tell I have connected everything as described in the diagram. When I upload the sketch to my board (Arduino UNO) I get a flashing Tx LED. An LED labelled L is also lit, as is the green on LED.

Can anyone help with any suggestions as to what I might be doing wrong?

What happens to the two unused wires from the MIDI cable? Do I just leave them unconnected?

Is there anything else I need to do to the Arduino before uploading the sketch?

Thanks!

(Previously posted in the Installation & Troubleshooting forum in error!)

robtillaart

Please post your code so we know for sure we are talking about the same code.  (please use code tags -> #button above the smileys)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

uniquebeef


I have tried a few different codes, but this is the code I am using right now and the wiring diagram that goes with it.

Code: [Select]
/*
MIDI note player

This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data.
If this circuit is connected to a MIDI synth, it will play
the notes F#-0 (0x1E) to F#-5 (0x5A) in sequence.


The circuit:
* digital in 1 connected to MIDI jack pin 5
* MIDI jack pin 2 connected to ground
* MIDI jack pin 4 connected to +5V through 220-ohm resistor
Attach a MIDI cable to the jack, then to a MIDI synth, and play music.

created 13 Jun 2006
modified 13 Aug 2012
by Tom Igoe

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/Midi

*/

void setup() {
  //  Set MIDI baud rate:
  Serial.begin(31250);
}

void loop() {
  // play notes from F#-0 (0x1E) to F#-5 (0x5A):
  for (int note = 0x1E; note < 0x5A; note ++) {
    //Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
    noteOn(0x90, note, 0x45);
    delay(100);
    //Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
    noteOn(0x90, note, 0x00);   
    delay(100);
  }
}

//  plays a MIDI note.  Doesn't check to see that
//  cmd is greater than 127, or that data values are  less than 127:
void noteOn(int cmd, int pitch, int velocity) {
  Serial.write(cmd);
  Serial.write(pitch);
  Serial.write(velocity);
}

uniquebeef

I tried rebuilding the circuit from scratch, following the diagram available. I even tried a 220 ohm resistor between the tx1 pin on the arduino and the MIDI data wire although, the diagram does not mention this, I did see this mentioned in other posts.

Again, the Tx LED flashes as if data is being transmitted but nothing is received at the other end. At the other end is a Digidesign Digi001. I have used this Midi In socket with other hardware before without any issues so I'm really not sure why this isn't working. My guess is that I'm missing something, software/hardware, I'm not sure. IS the UNO the wrong board for this kind of project?

I'm hoping to build a controller that I can connect to my Digitech Whammy pedal, the plan would be to have a kit as a sort of break-out box with a footswitch that would enable me to switch modes on the Whammy, rather than having to bend over and adjust this manually on the pedal. There is also the possibility of controlling the treadle with pre-programmed sequences. But, if I can't get the arduino to communicate with my PC then I'm not really sure how I can progress further with this.

Any help is appreciated!

el_supremo

Your code is definitely sending the note on and note off messages so I'd suggest that you check your connections again.

Pete

uniquebeef

SOLVED! Well, sort of. I skipped ahead and tried to communicate with my Whammy pedal with another sketch I found online. Worked first time. I don't know why it won't work with my PC though, but I will be attempting that again. Thanks for the help anyway.

Go Up