The Intel Galileo is a great little development/experiments board with an Intel Quark 32-bit x86 processor. We had some of these hanging around our office and I was inspired to make some computer music with it - so here's my process for getting Pure Data up and running.
Here's the things I needed:
- Intel Galileo Gen 2
- MicroSD card
- $2 Ebay usb audio interface (1 in, 2 out)
- Sparkfun FTDI basic adapter
And some important online resources:
Unlike the Raspberry Pi and kin, the Galileo doesn't have a video output or anything. You can load up a program on it using the Arduino IDE but I wanted to get a terminal up and running as soon as possible. The Galileo Gen 2 runs a terminal over serial using an 6-pin FTDI header near the ethernet port. Luckily I had a Sparkfun FTDI Basic Breakout hanging around. This plugs in with the header facing the ethernet port and the IC facing out.
I had a super cheap USB audio interface from a previous project that I plugged into the USB host port and also connected the ethernet port up to my network to pull down some stuff.
At this point, I connected to the board to make sure it worked, I think the "screen" command is the best serial terminal on OS X so I opened a terminal and ran:
screen /dev/tty.usbserial-A40081Q0 115200
You can run
ls /dev/tty.*
to figure out the name of your serial to USB connection.
After running screen, you can power up the board and watch the boot sequence over the serial connection!
The board has a tiny Linux installed in ROM (<8MB!) but to use audio you need a distribution on the SD card. Download this from Intel's Downloads page, I used SDCard.1.0.4.tar.bz2
which is 48MB. You just have to unzip this file onto a microSD card, plug it into the board, and it will (should) boot straight off it.
One you've booted to the big Linux image, you can log in with the user name "root". You should then be able to try out the soundcard with the ALSA test tools which are already installed. When I plugged my USB sound adapter in, it wasn't recognised immediately and I had to load the correct driver module like so:
modprobe snd-usb-audio
I like to list the sound devices to make sure it's working, a helpful command is: aplay -l
which, for me, returns:
root@clanton:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
You can test the sound output using the speaker-test
command. Or to be fancy:
speaker-test -c2 -t wav
Woo! Sound works!
The bigger Yocto Linux distro is still missing a few packages like, oh say, a C-compliler and a text editor. A helpful community member has a package repository for the distro, there's lot of information on AlexT's site about setting this up. There's also a post about installing development tools.
The short story is, add the repositories to the correct conf file:
echo "src/gz all http://repo.opkg.net/galileo/repo/all
src/gz clanton http://repo.opkg.net/galileo/repo/clanton
src/gz i586 http://repo.opkg.net/galileo/repo/i586" >> /etc/opkg/base-feeds.conf
(Make sure there are line breaks in the right spots for that command.)
Update the packages and install the build environment:
opkg update
opkg install --force-overwrite uclibc
opkg install packagegroup-core-buildessential
opkg install nano
opkg install git
Grab the Pd source:
git clone git://git.code.sf.net/p/pure-data/pure-data
And then follow the instructions from INSTALL.txt
, you need to force ALSA sound to be enabled:
./autogen.sh
./configure --enable-alsa
make
make-install
Getting patches on to the Galileo is can be done with scp
over a network. You can also copy and paste the patch text into a file over the serial connection. On my main system, I run cat composition.pd
to print the pd file onto the command line, I select all the pd commands then in the serial terminal I run echo "copy all the pd text here" >> composition.pd
where you paste all the Pd commands in between the quotation marks. Obviously this is super great for small Pd files and impractical for big ones where you should probably use scp
.
Having said that, here's some a hello world sine tone to try:
#N canvas 602 140 450 300 10;
#X obj 148 148 dac~;
#X obj 142 77 osc~ 440;
#X obj 150 111 *~ 0.5;
#X obj 267 77 loadbang;
#X msg 276 144 \; pd dsp 1;
#X obj 254 202 print;
#X msg 254 178 turned dsp on.;
#X obj 270 106 delay 2000;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X connect 2 0 0 1;
#X connect 3 0 7 0;
#X connect 6 0 5 0;
#X connect 7 0 4 0;
#X connect 7 0 6 0;
I echo
'd this into sine.pd
and then run it on the Galileo with:
pd -nogui -blocksize 1024 sine.pd
The sweet sound of success!