On 14 Sep 2010, at 03:10, Sam Varshavchik wrote:

> I would like to capture raw audio, chew on it with my own code, then save the 
> result into some common format, such as wav or mp3. I'm trying to understand 
> the description of sample formats given in the arecord man page:
> 
>      -f --format=FORMAT
>             Sample format
>             Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE U16_BE
> 
> So, if I understand the man page correctly, then if I run "arecord -t raw -c 
> 1 -f U16_LE -r 8000", then the resulting file will have, basically, raw 16 
> bit samples, mono, 8000 samples per second, is this correct?
> 

I believe so.   However, you're probably better off sticking with WAV format 
files.   The only difference between a wav file and a raw file with the same 
recording parameters is a 44 byte header.   It is possibly to produce wav files 
that are more complicated, and I'm sure they exist, but I've never seen one.

If you can't find that spec for the 44 byte header, let me know (off list) and 
I'll send you the sample program I wrote a while back.

The main reason that there's an advantage is that in order to insert the 44 
byte header, you have to copy the entire audio file.   If it's short that's not 
an issue, but if it's long ....  The second reason is that you don't have to 
remember that you changed the recording parameters, they're recorded in the 
header.

jch


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user

Reply via email to