Polyphonic Arduino Sketches

MIDUINO

Creating music for the Arduino is simple – just use the tone() library – but it truthfully doesn’t sound that great. That’s because this library is monophonic, making chords difficult or at the very least sound a little weird. [Connor]‘s miduino aims to change that, turning raw MIDI files into polyphonic Arduino sketches.

To convert MIDI files into Arduino sketches, [Connor] whipped up a Python script based on midiCSV that reads the notes and channels of a MIDI file and converts it into the language of the Arduino. Unlike the built-in tone() library, miduino is polyphonic making the music produced from any Arduino sound great. It’s basically the difference between writing music for a PC speaker and a true keyboard; sure, you’re only getting square waves, but it sounds much better.

Oddly, [Connor] hasn’t put up his Python script as far as we can tell. All the MIDI songs are being converted on [Connor]‘s own Raspberry Pi. This is supposed to be cheaper than a VPS, and makes for a very cool project to boot.

Edit: Miduino isn’t polyphonic yet, but [Connor] says he should have that wrapped up in a week or two.

Comments

  1. Eirinn says:

    I think a demo would be a really nice addition to the article :) Here’s a youtube video linked from the miduino website: http://miduino.net/?page_id=941

  2. connornishijima says:

    While the polyphonic conversion process is still a few days off, feel free to upload monophonic files for now and enjoy the free service! I posted a link on Miduino’s homepage to the missing Python scripts! Direct link: http://www.miduino.net/Miduino_V1.zip

    Thank you for the exposure!
    – Connor Nishijima | Miduino Developer

  3. Krylenko says:

    Am I the only one confused here? HaD says Miduino adds polyphony. Connor’s actual site says Miduino is currently monophonic, though he hopes to add polyphony in v2.

    Also, saying Miduino is “basically the difference between writing music for a PC speaker and a true keyboard” is a big leap, since the point of a synthesizer or sample-playback keyboard is that it can create sounds that are far more sophisticated than raw square waves.

    Sure, polyphonic output (which Miduino doesn’t actually have yet!) will make songs with chords or multiple parts sound better than a single voice, but you’re still listening to square waves.

  4. JIm B says:

    This is cool and all, but I want to point out a hack going back to 1977 or so. Jon Bokelman wrote an 8080 program which would accept a textual polyphonic score (not MIDI, but similar idea) and would compile it to an in-memory binary program. The program consisted of carefully timed loops which would execute EI and DI (enable interrupt and disable interrupt) instruction. The S-100 bus of these 8080 systems exposed the state of the interrupt enable. By hanging a first-order RC low-pass filter on that line, like magic you produce music. Even now it boggles my mind how well it worked.

    I have links to the program’ instruction manual, a bunch of scores on my Sol-20 microcomputer website: http://www.sol20.org/programs.html . Skip down to the section starting with the word “Music”.

    Here is a link to one of the scores captured to mp3: http://www.sol20.org/media/d-minor.mp3

    High notes are a bit pitchy because the period is so small it is hard to represent them as an integer multiple of the 8080 cycle time. Keep in mind all of this was done on a 2.04 MHz 8080, where even a NOP takes four clocks, and a jump takes 10.

  5. simpleavr says:

    Here is one similar project I did two years ago on a TI Lauchpad (2K MSP430 device) with 8 channel polymorphic, perl script for midi conversion. Sound quality is not bad but the youtube recording is not so good.

    • rj says:

      I should really post my PIC-based 9 voice polyphony printerhead-using MIDI-receiving synthesizer project writeup anywhere.
      I should also finish building a case for it.

    • Josh Malone says:

      Great demo! Please tell me this was submitted to a wild compo at some party somewhere.

      Also, it’s a shame your camera decided the speaker was the focal point and not the LCD screen. :(

  6. Trui says:

    Why is the MIDI data converted to a huge piece of executable code, instead of simply putting the MIDI data in a table, and having a library function to play it ?

  7. Dutado says:

    Please, don’t compare it to PC speaker. Today, I have been toying around with my HP200LX (XT on 7,9 MHz) that can play MIDI through speaker, though it has to be precomputed from MIDI file. And it sounds pretty good for XT.

  8. JarkkoL says:

    Nice, I did similar project on Arduino Uno playing 16 channel polyphonic music: http://www.youtube.com/watch?v=XZfw7l-ZxqE

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 98,146 other followers