Tuesday, July 9, 2013

Polysix - Adding a Sustain Pedal

A stock Korg Polysix does not allow for a sustain pedal.  The Polysix does have a jack to set the Chord Memory using a pedal (which is a bit esoteric) but not for sustain.  Why?   In my opinion, this should be a basic feature of any polyphonic synthesizer.  Well, ever since I replaced my Polysix's "Key Assigner" with an Arduino, I've been looking forward to adding a sustain pedal to my Polysix.  This post describes how I did it.  Here's a video demoing my mellow enjoyment of it...

Previous Approaches:  Looking around the web, there are a couple of approaches that people have taken to adding a sustain pedal to the Polysix.  On the Polysix Yahoo Groups archive, this thread has some replies that talk about adding some electronic components that, in effect, use a foot pedal to be a remote-control for the Polysix's "Hold" button.  While that is OK, turning off the "Hold" button (on a stock Polysix) turns off all notes, including those that are still being held by the player's fingers.  This is not what I want.  The only way that people seem to have had success is with the various MIDI retrofit kits (eg. from Kiwitechnics, from Johannes, or from CHD).  Nearly all of them replace the Polysix's Key Assigner with their own microprocessor and software, which allows them to add the sustain pedal functionality.  Since I, too, replaced my Key Assigner, then I, too, can add the sustain pedal functionality.

My Plan:  My plan is to take a similar approach as all the MIDI retrofit kits.  I'm going to re-use one of the jacks on the back of the Polysix, I'm going to wire it back to my Arduino (my replacement for the Key Assigner), and I'll write some software for the Arduino that will implement the sustain pedal functionality.  Now, when I add the sustain pedal, the configuration of my modified Polysix will look like this:

Choosing the Jack: For my sustain pedal, I chose to use the "From Tape" jack on the back of the Polysix.  I do not plan on using the Tape functionality anymore, so I'm now re-using one of its jacks.  Future mods (e.g. Portamento pedal) will utilize the other jacks.

Re-wiring the Jack:  Inside the Polysix, I disconnected the white wire that had been connecting the jack to the small High/Low switch.  You can see in the pitcure below that I labeled the white wire (in case I want to reconnect it in the future) and soldered in a red wire in its place.  In this picture, the wire that I added is the red one going down -- not the one going up and to the right.

Connecting to the Arduino:  Stringing the red wire along the bottom of the back panel of the synth, I pass by the power supply and reach the Arduino Mega mounted on the other side.  The Arduino is already wired up with tons of wires connecting it to various parts of the synth (most of them going to the jack for the old 8049 Key Assigner).  I added the single wire from the Sustain Pedal jack to the mess of wires shown below.  It's connected to one of the digital pins.  With this mess, though, even I can't tell which one it is.  You'll just have to trust me...it's connected there somewhere.

Configuring the Arduino:  To configure the Arduino to read the foot pedal, you have to understand how the pedal works.  My foot pedal is a normally-open switch.  This means that, normally, no current will flow through the food pedal.  When you press the pedal, the switch closes, which will allow current (if a voltage is imposed by the Arduino) to flow through the pedal.  This is how the Arduino will sense whether the pedal is closed or not.  In the Arduino software, I tell the Arduino that the given digital pin is an input (via "pinMode") and  tell it to impose a voltage on this pin via its pull-up resistor (using "digitalWrite").

Reading the Pedal State:  The software to read the state of the pedal is simply "digitalRead".  If the pedal is not pressed, no current will flow, so the pull-up resistor is able to maintain 5V at the Arduino's pin.  Therefore "digitalRead" returns HIGH.  When the pedal is pressed, it allows current to flow from the pin to ground.  That current has to pass through the pull-up resistor, which means the voltage at the pin as seen by the Arduino is very low.  As result, the "digitalRead" will return LOW.  So, whenever "digitalRead" says LOW, the pedal is pressed and the Polysix should sustain all its notes.  Whenever "digitalRead" says HIGH, the pedal is not pressed and the notes should decay normally.  Easy.

Writing the Software to Sustain the Notes:  While reading the state of the pedal is easy, writing the software to implement the sustain and release logic was surprisingly challenging.  The "voice stealing" algorithms that allow a six voice synth to gracefully handle more than six MIDI notes get more complicated if some of the notes are being sustained.  If you're looking to implement your own Key Assigner and looking to add a sustain pedal, expect to spend a little time trying to think clearly about how you're going to implement it.

Success:  Luckily, a little good old fashioned trial-and-error combined with a whole bunch of "Serial.println" commands afforded me an inefficient, but ultimately effective, path to success.  The video at the top is a demonstration of its functionality.  Normally, I like to play at fast tempos.  The sustain pedal motivates me to slow down and relax.  I like it.

Thanks for reading!

Update: I shared my Arduino code here

No comments:

Post a Comment