Making beautiful MIDI music (with .Net Gadgeteer)
- Posted: May 11, 2012 at 6:00 AM
- 5,669 Views
- 1 Comment
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Today's Hardware Friday post is in an area that I've not cover much, making music with .Net Gadgeteer projects using one of the older digital interfaces around, MIDI.
At the end of what's been a kind of tough week, with a spring cold making its way through my entire family (one of the perils of having young kids at home), I got a nifty package in the mail. Inside was an anti-static foil bag containing the parts for a nifty addition to my Gadgeteer hardware collection, the new MIDI Module created by my friend and fellow Microsoftie Pete Brown. I should have thought to snap a photo of the kit before assembling it, but I was sufficiently excited I could hardly wait to heat up the soldering iron. Here's what the finished module looks like:
So, OK, you might ask. Looks neat, and all, but what does it DO?
Well, for the uninitiated, MIDI stands for Musical Instrument Digital Interface, and the short definition is that it's a serial protocol specification that lets musical instruments "talk" to one another. MIDI allows devices to communicate musical information (which note to play, how loudly to play it, etc.) digitally in a highly efficient format. Instead of creating a waveform and pushing it through limited bandwidth pipes, MIDI allows a controller device to simply provide instructions on what note should be played, which channel it should be played on (MIDI supports up to 16 channels per interface), along with any information on the specific sound (referred to in MIDI parlance as a patch) and parameters (referred to as control change) for the target device. Then the controller leaves the actual generation of the sound up to the receiving device.
So what Pete's module does is allow a .NET Gadgeteer program to act as a sender or receiver of MIDI data. Which can be pretty fun stuff, with just a little work.
MeeBlip, You Blip, We All Blip!
In addition to his Gadgeteer hobby/habit, Pete is also a collector of various MIDI synthesizer gear. Most of what he plays with doesn't fit within my budget, but about a month ago he sent me a link to a neat open source hardware/software synth called the MeeBlip. From the "What is MeeBlip?" page:
MeeBlip is a hackable, affordable digital synthesizer, made for accessible sound and hands-on control. It can be someone’s first synth. It can be a unique-sounding addition to your music setup, playable with MIDI hardware and software. It can be a synth you open up and modify, learning about sound creation, code, and electronics. Or it can be the basis of new projects and ideas.
The MeeBlip SE, at $149, is pretty cheap as synths go, but what hooked me was the MeeBlip micro, which omits all the knobs and switches, and requires assembly, but costs less than 40 bucks. I ordered one, and it arrived a couple of weeks ago.
This is another example of the GLIDE project being used too (Gliding into a .Net Micro Framework UI design with GLIDE);
For the UI, I connected the 3.5" touch screen LCD from my Spider starter kit, and added a button module for starting and stopping the arpeggiator, and a Joystick module for controlling two separate parameters at the same time. You can see how these modules are connected in the image above. In the physical world, I had most of this hardware already connected in my customized Gadgeteer Arcade enclosure, so I just added the MIDI module to the mainboard, and I was good to go, hardware-wise.
To design the UI, I decided to use GHI's GLIDE UI library. While you can design your UI in Gadgeteer using WPF, and it works pretty well, WPF on .NET Micro Framework doesn't support XAML, so you end up doing things programmatically. That's not a terrible thing, but as a web geek, I find markup much more intuitive to work with for UIs. GLIDE uses XAML-like markup to define your UI, and also provides a designer that gives you some WYSWIG-ish functionality:
And here's the final product (Click through for a video of it in action too);
When I press the button, a timer defined in the program will start running, with the interval of the timer being adjustable via the Slider control. At each timer tick, the program will look at the current RadioButtonGroup, find which RadioButton is selected, and retrieve its value, which contains the MIDI note number to be played. Then the group number is incremented, the note played, and so on.
Also at each timer tick, the position of the joystick is retrieved, and used to send MIDI control change messages for the filter resonance and filter cutoff parameters of the MeeBlip (cc 48 and 49, respectively. You can view a full list of the MIDI cc mappings for the MeeBlip micro at the bottom of this page).
Remaining tasks include adding another UI page (or set of pages) to control the rest of the available parameters on the MeeBlip micro, including perhaps re-mapping the joystick to different parameters during playback, as well as possibly adding the SD card module so I can save and load "patches" of different settings for the MeeBlip micro parameters, so once I find a really sweet sound, I can save it and reproduce it whenever I want.
In addition to using this very simple arpeggiator program, Pete's MIDI module also has MIDI in, and you can easily enable "soft" MIDI thru, which essentially echos whatever commands it receives at the MIDI in port to the MIDI out port. So I could plug a keyboard or other MIDI controller into the module and use it to drive the MeeBlip as well.
Here’s a few more links you might find interesting: