Using a USB Audio Interface with Rasberry Pi and PureData

Setting up a USB Audio Interface with the pi and using alsamixer to record/play audio from command line.

Some USB interfaces are compatible with the pi. In my case I am using an Audiobox USB.

Using alsamixer will allow you to select your sound card instead of the default hdmi.
to record a file called “rectest” into the current directory…​arecord -D plughw:0 –duration=10 -f cd -vv ~/rectest.wav​

to play it back (using the soundcards output)…
aplay -D plughw:0 ~/rectest.wav

​The 0 after plughw: refers to my interface. It was listed as 0 as you can see here…

alsa

Installing and Configuring PureData with the pi.

Whether sharing internet from ethernet or just plugging right in to your router, install PureData. Note: This will only install PD-Vanilla. To use the Arduino controller we will have to install other packages. This will be discussed later…

sudo apt-get install puredata

vnc

You can see in the image above that I am VNCed into my pi and accessing PureData through the gui. Once PD is done installing it will be listed under the sound and video menu on the pi.

Navigate to preferences in PD and make sure your usb interface is selected as audio input/output.

pd_audio_settings

2. Running PD “headless” on the pi

In order to get patches running on the pi with no need for monitor/keyboard/mouse there are two things that must be accomplished. The first thing is that you need to create a script that tells the pi to open the Pd patch on start up and the second is handled in the Pd patch itself.

Cron jobs are perfect for having Pd patches run at startup.

Once that is complete, you need to add the following string into PD.

This will delay the patch from loading immediately which is required in order for it to run properly on startup.

One other tip…

this is what the post that helped me looked like…

[loadbang]
|
[delay 100]
|
[; pd dsp 1(

Advertisements

One thought on “Using a USB Audio Interface with Rasberry Pi and PureData

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s