{"id":7731,"date":"2012-11-20T21:50:00","date_gmt":"2012-11-21T02:50:00","guid":{"rendered":"http:\/\/scruss.com\/blog\/?p=7731"},"modified":"2012-11-20T21:50:00","modified_gmt":"2012-11-21T02:50:00","slug":"raspberry-pi-as-a-usb-audio-capture-device","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2012\/11\/20\/raspberry-pi-as-a-usb-audio-capture-device\/","title":{"rendered":"Raspberry Pi as a USB audio capture device"},"content":{"rendered":"<p>The Raspberry Pi&#8217;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&#8217;m pleased to say it works flawlessly.<\/p>\n<p>Earlier this year, I <a href=\"https:\/\/scruss.com\/blog\/2012\/06\/27\/go-scratch-a-rock-on-some-congealed-oil-and-tell-me-what-it-sounds-like\/\">bought a turntable<\/a> (ack!) for transferring vinyl to mp3. I have a <a href=\"http:\/\/www.phonopreamps.com\/TC-772pp.html\">TC-772<\/a> 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&#8217;s instantly recognized as an audio device:<\/p>\n<pre>$ lsusb\r\nBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\r\nBus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. \r\nBus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. \r\n<strong>Bus 001 Device 004: ID 08bb:2902 Texas Instruments Japan PCM2902 Audio Codec<\/strong><\/pre>\n<p>If you install the ALSA recording utilities (<code>sudo apt-get install alsa-utils\u00c2\u00a0pulseaudio<\/code> &#8211; this should pull in a whole bunch of necessary packages), you can record directly from this device with the following command:<\/p>\n<pre>arecord -D 'pulse' -V stereo -c 2 -f dat -d 900 out.wav<\/pre>\n<p>which records from the &#8216;pulse&#8217; audio device, displaying a stereo text VU meter (handy for setting levels), writing to a two channel 16-bit 48 kHz file called &#8216;out.wav&#8217; for a maximum of 900 seconds (15 minutes). arecord has a baffling number of recording source options; <code>arecord -L<\/code> will show them. &#8216;pulse&#8217; was the first one I tried.<\/p>\n<p>So how does it sound? Here&#8217;s a 30 second excerpt from the only single I owned for years, <a href=\"http:\/\/www.orbitinghumancircus.com\/\">The Music Tapes<\/a>&#8216; &#8220;The Television Tells Us\/Freeing Song by Reindeer&#8221;: <a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2012\/11\/FreeingSongbyReindeer-excerpt.mp3\">Freeing Song by Reindeer &#8211; excerpt<\/a> [mp3]. I&#8217;ve saved an even smaller snippet as lossless FLAC so you can see that the waveform&#8217;s pretty clean: <a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2012\/11\/FreeingSongbyReindeer-tiny_excerpt.flac\">FreeingSongbyReindeer-tiny_excerpt<\/a> [flac].<\/p>\n<p>Sounds pretty good. Not quite as good as <a href=\"https:\/\/scruss.com\/blog\/2008\/12\/02\/music-tapes-caroling-at-our-house\/\">having Julian play it in your house<\/a>, I&#8217;ll allow, but not bad for a first try with a $35 computer.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Raspberry Pi&#8217;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&#8217;m pleased to say it works flawlessly. Earlier this year, I [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[12,7],"tags":[1104,46,1440,2510,2536,229,2522],"class_list":["post-7731","post","type-post","status-publish","format-standard","hentry","category-audblog","category-computers-suck","tag-audio","tag-flac","tag-music-tapes","tag-raspberrypi","tag-raspbian","tag-usb","tag-vinyl"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-20H","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/7731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/comments?post=7731"}],"version-history":[{"count":8,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/7731\/revisions"}],"predecessor-version":[{"id":8074,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/7731\/revisions\/8074"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=7731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=7731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=7731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}