MSP430 Launchpad Simple MIDI Synth
- February 11th, 2011
- Posted in Audio . Launchpad . MIDI . MSP430
- Write comment
It’s been awhile since I’ve posted anything, but I’ve been working on several projects. I’ve just been feeling lazy about writing them up. I thought this one might be the most enjoyable and useful to people. I’m going to keep it short and sweet, so please comment if you have any questions.
This is a simple square wave synthesizer. It has a standard midi interface, so it could be used with a midi keyboard or another midi controller.
Here’s the BOM:
1x TI Launchpad or another MSP430
1x 280 ohm resistor (can use internal pull-up instead)
1x 220 ohm resistor
1x Sharp PC900V optoisolator
1x Speaker (I just bought one from RadioShack)
1x MIDI female jack
1X diode
A midi cable and some kind of midi controller
You could probably get away with not using the optoisolator, but I felt like adhering to spec with the hardware. If you want to use another MSP430, be sure it has a USI and not a USCI, or you’ll have to rewrite some of the code. Also, the code expects to have the DCO calibrated for 16MHz. I think an approximation would work too, but if you’re too far off the midi clock will skew and the notes could be detuned as well.
The speaker gets hooked up to Launchpad ground and P1.2.
On the software side, the USI runs constantly and oversamples the midi data from the optoisolator. The oversampling is resolved with something like a state machine(?). I tried to use the USI properly, but I always seem to run into issues in using it with clockless serial. There’s probably a cleaner way to read the midi data, but it works, so I don’t mind. It’s all yours to fix!
Once we’re able to read the MIDI, it’s just a matter of properly adjusting the period of TimerA, the square wave sound generator, to get the proper note. The synth is monophonic, so some care is also taken to handle and store simultaneous on-notes.
Here’s the MIDI Synth main.c. This compiles on CCS.
By the way, you can use one optoisolator circuit to send data to multiple launchpads. Just assign each LP a different MIDI channel by changing this line of code:
#define MIDI_CHANNEL 0
So I hooked it up to my midi keyboard. That was OK. Then I downloaded some midi files and routed them through a USB – MIDI converter with Ableton Live. Now that gave me a warm, nerdy feeling inside.
Check it out:
Get Back
Zelda
Tainted Love
Try Again


Nice work NatureTM. Looks like we have a MIDI parser for the Launchpad now.
Nice indeed. In case you don’t want to use four launchpads, you can probably just assemble four 430′s on breadboard or such, just program them on the board or on launchpad one at a time :)
Thanks! Yeah, this was the quick and dirty way. Just flash each LP with the same code but a different midi channel and connect ground and data. I was thinking about doing something like you said to make the synth polyphonic. There’s also a trick someone did with arduino to simulate poly with only one pwm output. Also, I got some DAC’s I was thinking about incorporating for some nicer sounds. The list grows…
I’ve actually been thinking of doing the opposite and making MIDI controllers, possibly using the ADC and pots and/or switches.
Nice, I’ve actually been thinking the same thing. In fact, I just finished soldering some wires to an touchpad from an old laptop. I’d love to get that working and have something like a Kaoss Pad midi controller. I don’t plan on working to hard on it, so if you get something first, drop me a line!
have a ton of switches and misc pots and faders from a few dead mixers i was wanting to convert to a midi controller for ableton as well.
Hopefully was trying to do this with My launchpad, just have no idea where to start on the code for a grid of switches. and sending it as midi through the launchpad to the PC.
There’s some stuff on 43oh.com about hooking up a lot of switches to a few pins. If I were to try to build something that sent midi into my pc, I’d first work on getting the controller hardware to generate some proper midi signals. I would then put that through a midiusb converter. That way you build a real and compatible piece of midi hardware, and have a way to connect it and other midi stuff to your PC.
Hi, looking through your code you define SPEAKER_PIN as BIT2 but never use it; rather, it looks to me like you are writing to BIT6 for the speaker (in updateSynth()). Should the speaker be connected to pin 6, or pin 2?
I have SPEAKER_PIN just there for reference, even though it isn’t in the code. The speaker should be connected to pin 2. Pin 2 connects internally to Timer A’s Compare1 output hardware, which is setup to generate a square wave for the speaker. The section where I am toggling pin 6 just toggles the Launchpad’s on-board LED for a visual indication of whether or not a note is being played.