Raspberry Pi – AirPiano

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.

RaspiModelB

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:

Screen Shot 2013-12-27 at 11.22.08 PM

 

 

 

 

Yamaha Clavinova CLP-440

I wanted a music workstation synthesizer and my wife wanted a real acoustic piano that looks like beautiful furniture.  We compromised by getting the Yamaha Clavinova CLP-440.  It looks, sounds and feels like a real piano with enough tech (MIDI, USB, voices) to make a armchair techy musician like me happy.  The PDF documentation covers most of the details you will need to start using the nice features, but there are a few things lacking so I’ll record some of my discoveries in this post.

USB Files

The piano has a USB port that will easily accommodate a thumb drive or external hard drive.  It stores and reads MIDI and WAV files.

Files created by the Clavinova will be stored in the “User Files” folder with a name USERSONG??.MID for MIDI files and USERAUDIO??.WAV for Audio files saved from the Clavinova.  The ?? is the number of the song selected from the Clavinova LED interface.  Here is an example listing of files on the USB drive:

USB Host with iPad

I wanted to be able to use my iPad to link to the piano for added voices and sequencing.  There are several MIDI options available for the iPad, but since the CLP-440 has a USB host port, I was able to use an iPad camera kit (essentially an adapter to allow the iPad to view pictures from a SD card or USB camera).   The Apple version and third party version should work fine.  Using that, I found that several apps could see and control the CLP-440.

iPad Apps for the CLP-440

Searching the Apple iTunes store for app to work with the Clavinova wasn’t easy.  I’ll record a few good apps that I found.

GarageBand
http://itunes.apple.com/us/app/garageband/id408709785?mt=8 – This $5 app from Apple is amazing on its own but it works great with MIDI from the Clavinova.

Midi Monitor
http://iosmidi.com/apps/midi-monitor/ – This app shows the iPad connecting to the Clavinova and the events coming from the keyboard (as well as driving action back to the keyboard through the iPad interface).  Useful for troubleshooting.

Alchemy mobile Synth App
http://www.camelaudio.com/AlchemyMobile.php – This great app from CamelAudio adds a great selection of synth voices to be controlled by the Clavinova.  As their site says, “Turn your iPhone/iPad into a powerful synthesizer! Alchemy Mobile includes everything from evolving soundscapes and fat basses to lush pads and pulsing arpeggios, and is available for free from the iTunes App store.”

 

 

Music and Sound

Sound

I have been looking for good tools to create and edit soundtracks for my projects.  Thanks to a friend, I have a MIDI keyboard and a Roland D110 synth module.  It has that great synth sound!  I haven’t found a good MIDI editor/sequencer yet, but there are a few multi-track recording programs that are worth noting.

Roland D110 (Roland D-110 Manual)

Sound Creation

A friend pointed me to a great tool called SynthEdit that allows you to create your own synthesized sounds.  It takes MIDI input.  I highly recommend but be warned, you will spend too much time with this! 🙂    A good online resource by the author of several great YouTube tutorials on SynthEdit is here: http://www.xoxos.net/  Later we found a similar tool, but with a much better interface and features: SynthMaker.

Here is a good book, “How To Make A Noise – A comprehensive guide to synthesizer programming” located here: http://www.noisesculpture.com/index.html

Sound Recording / Editing Tools

For Mac user: go with GarageBand

For Linux: Rosegarden

For PC:

Cubase Studio 4
Ableton Live LE
Cakewalk Music Creator
MAGIX Music Maker

KVRaudio.com keeps a data base and reviews of all the apps.

MIDI Software Synthesizers / Sequencing / Editing Tools

The KORE player from Native Instruments is a free MIDI software based synthesizer.  It comes with several synthesized and sampled instruments.  You can purchase additional sounds through their website.  These sounds are simply amazing.