LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-16-2009, 07:14 AM   #1
donnied
Member
 
Registered: Oct 2006
Distribution: Debian x64
Posts: 198

Rep: Reputation: 30
how to playback/convert raw sound with sox captured with alsa 'write file'


I've been changing the command line options with sox to convert captured raw sound to wav. Sox is great; i'm trying to learn the basics.

I capture the sound using an altered .asoundrc
Code:
pcm.V8237 { type hw; card V8237; }
ctl.V8237 { type hw; card V8237; }
pcm.!default pcm.V8237
ctl.!default ctl.V8237
pcm.!default {
     type plug
     slave {
         pcm rate48000Hz # Direct default output to the below converter
     }
 }
 pcm.rate48000Hz {
     type rate
     slave {
         pcm writeFile # Direct to the plugin which will write to a file
         format S16_LE
     #    channels 2
         rate 48000
     }
     #route_policy copy
 }
 pcm.writeFile {
     type file
     slave {
         pcm card0 # Now write to the actual sound card
     }
     file "aplay-D_card0-t_raw-f_S16_LE-r48000-c_2.raw"
 }
 pcm.card0 {
     type hw
     card 0
 }
 ctl.card0 {
     type hw
     card 0
 }
To convert:
Code:
sox -r 48k -s -b 16 -c 2 aplay-D_card0-t_raw-f_S16_LE-r48000-c_2.raw foo.wav
The r is the rate, -s is signed integer, -b is 16 bit, and -c 2 is for two channels.

I got the .asoundrc mostly from http://www.swview.org/node/213
Also helpful were the Alsa wiki pages: http://www.alsa-project.org/alsa-doc...m_plugins_file

including a script to generate a .asoundrc file:
http://alsa.opensrc.org/index.php/.a....asoundrc_file

A question----
Doesn't alsa (.asoundrc) support wav format? When I tried entering 'format wav' in the asoundrc, I received an error message.

A comment--
This is a rather round about way of doing things. The new audio is recorded in the current working directory most often ~ and the new data is neither appended to nor does it replace the old data; it becomes a sort of conglomeration. To record effectively it would be necessary to have a script to enable (put in place) and disable (remove) the .asoundrc file.

Last edited by donnied; 04-18-2009 at 10:18 PM.
 
  


Reply

Tags
alsa, asoundrc, sox


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
playback .raw audio file? android6011 Linux - General 1 12-06-2007 12:48 AM
sox/lame playback problem(thumping sound) ncsuapex Linux - General 2 08-13-2007 09:54 AM
ALSA Won't Recognize Sound Device (Even though I Get Playback) kpworrell Slackware 8 07-08-2006 05:01 AM
Latency in sound playback using ALSA OSS emulation - tuneable? vasudevadas Linux - Hardware 2 10-13-2005 12:53 PM
kino - slow playback of captured video... nicsmr Linux - Software 5 08-23-2005 02:01 PM


All times are GMT -5. The time now is 07:06 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration