SI02 Experiment 2 – Nukulele

Rather than using RaspberryPi and Pd (PureData) as the sound generator in this experiment I wanted to use another sound source, something that resonates acoustically that I could alter the sound of but retain the playability of the original instrument. Why not a ukulele?

Hacking a ukulele:
cutting hole for the RaspberryPi to be accessible from the front of the instrument, notic the cheap Pizzo microphone taped next to bridge of ukulele to pick up sound and bring it into Pi.

Running Headless

I know what you’re thinking, you probably have a mental picture of a chicken running around without a head, but in Pi parlance, running headless is about running your Raspberry Pi without a monitor (screen) or keyboard.

One of the reasons I like working with a RaspberryPi over an Arduino is that, unlike the Arduino the RaspberryPi is a standalone computer with an operating system, network capabilities and video output built-in. It can be a desktop computer or embedded within another object or installation. Lots of possibilities open up.

To run a RaspberryPi headless there are a lot of tutorials out there, you can start with mine. Unlike most “how to run headless” tutorials I had to figure out how to launch a script that starts two files to run automatically when the Pi is booting up. Let’s have a look at those files:

Python script

Like experiment SI01 we start by grabbing data from somewhere else to bring into Pd. In this case it’s data from the Lots Of Pots board made by Modern Device, a RaspberryPi expansion board with 8 Pots (potentiometers), thus the name, and Analog/Digital converters to send the data from the pots to the Pi. The python script grabs the data from the pots and 4 buttons and sends it to Pd via UDP communications.

You can look at the script here.

Altering the ukulele sound using Pd

There are a lot of different things we can do to the sound coming into Pd, pretty much any digital sound processing you can think of, like distortion, delays or echos, chorusing and any of those typical guitar pedal effects but I should to create a Ring Modulator effect which makes the ukulele sound more like a sequenced synthesizer.

Quick Tangent about Ring Modulation

Ring Modulation began being used in music as early as 1956 by people like Stockhausen and later by John McLaughlin in the Mahavishnu Orchestra and Miles Davis in the 1970s. You might know that sound from Black Sabbath’s Paranoid or perhaps the heavily modulated voice of the Daleks on Doctor Who in 1960’s. More info about it here:

Dalek from Doctor Who

Tricky Startup Business

The trickiest part of this experiment was getting the files to launch automatically. There seems to be a bit of voodoo here. I think it’s mostly because the files need to have specific permissions by the root user and be in the right location.

Here’s how it works, first you need to edit the rc.local file, which you’ll need root permission to do (SUDO). Add the following line as in this file:

sleep 10 && /etc/profile.d/

Then the file needs to launch the python and Pd files, like so:

sudo -H -u pi bash -c bash "echo 'starting Pd now'"
pd -nogui /path/to/folder/pd_file.pd &

/path/to/folder/ &

then make sure the permissions of this file are set to:
ownership is root:root (chown root:root)
permissions should be executable by owner (chmod 755)

Yes, it’s unavoidable, annoying but necessary for you to learn this stuff. Luckily I had to learn it when I began making websites but it’s a handy thing to know when you begin to get under-the-hood of any computer. If you need to know more about File Permissions and Ownership try this article.

Add a Comment

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.