MIDI Patch Button

This project uses the Arduino MIDI Library again, as described in my previous project Arduino Simple MIDI Controller, alongside a button as input to provide a “hotkey” patch change message to your keyboard or synth.

These are the key Arduino tutorials for the main concepts used in this project:

Warning! I strongly recommend using an old or second hand keyboard for your MIDI experiments.  I am not responsible for any damage to expensive instruments!

If you are new to Arduino, see the Getting Started pages.

Parts list

  • Arduino Uno or Wemos D1 Mini
  • 1x10k resistor
  • 2×220 resistors
  • 5 pin DIN plug or socket
  • Switch
  • Breadboard and jumper wires

The Circuit

ArduinoMIDIPatchButton_bb

As before, the MIDI socket signal comes from the TX pin of the Arduino and we have a button wired up to be pulled low to ground wired on digital pin 2.  See the previous tutorial for how the wire the MIDI plug or socket.

This is quite a good one that lends itself to a Wemos D1 Mini too, as it makes for quite a nice self-contained unit.  In my case I soldered the resistors for the MIDI link within the MIDI plug itself making the circuit a lot simpler.

The Code

Once again I am using the Arduino MIDI Library (for details, see my previous post – Arduino Simple MIDI Controller).  This time instead of sending continuous change control messages I am sending a program change message.  In principal a program change message will change the instrument voice to one of 128 settings (0 to 127). Most instruments have more voices than this, and there is a whole standard voice set that is part of the General MIDI Standard too, but requires the setting of the “bank” prior to choosing the voice (program), but I’ve kept it simple for now.

Also, some modern keyboards act as 16-channel, multi-timbral voice generators and assume that if they receive a program change message on a specific MIDI channel then it will set the voice for all further notes received on that channel, rather than changing the voice for the main keyboard itself, so this may have limited utility!  But it shows the idea of using a button to trigger a MIDI message.

Reading of the button is followed by a short delay to prevent multiple readings and to act as a simple “debouncer” (where on pressing, the switch “bounces” between connected and unconnected prior to settling down).

For linking to an Arduino you can use any digital pin.  For the Wemos D1 Mini you can use any pin, but I’ve chosen D0 which is interpreted as pin 16.

Find it on GitHub here.

Closing Thoughts

Using two buttons could act as a simple “step up” or “step down” to move through the patches or voices on your keyboard.  Having several fixed buttons would allow each to act as a “hotkey” for different MIDI functions.

This would make a good candidate for soldering to a prototype shield for either the Wemos D1 Mini or the Arduino to make a completely self-contained unit, especially if it was battery powered from a 9v battery.  Alternatively it could be put inside a “foot switch” style “stomp box” with a robust foot-activated switch to allow a quick change whilst playing.

Kevin

2 thoughts on “MIDI Patch Button

    1. You’d need to replace the line:
      MIDI.sendProgramChange (midiPatch-1, midiChannel);

      With something like:
      MIDI.sendControlChange (ccNum, ccVal, midiChannel);

      And set midiChannel to 10 and ccNum/ccVal to the MIDI control change message (ccNum) and value (ccVal) you need.

      I don’t know exactly what controls you mean by mute, but I’m guessing “All Sounds Off” which would be ccNum=120, ccVal = 0 or “All Notes Off” which would be ccNum=123, ccVal = 0.

      For solo, maybe enabling mono mode is what you need? For Mono, ccNum=126, with I’m guessing ccVal=0 if you want all channels with a single voice or ccNum=1 if you just want one channel…?

      Something like that anyway I’d guess. I’ve not used any of these, so you’ll have to do a bit of googling to find the exact messages you want.

      Kevin

      Like

Leave a comment