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.

21 thoughts on “Polyphonic Arduino Sketches

  1. 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.

  2. 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.

    1. 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. :(

        1. You really fail at reading comprehension over and over again on this site. Something that should have been fixed by fourth grade. I am guessing you are older than the ADD craze, so it is probably not entirely your fault, but doing nothing to fix it only slows you down. Get some more alts.

  3. 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.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.