Pure Data, Android audio, and random stuff

Noisepages: Websites for smart artists.

I recently read You Are Not a Gadget by Jaron Lanier. It’s a strange book, half-baked and infuriating, yet hard to put down. It’s great fun to contemplate the myriad ways in which Lanier’s arguments fall flat. There’s only one major point that I agree with: MIDI is a plague upon humanity. (Note: In this context, I mean MIDI as a way of representing music in software; MIDI as a way of connecting various pieces of hardware is great.)

I had been resisting repeated requests for MIDI support in libpd, but when Apple added CoreMIDI support to iOS 4.2, I finally caved and added basic MIDI functionality to libpd. My excuse is that sooner or later it would have happened anyway, and besides the goal is to create a tool that’s useful to many people, not a vehicle for my worldview.

The new functionality mirrors the message passing mechanism that has been part of libpd from the beginning: There are functions for sending MIDI events to libpd, and if you want to receive MIDI events from libpd, you implement handler functions and assign them to the appropriate hooks in libpd. Exchanging MIDI events with other components such as CoreMIDI is the responsibility of the client code. The new functionality is documented in the wiki.

I hope that developers will not have to support MIDI in their software in the not too distant future. I just made a small contribution to the entrenchment of MIDI in audio software. I’m experiencing a bit of cognitive dissonance right now.


11 Responses

  1. rj

    Is it really that bad to have a MIDI keyboard you want to support?  I, personally, want to be able to plug my keyboard into my phone/tablet.  Sure, it doesn’t need to be MIDI as a protocol, but there aren’t too many OSC keyboards out there.

  2. Peter Brinkmann

    As I said above, MIDI as a way of connecting various pieces of hardware is great; that includes your keyboard and phone. I have a number of MIDI devices that I like a lot and don’t want to get rid of.

    My complaints are strictly about MIDI as a way of representing music in software. Apart from the limitations that everybody likes to complain about (low resolution, no real notion of a note, etc.), I’m mostly bothered by the duplication of effort that MIDI forces upon us. In the case of libpd, for instance, the MIDI handling code is almost identical to the message handling code, and it provides no functionality that couldn’t easily be achieved with regular messages. It still adds value, of course, because it will reduce friction for people whose workflow includes MIDI. That’s why I implemented the functionality, in spite of my misgivings.

    When I say that I’m hoping that developers will not have to support MIDI in the future, I mean that I hope that we’ll all settle on a better protocol for representing music in software. When you plug your MIDI hardware into your computer, the driver will automatically take care of the conversion between MIDI on the hardware side and the mythical new protocol in software. Users of MIDI hardware won’t even notice the change.

  3. rj

    I have to agree with you there.  
    Out of curiosity… will libpd be able to find usb midi devices on android? Or is there driver work that would need to be done?

  4. Peter Brinkmann

    libpd does not include any driver code, MIDI or otherwise. That’s by design; libpd is only meant to do two things, signal processing and message handling (the new MIDI support is a form of message handling). Everything else, especially dealing with hardware and drivers, is the responsibility of the client code.

    Moreover, I’m not even sure you can plug any MIDI devices into Android phones, at least not without hacks. Somebody did a USB host mode hack a little while ago, but this won’t work with a stock phone right now.

  5. Chris McDowell

    Sweet! You rock, Peter. Can libpd be used in a microcontroller? as in an arduino with extra memory or a pic? my dream is to use PD as the dsp engine for small hardware projects.

  6. Peter Brinkmann

    Thanks, Chris! I’m afraid Pd will not work on an Arduino; in addition to extra memory, you need at least 25MHz and a floating point unit.

  7. Chris McDowell

    Ah bummer. Is there any hardware that you could recommend that could handle it? Other than an iphone of course. I’m wondering if an old pda would be the cheapest way, but then my sensor input would be hella limited. suggestions?

    ps thanks for the quick reply!

  8. Peter Brinkmann

    An old PDA probably wouldn’t quite have the necessary lung power, either. If you want to run libpd on a small device, you may want to look at BeagleBoards or Gumstix. I believe they do audio I/O, but I have no idea whether it’s any good. If you try this, please let me know how it goes, okay?

  9. [...] in the latest version of iOS. I wasn’t too thrilled about this, not just because I’m no fan of MIDI but also because Android currently does not support MIDI. So, I decided to add MIDI capabilities to [...]

  10. [...] just in case someone else is crazy enough to write an app that handles MIDI files. Given the way I feel about MIDI, however, I sincerely hope that this post will be of no interest to anybody. 0 Leave a [...]

  11. GS test demo

    Cognitive dissonance and MIDI support in libpd

Leave a Reply