Raspberry Pi as a USB audio capture device

The Raspberry Pi’s hardware and software support has come a long way in the few months it has been in the wild. I first tried this application in the summer, and the results were dismal. Now, thanks much improved USB driver support under Raspbian, I’m pleased to say it works flawlessly.

Earlier this year, I bought a turntable (ack!) for transferring vinyl to mp3. I have a TC-772 USB phono preamp, which spits out a 48 kHz stereo audio stream. If you plug the USB output of the preamp into a Rapberry Pi (running Raspbian Wheezy with all the updates), it’s instantly recognized as an audio device:

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 08bb:2902 Texas Instruments Japan PCM2902 Audio Codec

If you install the ALSA recording utilities (sudo apt-get install alsa-utils pulseaudio – this should pull in a whole bunch of necessary packages), you can record directly from this device with the following command:

arecord -D 'pulse' -V stereo -c 2 -f dat -d 900 out.wav

which records from the ‘pulse’ audio device, displaying a stereo text VU meter (handy for setting levels), writing to a two channel 16-bit 48 kHz file called ‘out.wav’ for a maximum of 900 seconds (15 minutes). arecord has a baffling number of recording source options; arecord -L will show them. ‘pulse’ was the first one I tried.

So how does it sound? Here’s a 30 second excerpt from the only single I owned for years, The Music Tapes‘ “The Television Tells Us/Freeing Song by Reindeer”: Freeing Song by Reindeer – excerpt [mp3]. I’ve saved an even smaller snippet as lossless FLAC so you can see that the waveform’s pretty clean: FreeingSongbyReindeer-tiny_excerpt [flac].

Sounds pretty good. Not quite as good as having Julian play it in your house, I’ll allow, but not bad for a first try with a $35 computer.

Music Tapes Caroling … at our house!

Julian Koster played at our house last night as part of his Music Tapes Caroling tour. We had one other guest, Dan Farrar from Dunnville. It was a great night. Julian played some Music Tapes classics (he played Freeing Song by Reindeer, my favourite ‘Tapes song so far), while Badger Saw played some carols. A fun night.

Julian plays Freeing Saw by Reindeer, while Badger Saw and Rudolph the dog look on
Julian plays Freeing Saw by Reindeer, while Badger Saw and Rudolph the dog look on
Badger Saw sings to us, while Julian supports
Badger Saw sings to us, while Julian supports
My banjo now has Julian Koster power
My banjo now has Julian Koster power

Recording is here: Julian Koster – Music Tapes Caroling, our house – 1 Dec 2008:

  1. Introducing Badger Saw
  2. O Tannenbaum
  3. Introduction to a song flown by a little blind girl
  4. Hark! The Herald Angels Sing
  5. Introducing the Emergency Banjo
  6. Takeshi & Elisha
  7. Introduction to Freeing Song by Reindeer
  8. Freeing Song by Reindeer
  9. well suited to a throat …
  10. Introduction to The Silly Old Man
  11. The Silly Old Man said “My Hat is a Cow!”
  12. Introduction to The First Noël
  13. The First Noël