2

I want to generate music/sounds for a video game I am making with my son (using an Arduino Mega and a 240x320 LCD graphical display). I have a basic understanding of the MIDI protocol. I've been a computer programmer for over 30 years. I read the MIDI implementation in the DSP-G1 manual, but I don't understand how to go from this to sending the right signals from the dev board to the chip pins.

Everything I find is about connecting a physical MIDI device. Can anyone possibly provide or point me to information on how to control the DSP-G1 programmatically/electronically? I think I need some hardware or software to serialize MIDI protocol bytes into a sequence of voltage changes, but all my searching leads me to info about a physical device.

enter image description here

CL.
  • 401
  • 4
  • 8
Gary G
  • 21
  • 1
  • You've got the wrong side of the circuit, you want a midi out circuit. – Chris Stratton Apr 08 '18 at 03:09
  • @ChrisStratton No, he wants to know how to replace this circuit when not using the electrical MIDI protocol. – CL. Apr 08 '18 at 06:27
  • @CL. that would be off topic for an Arduino site and also wouldn't really make any sense, since an Arduino could readily be made to drive that with a transistor. Much better to plug into the gear by the existing connector than to modify it. – Chris Stratton Apr 08 '18 at 06:31

1 Answers1

1

The purpose of the MIDI output circuit is to convert the TTL signal into a 5 mA current.
The purpose of the MIDI input circuit is to convert the current back into a TTL signal.

If the Arduino and the DSP-G1 are part of the same circuit (and share the ground), you can omit these conversions, and connect the Arduino's TX directly to the LPC810's RX, without any other components needed. (The LPC810 requires a 3.3 V power supply, but its RX pin is 5 V tolerant.)

MIDI was designed to work with most microcontrollers, so it uses standard UART signals at 31250 baud. The only configuration you need is:

Serial.begin(31250);
CL.
  • 401
  • 4
  • 8
  • Yes, you understand what I am trying to do. Sometimes a simple thing is harder to find than a more complex one. So to confirm my understanding, I need to use the Serial methods, in particular Serial.begin(31250), followed by a series of Serial.write() calls to send a stream of bytes the same as I would write to a file, per the MIDI file format, e.g., https://www.csie.ntu.edu.tw/~r92092/ref/midi/ – Gary G Apr 08 '18 at 15:18
  • And it seems this will automatically go to TX0 (pin 1) on an UNO. Any need to do anything with pinMode()? What if I wanted to use TX1 on a MEGA? Thanks for your help! – Gary G Apr 08 '18 at 15:21
  • And I would have no need of the optocoupler, correct? – Gary G Apr 08 '18 at 15:23
  • What is sent over a MIDI cable is not a MIDI file, but only the actual MIDI events/messages. There are no timestamps; bytes are sent in real time. See the actual MIDI specification. – CL. Apr 08 '18 at 20:11
  • Serial goes to the first UART; the others are Serial1, Serial2, etc. – CL. Apr 08 '18 at 20:12
  • I'm supposed to avoid comments like "thanks" so... ahem... I appreciate your reply. It makes so much sense in hindsight that the chip would act on my MIDI commands in real time -- I wouldn't expect it to do buffering, so what else could it do? And, yes, I went back to https://www.arduino.cc/reference/en/language/functions/communication/serial/ and it does tell about Serial1, etc.; I must have skimmed over that part before. Good stuff to know. Your guidance has given me enough confidence to part with $25 and try this thing out! – Gary G Apr 09 '18 at 03:06