In this post, I describe how to use my rotary phone as a MIDI program changer.
This builds on the previous parts in this series.
- Part 1 – Understanding the telephone hardware and interfacing to an Arduino.
- Part 2 – Decoding the rotary dial from the Arduino.
- Part 3 – Rotary phone MIDI note controller.
- Part 4 – Rotary phone MIDI program change.
- Part 5 – Rotary phone MIDI random note sequencer.
- Part 6 – Rotary phone to MIDI adaptor.
- Part 7 – Rotary phone multi-mode applications.
Warning! I strongly recommend using old or second hand equipment for your 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
- “GPO” or “BT” original 746 rotary telephone
- Optional: Scrap ADSL filter
- 120kΩ resistor
- Arduino MIDI interface (e.g. one of these or these)
- MIDI sound module and keyboard
- Breadboard and jumper wires
The Circuit
This time I’ve linked up the Arduino/Phone to my MT-32 as before via the MIDI OUT, but I’ve also plugged in a MIDI keyboard to the MIDI IN port.
The idea is that the keyboard will play the MT-32 through the Arduino and the Arduino/phone can select programs using the rotary dial.
The Code
This code uses the same basic rotary phone dial handling code as described in part 3 but this time the digits are being used to select a voice for a MIDI Program Change message.
The functionality I want is as follows:
- Up to three digits will select a voice number in decimal, in the range 1 to 128.
- When the phone is placed back “on the hook” the current number will be sent out over MIDI as a Program Change message, after being converted to a number in a range 0 to 127.
- Software MIDI THRU functionality is enabled to allow the program changer to sit in between a keyboard and the MIDI module (in my case my MT-32).
The basic algorithm for handling the digits and program change message is as follows.
IF there is a new digit THEN patchNumber = patchNumber * 10 + digit IF phone is placed back "on hook" THEN send the current patchNumber as a MIDI Program Change message WHEN phone is taken off hook THEN set patchNumber back to 0
The digits will be dialed in decimal, in sequence, so each time a new digit is detected, the current recorded patch number has to be “shifted left” a decimal digit and the new dialed digit added in. For example, to dial 42, the patch number will change as follows:
- Start: patchNumber = 0
- Dial 4: patchNumber = 4
- Dial 2: patchNumber = 4 * 10 + 2 = 42
- Hang up: 42 is sent as the MIDI ProgramChange message
There is no checking other than to ensure that when it is time to send a Program Change message, it will only be sent if the patchNumber is in the range 1 to 128 before being converted to 0 to 127 for actual sending.
This means that you could quite happily dial a program of 34125, but it will be ignored when the time comes to send it. Note it would be possible to overflow the patchNumber and have a much larger number interpreted as in the range 1 to 128. For example dialing the number 65537 will overflow the 16-bit integer holding the program number and come out as 1.
But I’m not too worried about attempting to handle all cases here.
Closing Thoughts
If I’m honest when I first thought about potential applications for a rotary phone, this was the one that sprang to mind. I liked the idea of “dialing” the patch for a synthesizer. In the video you can see the voice changing on my MT-32.
I quite like the aesthetics of it.
Kevin