Wouldn’t it be cool if you could control your MIDI equipped digital piano from your iPhone? Imagine a player piano capable of jukebox queuing up MIDI or Audio files and playing them in order. That was my goal! RPI to the rescue.
Required Ingredients:
- Raspberry Pi – Model B, 512MB RAM, 16GB SD Card, Raspbian Linux, Apple 12W USB Power Adapter, USB WiFi Dongle
- USB MIDI Digital Device (e.g. Yamaha Clavinova CLP-440 with USB MIDI port and RCA L+R Audio Inputs)
- Software: Apache HTTP Server, PHP, MySQL, (Nice to have: Netatalk file server, Shairport AirPlay server)
Instructions:
My original thought was to turn the Yamaha speakers into a AirPlay device for our many iOS devices. It’s nice to pipe in background tunes without having to hook up a device. AirPlay is great way to do that but I didn’t want to spend $100+ to be able to do that. The Raspberry Pi is more than capable of doing this. I found an extremely helpful blog post here: http://www.raywenderlich.com/44918/raspberry-pi-airplay-tutorial
NOTE: Power is a big issue for the Raspberry Pi. If you are using a WiFi dongle or any other USB device, I recommend making sure your power supply has enough kick to keep the RPI going. I started out with a microUSB adapter that advertised 700mA but performance became very unstable, especially under load. I switched to a 12W Apple adapter that I had handy and the problems disappeared. The RPI FAQ recommends 1.2A (1200mA).
Setup for AirPiano – MIDI Control
The Project Code: https://github.com/jasonacox/raspberrypi
- MySQL: Database ‘piano’ – see piano.sql file
- Dequeue Service: Run the cron.sh script to have the RPI scan for new midi or wave files to play. Run it with:
bash -x cron.sh 0<&- 1>/dev/null 2>/dev/null &
- Apache: Install apache http with mod_php and mysql support
- Website Code: Install index.php, setup.php and the folder.png files into the document root of your webserver. Upload the MIDI (*.mid) and WAVE (*.wav) files to this location. Be sure to update $globalBase in setup.php to the folder where these files are located.
AirPlay via Raspberry Pi
Adam Burkepile has the best tutorial I’ve found on how to set up a RPI for AirPlay:
http://www.raywenderlich.com/44918/raspberry-pi-airplay-tutorial
Apple Share (AFP) Server via Raspberry Pi
The RPI is great for a tiny file server! At the least, having it run an AFP server will allow quick drag and drop transfer from your Macs. A Samba service for Windows shares is easy to set up as well.
sudo apt-get install netatalk
Yes, it is that easy. Finder will now show your Raspberry Pi under “shared” along with any other local network shares: