Image from learn.adafruit.com

Running Chuck on RPi

pancy
pancy
Apr 25, 2015 · 2 min read

Here is what I did to get Chuck to run on the Raspberry Pi

A Raspberry Pi 2 is a powerful mini Linux computer that leverages and encourage home-grown hacking experiments. For my current project, I’m revisiting Chuck, a strongly-timed music programming language I have used before to loop and mix audios. This time round, I’ll be running it within the RAM-tight environment of the Pi.

Either you are controlling the Pi directly via a connected monitor, ssh’ing or VNC’ing from another computer, you will have to open up the terminal (called LX terminal on the Raspbian) and download a few things.

Requirements:
- alsa-lib-1.0.25.tar.bz2: http://www.alsa-project.org/main/index.php/Main_Page
- jackd: http://jackaudio.org/downloads/
- libsndfile-1.0.25.tar.gz: http://www.mega-nerd.com/libsndfile/
- chuck-1.3.1.3.tgz: http://chuck.cs.princeton.edu/

Installing:
Download alsa-lib with

$ wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.29.tar.bz2

Decompress it and build the source

$ tar -xjf alsa-lib-1.0.29.tar.bz2
$ cd alsa-lib-1.0.29
$ sudo ./configure
$ sudo make
$ sudo make install

Do the same with libsnd

$ wget http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.25.tar.gz
$ tar -xvzf libsndfile-1.0.25
...

For Jackd, you can use apt-get to install. Make sure you use jackd2. It’s preferrable and jackd caused a pain for me on my latest Pi upgrade.

$ sudo apt-get install jackd2

Now, if you look at the Chuck download page, you’ll see some dependencies you need in place before compiling Chuck

It is very likely you already have gcc, make and yacc installed. If not, try using apt-get to install all. The above mentioned all contribute to a successful installation. I had a problem with Chuck complaining it lacks bison, so I installed that and everything worked. If lex isn’t found, try installing flex with apt-get.

Now just download and build Chuck from source just like you did with other dependencies

$ wget http://chuck.cs.princeton.edu/release/files/chuck-1.3.5.1.tgz
...

Now, get on the Pi and start the Jack server using Qjackctl (GUI controller for Jack Audio Kit) or run it on the command line with

$ jackd -d alsa

As the server is running, open another tab and go to Chuck’s examples directory and play some drum sample:

$ cd /usr/share/doc/chuck/examples && chuck otf_1.ck

Oh, and plug a speaker or headphone into RPi’s audio jack too. That’s the crucial part. ☺

Introductions, tutorials, recipes and notes for dummies who…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store