Wednesday, 3 August 2011

How to capture audio under Linux?

I needed to capture audio from a video running in a flash player. Here's what I did:
Created .asoundrc in my home directory:
pcm.fileout {
   type empty
   slave.pcm "tee:default,'/tmp/out.raw',raw"
   # 48000 S16_LE 2ch (aplay -t raw -f dat)
}
Started firefox from the command line:
FLASH_ALSA_DEVICE=fileout firefox
Converted the raw file it to a wav file:
sox -r 48k -s -b 16 -c 2 out.raw out.wav
...assuming that it's 48kHz sampling rate, 16bits and two channels stereo.

1 comment:

  1. Wow! I'm impressed! How did you come to conclude that's what you needed to do? I was trying to use Audacity, and it failed, even when I tried the analog hole. Great work!

    ReplyDelete