How to connect an iPad to a Raspberry Pi – Video Tutorial


There are a lot of good touch-MIDI controllers available for the iPad.  They’re fun to use and can be customized.  One such popular controller is MidiPads .  In the past, an owner of a Raspberry Pi wouldn’t be able to take advantage of this controller, since MidiPads speaks “Network MIDI” and the Raspberry Pi does not.  (Or did not, at least until now).

That is no longer the case.  McLaren Labs’ rtpmidi  knows how to use the “Network MIDI” protocol that is built into the iPad. Now you can bring the power of apps like MidiPads to your Pi.
This tutorial shows how to use rtpmidi to link your iPad to your Raspberry Pi.  Once paired, MIDI notes created on the iPad using the MidiPads app are sent to the Raspberry Pi where a Sonic-Pi program receives the note information to modify a the sound in a running loop.

The Sonic-Pi Program

Our Sonic-Pi program uses realtime information coming in through a MIDI connection to modify the sound of a simple rhythm. We’ve got a single note playing four times a second but with varying timbres. We want to use the iPad to change the pitch of the note, but not the timing of the four beats per second.
To do this, we use two threads and one global variable. The global variable named $global_note holds the pitch of the current note being played. The first live_loop reads a Note-ON event from the MIDI stream. When it receives a note, it sets the global variable.
The second thread is the one playing the note at a constant rate of four times per second. It makes the note more interesting by cycling through six different synths, and uses the current value of the $global_note variable to set the pitch.

$global_note = 64
live_loop :midi_piano do
  note, velocity = sync "/midi/*/*/1/note_on"
  $global_note = note
live_loop :timbre do
  use_synth (ring :tb303, :blade, :prophet, :saw, :beep, :tri).tick
  play $global_note, attack: 0, release: 0.5, cutoff: 100
  sleep 0.25

One nice thing about this program is that the MIDI input sync statement is indifferent to where the MIDI information is coming from. It could be a USB-connected keyboard or a network-connect iPad or other device. The Sonic-Pi program is simply responding to MIDI events in the Raspberry Pi operating system.


This little demo focuses on how to use rtpmidi to pair your iPad with a Raspberry Pi for use with Sonic-Pi.  Sonic-Pi is a powerful music creation platform.  Use your imagination and the freedom of wireless connectivity to create sounds and textures you control in real time with your iPad.

Leave a Reply

Your email address will not be published. Required fields are marked *

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