I am trying to add MIDI OUT capabilities to an audio device - using the same jack. User will select in software if audio or midi is to be outputted.

Currently, the audio jack wiring is as shown (R1 is 1k). image of audio schematic

I've thought about switching pin 1 of jack to GND and using pin 4 as active HIGH (to avoid possible sleeve-ring short) - but am unsure if this is best practice as midi specs are active LOW. enter image description here R2 would need to be low enough to allow 5mA current loop (i.e I can't reuse R1).

Priorities for design:

  1. Use as few GPIOs as possible
  2. Low cost/part list
  • 1
    \$\begingroup\$ Control an analog multiplexer to switch between audio and MIDI. Use the standard TRS pinout for 3.5mm MIDI interface. \$\endgroup\$
    – Justme
    Feb 28 '21 at 12:33
  • \$\begingroup\$ Why not swap the jack socket for a stereo one (or multi-way) and have midi on the middle (or spare) ring. If a mono jack is inserted sure it will short out the midi but that can be easily protected. \$\endgroup\$
    – Andy aka
    Feb 28 '21 at 13:34

There is an offical standard for MIDI with TRS connectors; not using it would lead to confusion. (There is already enough confusion due to the two other unofficial standards.)

Many cheap USB/MIDI interfaces do not use an optocoupler but measure the voltage at pin 5 of the MIDI connector, so you should use an active-low driver.

The standard output circuit with to 220 Ω resistors is designed to protect against shorts between any pins, so you should use it.

If you have enough GPIOs, you can connect the audio and MIDI circuits in parallel, and disable the unused GPIOs. To save pins, use a two-channel mux to switch between the audio and MIDI signals (but this needs an additional GPIO for the switch).

If it is possible that the user connects some audio output to the TRS jack, consider implementing over/undervoltage protection.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.