Synths and sound modules with Arduino

:slight_smile: Hello to all.

I’m hoping there’s an obvious answer to this question as I’m a little stumped right now!

I’m sending a succession of midi notes from my Mega through a ‘midi to usb cable’ plugged into the laptop with Garageband. Everything is playing perfectly. However, if i plug the Mega directly into a synth or sound module using only a ‘midi to midi’ cable nothing plays.

The code I’m using is from the playground and is intended for connecting an Arduino directly to a synth.

Thank you kindly for any suggestions :slight_smile:

  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.

void setup() {
  // Set MIDI baud rate:

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);
    //Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
    noteOn(0x90, note, 0x00);

// 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) {

Forgive me as I may have had a hardware fault! I’ll be back

A few random thoughts:

What synths or sound modules? Are you sure the MIDI cable is o.k.? Do the synths/modules work with any other input device using the same cable?

They seem very short notes, 1/10th of second. O.k. for drums but may not make any sound with many other instrument types. Just for a test it might be worth changing the delay()s to something longer, maybe 500ms to see if that makes any difference.


Thanks Steve for taking the trouble to suggest ideas :slight_smile:

I'm afraid I carelessly soldered pin 4 of the midi socket to ground instead of 5v!! :o