Linux arecord: capture sound card output rather than microphone input

alsaaudioaudio recordinglinux

I am trying to capture sound card output and encode it in Vorbis ogg format using the following command:

arecord -f cd -t raw | oggenc - -r -o file.ogg

However, the computer's microphone input is recorded rather than the sound card output.

The output of the command arecord -l is

**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: CONEXANT Analog [CONEXANT Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

The output of the command arecord -L is contained in this pastebin entry.

The arecord man page indicates that the input device can be selected using the -D flag, but gives no syntactical examples.

I would like to know how to change the input for arecord from the microphone to the sound card. I am not interested in GUI-based alternatives such as Audacity. Thanks.

Edit: I am running Debian 7.0 (stable) with arecord version 1.0.25, vorbis-tools version 1.4.0, and ALSA driver version 1.0.24.

Best Answer

years later the struggle continues... how to specify the recording device, lo and behold:

➜  ~ arecord -l                                                              
**** List of CAPTURE Hardware Devices ****                                   
card 0: PCH [HDA Intel PCH], device 0: CX20590 Analog [CX20590 Analog]       
  Subdevices: 1/1                                                            
  Subdevice #0: subdevice #0                                                 
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]       
  Subdevices: 1/1                                                            
  Subdevice #0: subdevice #0     

➜  ~ arecord -f S16_LE -r 44100 --device="hw:1,0" plik.wav                   
Recording WAVE 'plik.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono 
^C
Aborted by signal Interrupt...  

So the format for device string is hw:<card>,<device>

format of device id

Related Question