Raspberry Pi Plays MIDI Without An Operating System

[youtube=http://www.youtube.com/watch?v=k6TCysv6AzE&w=580]

For all the interesting DSP functions locked away in the Raspberry Pi, it’s still hard to imagine using the Raspberry Pi as an eminently capable software synthesizer, tracker, or sequencer. Running any of the usual Linux digital audio programs means – surprise – running Linux, and the performance penalty associated with that.

It would be much better if all these audio programs could run directly on the Raspberry Pi without an operating system, and [Joe]’s project is right up that alley. He’s playing MIDI files without an operating system, in effect making the Raspberry Pi a very powerful embedded platform.

[Joe]’s build is the first bare metal audio code for the Raspberry Pi. It’s actually an LV2 plugin host that will load audio plugins, read MIDI files, and shoot the resulting audio out over the 1/8″ jack on the Pi.  This work wouldn’t have been possible without a few Raspberry Pi bare metal tutorials put together by [David Welch].

Hopefully this won’t be the last we’ll see of [Joe] and his code; the Raspberry Pi has more than enough horsepower to be an amazing sampler, synth, beat machine, or the next generation of Akai MPC. All we need are a few brave coders to take up coding bare metal on the Raspberry Pi.

14 thoughts on “Raspberry Pi Plays MIDI Without An Operating System

  1. Dex: That’s cool, looking forward to seeing it. Did you manage to set the clock source for the PWM to one of the PLLs? It didn’t seem to work when I tried it, so I’m using the ‘oscillator’ source, which gives pretty lousy quality.

    1. I am having the same problems as you (can not get PLLs working in bare metal), but i am working on it ;), will release demo and code as soon as i get to the bottom of it.
      I have improved the sound quality a bit (still only can only play 8bit wav’s)
      Heres a kernel.img if you want to hear it
      http://www.dex-os.com/ARM/pi-sound.zip

      Really like your bare metal midi player, maybe i will get round to porting it to DexOS
      one day.

      1. Awesome, sounds funky.

        So, I’m now hoping I can neglect the PLL issue for now and somebody else will work it out for me.

        On a similar note, at some point I’d also really like to get a filesystem working on this (at the moment everything’s statically linked into the kernel). I think you mentioned on the rpi forums that you were going to port your fasm filesystem functions to gnu asm. This would be really for handy me at some point, if you’re still planning to do it. I don’t have time to work on this for a bit though, so no rush.

  2. What is this nonsense? Linux is a very lean kernel indeed and does not steal your precious cpu cycles if so configured.
    I’m not saying there’s anything wrong in coding for “bare metal”.

    1. It’s true, you can set your Linux program to run as SCHED_FIFO and you won’t lose cycles to other processes.

      My reasons for doing this were broadly: I might want to port it to non-Linuxy platforms like Stellaris; musical instruments with long boot times are annoying and potentially disruptive when performing; a whole Linux distro just seems excessively big and complicated for the task; it was fun. Preserving my precious CPU cycles was never really the point.

      1. Because it, unlike other behemoths like windows, is versatile enough to run on tiny micro devices all the way up to Supercomputers. It can do this exactly because it ISN’T full of bloatware and can be cut down and customised to run very well on embedded devices. Hence it being regularly used for just that purpose. Bare bones is fun, but they make it too hard with all the reverse engineering these days. Back in the hardware banging C64/Amiga days we had rom kernel manuals and hardware reference manuals so bit banging the hardware was fun. Without such documentation much of that fun is taken away. ARM/Pi would be the perfect place to re-kindle competitive learning in the demo scene on dedicated like hardware. It’d be perfect. But until the powers that be realise that giving away doco without an NDA is advantageous for such devices we should all be grateful that we can leverage the work Linux devs have put into enabling devices such as this.

Leave a Reply to JoeboyCancel 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.