Record system output sound on Linux with Pacat (Pulseaudio)
When PulseAudio was used as the sound server of the system, there was a simple-a-to-record the output sound to file on the Command line using the Pacat-command. This short article describes how to do it.
In order toFindThe correct device should run this command:pacmd list|grep ". Monitor"When you see something Like:alsa_output.pci-0000_06_05.0. analog-stereo.monitor/#1: Monitor of CA0106 SoundBlaster Analog Stereoand The soundcard corresponds to the one you want to Monitor and you know /c1>whichDevice name to use. Here it is:alsa_output.pci-0000_06_05.0. analog-stereo.monitorafterwards Pacat is used to read the signal and Sox are used to change the output format. See theMansPage of Sox forParameters to choose forCorrect output format. The default output from Pacat are raw audio, rate44100, Signed-integer, Little-endian, --bit and stereo. The Sox reads from standard input by specifying"-"as filename. The format of the outputfileis therefore specified after the"-" inchThe examples under. Here's an example byWriteto afloatFormatted RAW AudiofileWith mono sound at a rate of 40000sps:pacat--record-d alsa_output.pci-0000_06_05.0. analog-stereo.monitor | Sox-t Raw-r44100-s-l-B --C2-T-raw-r40000-f-b +-C1Output.rawthis One is Nice ifYou'll record sounds forUsinginchGnuradio. To record to a wav-fileWith a rate of 44100sps, simply DoLike This:pacat--record-d alsa_output.pci-0000_06_05.0. analog-stereo.monitor | Sox-t Raw-r44100-s-l-B --C2-"Output.wav"
Record system output sound on Linux with Pacat (Pulseaudio)