Introduction: Leslie Birchinator - Neopixel Arduino MIDI Switch
It's the Leslie Birchinator. Acacia missed it, it may prove poplar, knock on wood... Ok, the switch case is most likely birch.
If you have ever listened to the sound of a Hammond organ playing, sometimes there is a distinctive warbly character to the sound that makes it even more special. That is when it is played through a set of Leslie rotating speakers. Leslie speakers have rotating speaker horns(fun fact: one is just for show to balance out the mechanism) and a rotating lower baffle for bass that sends the sound out in different directions as it spins. The effect it creates is a complex blend of varying the sounds loudness(amplitude modulation) and change in pitch(frequency modulation - doppler effect like in hearing a moving siren or train horn).
Applying the use of the Leslie speakers or "rotary speaker" effect is part of the skill needed to play the Hammond organ. Mastering the technique to play the Hammond organ is other hard part. And that is even without bass pedals. Time to tame the beast a little.
Sorry, the sound is bad since I didn't have external speakers or a direct feed set up and what you hear is from the headphones in the open. And I have to tone down the brightness of the Neopixels. Videoing a moving unicorn is tough to do. There is a animated rainbow lit ring in the slow mode and switching color sweep in the fast mode.
( update: neopixel brightness down to 16)
Step 1: MIDI Ins and Outs...
I do have a modern-day electronic version of the Hammond B-3, the Hammond XM-1 organ electronic synthesizer module. The outboard controller gives me actual drawbars to tweak while playing but not having a real Leslie speaker cabinet nearby misses completing the Hammond organ experience. Not that I could afford a set after getting a real Hammond, module at least... Like any starving maker, I am playing the module with a basic MIDI controller but it doesn't have the same kind of feel as the vintage instrument or a Steinway while we are at it. I am thinking of building a double keyboard controller and bass pedals though.
The flashing LED is the only indicator of the Leslie rotating. I wanted to revisualize that with what I call the Leslie Birchinator (long long ago, I got to see the late great Les Paul in concert and he demonstrated his Les Paulverizer, so the project name is a take on that as homage to another maker...).
So I was reading up on Arduino programming on the Adafruit Learning System where they had a good set of tutorials on multitasking the Arduino. It had an example of getting multiple sets of Neopixel LEDs to light up in patterns at different speeds. You know I'm all about that Neopixels... This got me thinking, hmmm, that would be cool to adapt as a visualizer for Leslie rotating speakers. And Instructables has an amp and speaker contest running. Serendipitous.
MIDI is the protocol or language that musical instruments can talk to each other. Similar to the way USB can connect computers and devices, MIDI can connect electronic sound generating musical instruments with various forms of electronic controllers like a MIDI keyboard or computer.
The organ module can accept MIDI commands. I've seen all sorts of Arduino MIDI projects so this should be easy. Wait...
I had everything set up on my Adafruit Flora Arduino to get a Neopixel ring displaying the 3 different modes of a Leslie speaker - slow/chorale = slow rainbow color wheel, stop = ring of lights dim to one/scanner, fast/tremolo = changing color wipes. I used a 3 position switch. It is the same kind used for the 3-way selector switch on a Fender Telecaster style guitar. I only used one ring of lights to simulate the upper rotors because to simplify things a bit. Depending on the model of the Leslie speaker, the bass rotor can have only one speed with on/off and that would not add anything to the visualizer. Other customizeable parameters are to simulate the physical set up to get the best sound like the placement of the microphone used to amplify the cabinet.
I wired up an output circuit to a MIDI 5 pin DIN jack. CAT 5 ethernet cable is great to use for wiring. I double up the wires in pairs.
No one labels the diagram of a jack as the front or back so you do not know which is the correct orientation and there is no indicator on the jack which is pin which either. I think I wired it up correctly.
The next step was to start adding in some MIDI to the code. It turns out MIDI is really becoming dated and isn't supported by a wide base as you would think. I am finding there are various MIDI libraries that you can load but I stick to the one linked through Arduino.cc. I install it and go through various ibles, sites, youtube videos to install some sample code to see if I could get MIDI commands out to sound a few notes.
I try a few things and then take the setup to hook up to the organ module. I hear nothing.
I am using resistors from my *bay bargain 10 bucks for a bazillion resistors assortment pack. One of the soldered leads on the resistors gave way from pulling the MIDI cord out so I had to replace it. Then I noticed I had picked a 220k resistor instead of 220 ohms. Big difference. I went to replace those two resistors in the setup. I have to use three 75 ohm resistors in series as I don't have a single 220 ohm resistor in the pack. I also tried a few times to swap my MIDI pin 4 and 5 connections thinking they may be wrong.
Tried again and still nothing. Back to the drawing board. I then read somewhere the MIDI library is only good for Arduino UNOs and not something Leonardo class. The Adafruit Flora is a Leonardo class Arduino because it uses the chip with the integrated USB. The MIDI library was designed to use the off board chip found on older Arduinos like the UNO. At this point, as Gordon Ramsay would say, f***me. I looked up the Adafruit UNTZ MIDI controller and saw that you can install the Teensy board ArduTeensy libraries to configure a kind of emulation for getting MIDI working on a Leonardo class board but also requiring a few additional tweaks. I installed that library. I then tried to verify my existing code but came up with some more errors. Yup, time to dust off the old Arduino UNO and give it a go.
I then ordered a MIDI to USB interface since I didn't have one before. I could load up a MIDI monitor app on the computer to verify that I was actually sending out MIDI messages on the TX pin. The serial monitor in the Arduino IDE is not good for displaying the hex encoded MIDI stream so you don't know what is going on. And always disconnect the TX pin which is your MIDI jack when trying to upload your sketch or else it will fail with errors. The connection to your computer uses it when doing USB/serial communication for the IDE.
OK, back to coding... The MIDI library wiki is not very informative for the noob programmer as it just lists and breaks it down with Class and variable references to who knows what. Everyone seems to declare a different instance object name so lines of code you grab from different places will not compile, upper and lower case matters too.
I took one sample MIDI sketch that sent out a note on and a note off. This time, something actually works on an Arduino UNO. I saw the note on and note off commands in the MIDI monitor app.
The MIDI protocol never really matured into a universal standard so there is a base group of MIDI commands and a set of undefined commands that can be used by the instrument manufacturer as they need it. MIDI commands are usually composed of the code number given to the action and then the values or parameters to do the action.
What I wanted to do was to turn the Leslie speaker effect on and off. I also wanted to control whether the effect was the SLOW/CHORALE or FAST/TREMOLO setting.
Looking through the Hammond organ module manual, the MIDI codes for those settings were in the manufacturer defined range - NRPN (Non registered parameter number - nurpins) Most significant byte, least significant byte, 14 bit number... Gordon...
Without getting into what bitwise sorcery is used for that, I found you can issue the basic standard controller change messages(MIDI cc) for NRPNs. Also, there were warnings that NRPNs might freak out your sound module. Yes, there is a MIDI Panic command available.
So, a typical chain of MIDI control change messages using MIDI channel 1 are:
// nrpn leslie on
MIDI.sendControlChange(99, 0x09, 1); // NRPN lsb
MIDI.sendControlChange(98, 0x00, 1); // NRPN msb
MIDI.sendControlChange(06, 0x7f, 1); // NRPN parameter lsb
MIDI.sendControlChange(38, 0x00, 1); // NRPN parameter msb
// nrpn leslie fast
MIDI.sendControlChange(99, 0x00, 1);
MIDI.sendControlChange(98, 0x00, 1);
MIDI.sendControlChange(06, 0x7f, 1);
MIDI.sendControlChange(38, 0x00, 1);
// clear NRPN code pointers
MIDI.sendControlChange(99, 0x7f, 1);
MIDI.sendControlChange(98, 0x7f, 1);
Most musical instruments only have one MIDI input. I had to use a MIDI merger box to combine the MIDI from the keyboard to go into the organ sound module. You can adapt the Arduino UNO to become a MIDI merger by adding a MIDI input circuit. All you need is an isolinear, wait, optocoupler chip to electronically isolate the controllers from the Arduino and a few more resistors. But that is for another day.
Step 2: Fine Cabinetry...
I wanted something cool artsy looking to contain the round Neopixel ring. The animated LED lights would simulate the rotation of the Leslie speaker rotors/horns so it should be rounded...and organic looking. Well, a wood bowl would be just right to adapt. And it needed a bezel/diffuser for the Neopixel ring. I recently got a 3D printer on clearance (it was borked but I resurrected it...another story) so I tried one of my first test prints on an Adafruit Yo-yo part (Woot, the Adafruit logo is embedded in there...)
I had a hole saw that fit inside the lip of the yo-yo face. I drilled out a hole in the wood bowl and fit the bezel from inside. The cut edge of the bowl was carefully daubed with mineral oil to even out the color with the rest of the bowl. I sanded the back of the opening a bit to unfinished wood and then used E6000 glue to attach the bezel in place.
Note that I drilled the hole off center. When I was positioning the bezel on where to drill the hole, it looked like Europa, one of the moons of Jupiter (the woodgrain of the bowl looking like the striated pattern of Jupiter), but I digress. All these worlds are yours, use them together, and save the third stone from the Sun.
I made a bottom part out of layered corrugated box cardboard to mount the neopixel ring and fitted to the bottom of the bowl. The bottom was lined with felt to give it more grip but was still slippery because the entire unit is not weighted.
The traditional or classic switch for the Leslie speaker control is half-moon shaped and mounted near the bottom of the front of the keyboard for easy access while playing.
I used some index cards/cardstock to mock up the switch housing. Since I didn't have a real one to measure off of or the dimensions of one, I made one up by eye. From pictures I could see it was about 5 piano keys wide. I formed the backside and then extended it with more cardstock to form the mounting rim to fit the contour of my actual keyboard. You get this Z kinda shape sticking out of the back. The D half moon shape in the front was sized big enough to contain the switch.
I then used the same technique for my Star Trek Enterprise Composite Shelves to build out the switch housing. Veneer with popsicle sticks/tongue depressors. I double layered the cardstock model to get a rigid structural switch housing.
I didn't really think much of how I was going to mount the switch but the body of the switch has a T shape. The real Leslie switch has just has the switch post peeking out of a slot. This would require an undermount but I was only going to drop it into a rectangular hole in the switch faceplate and screw it down.
I used the biggest drill bit that fit the size of the marked opening and drilled multiple holes to eat away at it. I finished off the opening with a file.
Mark your switch with which way it should be oriented when mounted in the housing. If you are making this, cut the T shaped hole to match the body of the switch, otherwise a big open rectangular hole will take away the bit of wood the screws need to bite in at the ends.
Sure, I could have spent time to model the housings on the computer and then a few more hours in iteration and 3D printing. I did all that the old school way. It's more fun to get your hands dirty.
Step 3: Knock It Off...
Paint it black...
Sand the wood switch housing smooth and wipe with a tack cloth to remove the dust.
I just used an acrylic black to paint it but go with a real enamel to get that glossy original bakelite plastic look.
I printed up some switch labels including a grab of the real logo - yeah, the registered trademarked brand...
Use a black sharpie to black out the cut white paper edges when you trim the labels down to size.
Apply a little bit of glue all over the back to adhere the labels. They seemed to grab real quick so I had trouble getting them on straight as it curled and was easily torn when wet with glue. I was going to Mod Podge the labels on and give it an overall gloss coating but my last jar of Mod Podge coagulated somewhat.
Let dry and then you can install the switch in the housing. I had to desolder one of the switch leads to the arduino in order to feed the switch and wire through the hole. Tighten down the screws. There was wood for one of the screws to dig in. It was a nice tight fit overall so I didn't need to apply any hot glue to make it extra secure.
Step 4: Take It for a Spin...
A there you have it, a classic Leslie speaker half-moon switch to go with a Hammond organ.
Chorale or Slow, Off/Brake, Tremolo or Fast.
I duct taped the switch housing to the bottom of my keyboard controller. When I get a feel for where it will be placed best for playing, I will switch over and remount it with a more permanent tape/velcro.
I could fit the Arduino UNO inside the wooden bowl but I guess it would be more of a challenge to get everything working on the Adafruit Flora. There might be a newer and smaller platform that MIDI would be easier to implement on.
Back in the day of classic rock, one could only wish to have a real Hammond B-3, Fender Rhodes, Mini-Moog, and Clavinet..., now all presets on any electronic synthesizer. A Yamaha GX-1 was beyond mortal reach. If anyone wants to talk retro gear, comment below.