Via ALSA emulation
I don't have a Debian 6.0.x box to test on, but I think this way will probably work. Courtesy an example on the Arch wiki.
First, use pacmd list-sources
to find the name of your sound card's monitor stream. Grep for .monitor
works pretty well:
$ pacmd list-sources | grep '\.monitor'
name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor>
name: <alsa_output.usb-stereo-link_stereo-link_1200_USB_DAC-00-DAC.analog-stereo.monitor>
I have two cards, hence two monitors. Then edit your ~/.asoundrc
to set up an ALSA device for it, by adding lines like (but of course use your monitor device name, not mine):
pcm.pulse_monitor {
type pulse
device alsa_output.usb-stereo-link_stereo-link_1200_USB_DAC-00-DAC.analog-stereo.monitor
}
ctl.pulse_monitor {
type pulse
device alsa_output.usb-stereo-link_stereo-link_1200_USB_DAC-00-DAC.analog-stereo.monitor
}
Then use arecord -f s16_le -t wav -r 44100 -D pulse_monitor /tmp/outfile.wav
to record.
Older PulseAudio Utilities
Instead of using ALSA emulation, you can use parecord
on the monitor you found above. Do so like this: parecord -d alsa_output.usb-stereo-link_stereo-link_1200_USB_DAC-00-DAC.analog-stereo.monitor outfile.wav
. That should work with parec
as well (in the LAME example below)
Newer PulseAudio Utilities
PulseAudio ships with a parecord
command-line utility that can record sound going through it.
To use it, first find the index of the stream you want to capture. Easy way from the command line is pacmd list-sink-inputs
, which should give something like this:
1 sink input(s) available.
index: 10720
driver: <protocol-native.c>
⋮
client: 87 <Chromium>
⋮
I've omitted a bunch of lines; but you can see that's Chromium (where I have a music player running). The index: 10720
bit is important.
To record it, it's as simple as parecord --monitor-stream 10720 outfile.wav
. You can also write the output to stdout and use it as part of a pipe with parec
; for example if you're short on disk space you could directly encode to MP3:
parec --monitor-stream 10720 --format s16le --channels 2 --rate 44100 \
| lame -r -s 44.1 -b 16 --signed --little-endian --preset medium /dev/stdin outfile.mp3
You should be able to monitor your microphone with PulseAudio's loopback module. Module should automatically create loopback outputs for available input devices. To load the module manually
pactl load-module module-loopback
To make the change persistent, append /etc/pulse/default.pa
with
load-module module-loopback
Best Answer
I managed to get it going with the steps on the Ubuntu Forums, for clarity here is what I did:
sudo apt-get install gtk-recordmydesktop pavucontrol
Applications > Sound & Video > PulseAudio Volume Control
pulse
This is what seems to have worked for me.