MonomePi: The Monome Raspberry Pi Server
I love my Monome. I really do. It's a very well built piece of hardware. It feels quite expensive. It is quite expensive.
What I don't like about the Monome Linux support is pretty terrible. Don't get me wrong, it's a good thing that the Monome even HAS Linux support. However, the setup on the website mentions installing MaxMSP under WINE. Anyone who has ever tried working with WINE knows this is not a good fix by any means. If you using Linux to make music, all your software should be native, otherwise you aren't really using Linux.
Over the years, I've tried very hard to use my Monome with Linux without using MaxMSP. Today I wish to share the solution I've come up with: MonomePi.
Why a Pi?
In my experience, SerialOSC doesn't really work without the monome max object. I've had better luck with the older Monomeserial. This works fine, except for the fact that sometimes it caused my computer to freeze. To fix this, I made a server that acted as a wrapper for Monomeserial.
This server would boot up and have one job: run Monomeserial, listen for OSC messages and forward them over ethernet.
With some slight code modifactions to Monomeserial, I was eventually able to port this simple server to the Raspberry Pi.
The Pi is portable, can be powered via USB power, and allows me to run the Monome on any computer with support for OSC over ethernet.
A few nights ago, I had to make a MonomePi server from scratch, so I'll show you what I did.
Please note that I've only tested MonomePi on the 2010 greyscale edition 64 and a homemade 64.
The first step is to download the Raspian image from the Pi website. I happened to have an image from 6-20-2014 laying around, so I used that. There are several tutorials on how to properly flash Raspian from the commandline, so I won't bother explaining. But here is the command I used:
Boot up the Pi. Expand the filesystem if you'd like, and change the keyboard settings if you don't use a UK keyboard. After logging in (name:pi/pw:raspberry), update the system, and install liblo.
dd if=2014-6-20-wheezy-raspian.img of=/dev/sdd bs=1m
sudo apt-get update sudo apt-get install liblo-dev
The next thing we are going to do is make sure the program automatically logs in. This is going to require editing "/etc/init.d".
In your text editor of choice, find this line:
1:2345:respawn:/sbin/getty 115200 tty1
And replace it with this one:
1:2345:respawn /bin/login -f pi tty1 < /dev/tty1 > /dev/tty1 2>&1
If you reboot your machine, your pi should automatically login as "pi."
Compiling and installing
You will need to download these files to get the proper source code and tests needed for MonomePi. This file needs to end up extracted on your Pi somehow. What I did was copy it from a flashdrive that I put it on:
sudo mkdir /mnt/memory sudo mount /dev/sda1 /mnt/memory sudo cp -r /mnt/memory/monome_pi.tar.gz .
Now it's time to compile our programs! Typically it is not a good idea to compile on a Pi due to the processing power of the machine, but these programs are small enough that it doesn't take too long.
First, extract the file and cd into it...
tar zxvf monome_pi.tar.gz cd monome_pi
...then go into the libmonome_pi directy, compile, and install it. This will install monomeserial, which will detect the Monome and send OSC messages.
cd libmonome_rpi ./configure make sudo make install
If that works without fuss, you can go into the monomewrapper directory and install that. This is a simple program I wrote in C that will handle the OSC message forwarding. There is no need to be run sudo with these commands. Running these commands will wipe out any previous incarnation of ~/.bashprofile:
cd ../ cd monome_wrapper make make install
At this point, it would be a good idea to test out monomeserial to see if it works. Plug in your monome and run "monomeserial" without any arguments. If it works successfully, you should see some text: "monomeserial version 1.0, yay!"
With all this working, you should now begin configuring IP addresses...
Configuring the Network on MonomePi
In order for MonomePi to talk with other computers, it must be configured with proper static IP addresses.
Computers talking to the Pi need to know what the IP address of it is. Edit the file /etc/network/interfaces and comment out the following line like so:
#iface eth0 inet dhcp
Then add these lines underneath...
#iface eth0 inet dhcp iface eth0 inet static address 169.254.0.3
"169.254.0.3" will now be the IP address of the Pi, and where OSC messages will be sent.
The Pi needs to know which IP address to send OSC messages to. To configure this, we add a line in "/etc/hosts":
sudo echo 169.254.0.4 monomedest >> /etc/hosts
MonomePi will now send OSC messages to any computer with the IP address 169.254.0.4
Make sre your monome is plugged in and reboot. If all goes well, your monome will have a light startup sequence indicating all things are functioning. We can now run some tests on your main computer!
On your working computer, make sure you can set the IP address to "169.254.0.4". Find an ethernet cable and connect your computer and your MonomePi together.
In the monome_pi folder, there is a directory called tests, which contain simple test programs written in ChucK or Csound.
If you have ChucK, run the chuck program with:
If you have Csound installed with the OSC opcodes, you can also run the Csound program with:
When either program is run, press the buttons on the Monome. If they light up, congratulations! Everything is working!