Arduino MIDI Volume Pedal
I’m playing keyboards this fall in another rock concert to benefit the high school robotics team, and for some of the tunes I need to be able to fade an organ in and out over a period of a measure or two. My keyboards are velocity-sensitive, so if you hit the keys harder they play louder (like a piano); and they have aftertouch, so if you press down extra-hard on the keys you can get special effects. But there’s no good way to change the volume of their organ sounds dynamically, and these synths don’t have inputs for volume pedals.
This is the MIDI volume pedal project I was starting to work on when I took apart a Baldwin organ swell pedal and decided to leave it intact based on what I found inside. I got another analog volume pedal from a pile of unknown origin at the school lab and finished the job.
Old-school audio devices control volume with a potentiometer, usually in the input or preamplification circuits, to choose how much of the audio input signal to feed into the power amp stage. My synthesizers have master volume knobs that (as far as I know) work this way. The designers could also have offered a jack to allow an external volume knob (or pedal) to do the same job in the same way, but they didn’t — among other reasons, because it would be prone to delivering interference and hum right into the preamp section, where it would create the most problems.
Note that it would be possible to run the synths’ line-level output through an external volume pedal on its way to the amplifier, much like guitar effects pedals. But that would require stereo potentiometers to control the stereo output of the synths, which the inexpensive pedal I’ve borrowed doesn’t have. And while it might have a low risk of introducing noise here at home, I know Ron (the perfectionist organizing the concert) wouldn’t approve of an extra device inline in the signal path on stage.
But in addition to the physical master volume control, my synths also have an internal volume setting that’s controlled by software (like the volume control on an iPod, or a PC, or a higher-end car stereo). And this internal volume setting can be addressed by MIDI, since MIDI is digital commands sent serially over a cable. Finally, controlling the volume with MIDI has essentially no risk of introducing hum, since the MIDI cable doesn’t even make an electrical connection to the receiving device — the MIDI specification requires that the receiver uses an optocoupler to provide electrical isolation from the transmitter and the cable.
MIDI volume pedals are available commercially, although the ones I looked at appear to be designed primarily to plug into an external inline effects box, which I really don’t think Ron would be happy with my using on stage. Plus why spend $80 to buy something when you can spend nothing and have a few hours of fun scrounging parts, soldering, and writing code???
So I needed to build a device to read the position of an analog pedal, translate the A/D value into the proper numerical range, and send MIDI signals to a synthesizer. Fortunately, the Arduino makes it all easy.
MIDI connects devices using a current loop. That is, it’s not voltage on the line that makes it work, it’s a certain amount of current. And the interface is cleverly designed to reduce the risk of damage if something is shorted or wired wrong. Have a look at schematics of the input and output circuits below borrowed fromTom Igoe’s MIDI communication page, keeping in mind that he drew the optocoupler with its LED “upside-down,” so mentally flip the reverse-polarity-protection diode and the orientation of the optocoupler’s pins 2-3 top-to-bottom:
For more detail: Arduino MIDI Volume Pedal
This Post / Project can also be found using search terms:
- arduino midi projects
- midi volume arduino