The Lyrabox is a versatile and handy little musical controller. You can take it on stage and enjoy playing a device that is unique in every way. And I guarantee that you’ll find it pretty awesome! It is small enough to carry it around, and you only have to plug it in to play it. Nothing else needed. Although you can also bring your laptop and have the synthesizer running on there while sending the controller data wirelessly. Further down you can learn how to build your own Lyrabox! Yay!
Disclaimer: This information and the circuits are provided as is without any express or implied warranties. While every effort has been taken to ensure the accuracy of the information contained in this text, the author assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.
Here’s how it works: The Lyrabox has a big red button. If you press it, an LED starts flashing and you can record whatever you want. Press again and the recording is played back immediately. Well, but you have to turn the hand crank in order to maintain it. Otherwise, it will slow down like an old cassette tape. Now, you can choose what effect you want to apply to the recording by switching a fancy little switch at the side of the Lyrabox. On the top, an infrared light proximity sensor lets you choose how much you want to distort, bitcrush, ringmodulate … well, to destroy the signal, just by approaching your left hand while cranking with your riht hand. Now comes the awesome part: As you crank, the recording is looped, and the effects applied to the recording stay. So you can destroy the recording over and over again, until your signal sounds like a puking alien monkey with rabies.
Let’s look inside. The heart of the Lyrabox is a RaspberryPi (Model B). That little guy is a fully-fledged Linux computer. You can get it for only 35 bucks and is actually pretty powerful, kind of like a netbook. The Pi has an interface called GPIO (General Purpose Input/Output), that you can use to connect any electric component that you like, in a 3.3v circuit. I attached the button, the LED, the switch, a rotary encoder (the hand crank!) and the infrared light sensor (that thing measures the reflection of infrared light by your hand). As the infrared sensor is analog and outputs not only 0 or 1, but a continuous value between them, I had to convert that with an Analog-to-Digital converter (ADC). The ADC has a range of 10 bit, i.e. 1096 discrete steps between off and on. There is also a little capacitor in that circuit that smoothes out the signal a little bit. For the Audio In/Out, I use an external USB Soundcard called “C-Media USB Headset” or so. Because it is only 7$ and it works.
The RaspberryPi executes a shell script on start up which then start a python script and the PureData program. The Python script reads the sensor values from the GPIO by using the Python GPIO library and the Gaugette Library for easy reading of the rotary encoder. The data is then perpared for the use with Libmapper (an awesome program that organizes and maps your OSC messages). Libmapper has an own GUI application, in which the Device LyraBox appears when the script is executed. You could now connect the sensor data to whatever Libmapper-compatible Synthesizer or write your own PureData patch to treat the data. But originally, a specific PureData patch with the Libmapper name LyraSound is connected automatically to the Lyrabox. That happens internally on the Pi, or externally, on the same network, on as many clients you want. How splendid! The PureData patch is responsible of recording audio and signal processing of the recording, as well as of treating the sensor input values that it receives through Libmapper.
Currently, I still experience problems with the quality odf the audio input signal to the RaspberryPi. Whil recording through the ALSA driver works very well, recording through PureData results in a very distorted signal (which is a pity, because I want to destroy it myself)!
This is the first time that I give something back to the community. I am very happy to be able to contribute after hvaing read about so many great open source projects. I recommend this DIY project only for people both experienced in handling the RaspberryPi and PureData (or to people with a lot of ambition and faliure tolerance) as the current version still often breaks the audio pipe of the ALSA driver (that’s a PureData problem).
Update: You could try the CCRMA Satellite Image with preinstalled Pd-Extended
First of all, make sure the RaspberryPi fits into the wooden box you bought, and think about the cable outlets of the box. You might want to attach the Pi directly to the box or but some antistatic foam underneath it. Drill holes into the sides of the box, big enough to serve as cable outlets for the power plug and the audio in and out (in my case, I just cut out a little piece so that the external soundcard outlets are aligned with the side of the box).
Now to something completely different. Grab your favourite soldering iron, some solder, wires and the Proto-Board and solder in everything except the sensors and switches according to this scheme:
As you can see, the MCP3008 Analog-to-Digital Converter is there to connect the analog proximity sensor to the Pi. The RaspberryPi has to communicate with four wires to the MCP3008 in order to get the sensor reading right. By default, these pins are 12 for SPICLK (clock), 16 for SPIMISO (master input, slave output), 18 for MOSI (master output, slave input), 22 for SPICS (chip select). The little capacitor in the circuit is not crucial, but helps smoothening the sensor’s input signal to get rid of spikes and noise. It acts just like a Low-Pass Filter. The other electonic components are easier to handle, as they already output a digital signal. That is, they output a series of high and low current, interpreted by the RaspberryPi as zeroes and ones. That is why you can connect the rotary encoder directly to the GPIO pins 7 and 9. The buttons and switches are connected using a so called voltage divider. Sounds fancy, but it is basically just a little special connection in order to prevent an input signal from floating. Learn more about it by looking at the Arduino Button tutorial in the Fritzing Software’s examples in the File menu.
Note: If you want to use another sensor than the proximity sensor, make sure it runs with 3.3 Volt, as the RaspberryPi is only capable of 3.3 Volt in the standard setup. Be careful with voltages, as 5 Volt can cause damage to the Pi’s processor.
After having soldered the base on the Proto-Board, you can now solder some wires to the pins of the button, LED, rotary encoder and switch. The proximity sensor should come with some wires attached to it already. Put some shrink-tubing around the pins and wires and heat ’em up to make sure that they won’t touch at any time.
Now, drill holes into the box where you want the button, switch, LED and rotary encoder to be. they usually have a standard size so you’ll find the right drill by holding it against the component. Drill the holes from the outside of the box, so the wood will be frayed at the inside. You can prevent that by glueing a piece of scotch tape on the inside where you drill, too. Now drill two holes for the screws that will attach the proximity sensot and another little hole for its wires. Now, place the components in the holes and the Proto-Board in the top of the box (upside down). Cut the wires to an adequate length and solder them into the right places in the Proto-Board (that step can be a little difficult!).
Your Lyrabox should now look something like this:
Now attach the ribbon cable to connect the Proto-Board and the RaspberryPi.
Be creative in painting the Lyrabox in neon colours with a zombie face and manufacture the most awesome little hand crank.
Before you can enjoy your own little Lyrabox, you’ll have to install a bunch of software onto your RaspberryPi. As you use the Adafruit Occidenatlis Image, the GPIO library is already installed. Also, you can easily configure your RaspberryPi to work with a Wi-Fi adapter by following this guide, or just use an ethernet cable.
Note: I assume that you are somewhat familiar to the command line on a RaspberryPi, although I explain everything step by step.
On Linux, open the Command Prompt Terminal. On Mac OSX, open the Terminal app (in the Utilities folder). On Windows, download and open PuTTY (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html). Type in
If you get a response like that
everything’s fine. But if it says
Something went wrong with the Bonjour Service that gives the RaspberryPi its name “raspberrypi.local” as a shortcut to whatever IP is was assigned.
To solve that problem, open your Router webpage and lookup the network devices that are connected. Do you see an IP-Address that is unfamiliar? That’s probably your RaspberryPi.
You can also try to list the network devices that your computer sees with
and try the IP-addresses listed there by typing something like
If you get back the 64 bytes from 192.168.XXX.XXX: icmp_seq=0 ttl=64 time=0.097 ms you are ready to SSH in. Type
or in the second case
and when prompted with the password, type in the default Password: raspberry Unix never shows you the password you type, not even stars. Your prompt will change to
and your are now working remotely on the RaspberryPi command line. Yay! Now change your password in the general configuration by typing
Attach your soundcard to a free USB slot on your RaspberryPi. Plug in some headphones or speakers and a microphone. We are using the ALSA audio driver. Everything that follows is to configure this driver correctly. In the command line, type in
Hit enter. A little control screen opens. You should see more than one little slider. Press F6. Now you should see the Name of your soundcard.
If it is not the upmost name, the soundcard is not the default card and you have to change that. Type
You should replace the file contents with this:
Press Ctrl+O, Return and then Ctrl+X to save and quit.
Restart the ALSA driver with
Verify any changes with alsamixer
Now, test the sound output with
The Pi sings! Well it SHOULD. However, the ALSA driver is still under development and the RaspberryPi is not a consumer computer, so if you get stuck here, you should read some forum posts and get into ALSA configuration. Fortunately, there are some nice guides out there if you google the right words.
Let’s try to record something. Type
The RaspberryPi now records a 10 second audio to the file “recording.wav” with DAT quality (48kHz sampling rate, 16 bit resolution). Test the file by typing
You can remove the file with
As the Occidentalis OS Image running on the RaspberryPi is a fully-fledged Linux distribution, the Advanced Packaging Tool is already preinstalled. With that piece of software, installing and removing programs works like a charm. First update the APT:
upgrades the APT to the newest version and
updates the software repository.
Now you can install the Git Core in order to get the software you need
I didn’t test this distribution, but supposedly it works. I build Pd-Extended from source. The installation took about 16 hours.
Note: In the current form, you don’t need Pd-Extended on the RaspberryPi, as the onboard sound synthesis doesn’t work yet. But if you’re trigger happy and want to tackle that problem, I would appreciate it!
Update: After I build the Lyrabox, I found the CCRMA Satellite RaspberryPi Image, which comes with a pre-installed Pd-Extended. I didn’t yet test it, but if it works, that would save you a lot of trouble!
Then, we clone the git repository.
Make sure you find the files in the py-gaugette folder cd ~/py-gaugette ls Now, run the setup script.
And clone the repository
We install it with the autogen.sh script
Let’s get the source files with wget
And unpack them
Note: Libmapper is still in development. If you encounter any difficulties with installing or using the software, please refer to http://libmapper.github.io
Unzip the downloaded file and put it into the PureData folder. Make sure the folder is added to the search path of PureData.
On your RaspberryPi, follow these steps:
Clone the repository
Move and overwrite the rc.local file (the startup script of the RaspberryPi)
You should also clone the repository to your personal computer with an installed copy of Pd-Extended, so that you can open the sound synthesis PureData patch on your computer.
The sound synthesis doesn’t work yet entirely on the Lyrabox. I still encounter an issue with the ALSA driver telling me that it’s pipe is broken. I think it is mainly due to the CPU intensity of the PureData patch. I would really appreciate if you wanted to look into that problem.
First move the other rc.local file to the /etc/ folder and overwrite
Now that should result in starting the RaspberryPi not only with the python script but also with the PureData script in headless mode like so:
This works just like above, only that now the PureData copy is running on the Pi, and Libmapper connects the script and the PureData patch on the Pi. There are several flags set:
These are followed by the path to the Pd patch that will be opened.
The first thing to do would be to get the adctest.pd to run on the RaspberryPi with a decent sound quality. In my tests, the sound was horribly distorted when using the adc-object in PureData. However, getting the ADC to work is a crucial step to have the Lyrabox be stand-alone.