Record sound output to file while playing (debian)
Something playin in a radio stream or a browser - and want to save it to a file, as you hear the mix on the monitors? Let us try to achiev that
Pulseaudio
This answer is for ubuntu, but the commands seem to work on debian 8: http://askubuntu.com/a/724964.
- Find the wanted output (monitor):
$ pacmd list-sinks | grep -A1 "index"
- Set value in a variable (here hdmi):
$ AU_DEFAULT_OUTPUT="alsa_output.pci-0000_00_1b.0.hdmi-stereo-extra1"
- It is currently index number 1:
$ AU_INDEX=1
- Create a combined sink (streams?)
$ pactl load-module module-combine-sink sink_name=record-n-play slaves=$AU_DEFAULT_OUTPUT sink_properties=device.description="Record-and-Play"
- Open PulseAudio mixer and re-check "Playback"
$ pavucontrol
- Re-check the index-number for the wanted output monitor, re-set AU_INDEX if it has changed. (the first step)
$ pactl move-sink-input $AU_INDEX record-n-play
- Finally record stream as best quality VariableBitrate mp3 (make sure lame is installed):
$ parec --format=s16le -d record-n-play.monitor | lame -r --quiet -q 1 --lowpass 16 -V 0 - "stream-temp.mp3"
- Re-check the mixer "Recording" -tab, make sure that theres sound level moving = sound going to the recorder (if not toggle the source pulldown)