Everyone is welcome here (except, of course, those who have borrowed books from me for and have not returned them yet 😉)

How to record computer's playback under Linux

Posted on septembre 29, 2020 in computer-science

Let us suppose that you want to record the audio playback of your computer without any external recording system.

A poor man's solution would be to plug a microphone in the audio input jack and record from it, say with the sound editor Audacity. Beside the bad quality of the sound recording, a drawback of this approach is that it is going to pick up any noise in the room, unless you have two separate input (mic) and output (headpĥone) jacks on your computer, in which case you can use male-male jack cable to connect both.

Here is a better solution, using the Audacity and PulseAudio Volume Control:

  1. Launch both audacity and pavucontrol.
  2. In Audacity.

  3. Open the menu Edit/Preferences:

    • In the Devices Tab,
      • select 'ALSA' in Interface/Host.
      • select 'pulse' in Playback/Device.
    • In the Recording tab, make sure that Software playthrough of input is not selected.
    • Close the Preferences window and start recording (Shift+R)
  4. In PulseAudio Volume Control:

  5. In the Configuration tab, under Built-in audio, select `Analog Stereo Duplex``

  6. In the Recording Tab, showing 'all streams', you should see the Audacity stream (Audacity must be in recording mode!), and Audacity should be recording the audio playback of the computer.

Remark: In Ubuntu 20.04, I am using versions 2.3.3 of audacity and version 4.0 of pavucontrol.

Recommended reading: How to use Pulse to manage sound on Linux

Other possible approaches

pactl load-module module-null-sink sink_name=MySink PULSE_SINK=MySink parec -v -d MySink.monitor --file-format=wav recording.wav

https://unix.stackexchange.com/questions/127567/recording-audio-from-web-based-audio-player-using-alsa-loop-device