Recording computer playback
From the Audacity manual:
- If not already installed, add PulseAudio Volume Control (pavucontrol) to your system. This is usually available in the distribution's repository.
- Ensure that PulseAudio is running. In Audacity's Device Toolbar, set the Host to ALSA and the recording device to pulse. On systems where PulseAudio is the default sound system the recording device may be set to default. Audacity's playback device may be set to pulse or to any available audio interface.
- Ensure that "Software Playthrough" is not enabled in the Transport Menu then left-click on the Recording Meter to turn monitoring on.
- Open PulseAudio Volume Control and choose the "Recording" tab.
- In the "Capture from" dropdown, select the "Monitor" option of the playback device used by the application you want to record from, as shown.
- Launch the application that you wish to record and begin playback.
- In the "Recording" tab of PulseAudio Volume Control, drag the volume sliders so that the recording level in Audacity's Recording Meter is to left of 0 dB (-6 dB is a good level to aim for). The playback level of the application being recorded will also affect the level of the recording. Use the "Playback" tab in PulseAudio Volume Control or the volume control in the application to adjust the output level. If you want to record without hearing the audio, you can turn down the Audacity playback slider or turn down the sliders on the Output Devices tab of PulseAudio Volume Control. Don't use the Mute button in PulseAudio Volume Control, because this will cause Audacity to record silence. You can also set the port on the Output Devices tab of PulseAudio volume control to the audio output such as "headphones" but not connect any headphones or speakers to the port.
- When the recording level has been correctly adjusted, press the Record button in Audacity .
Check out the instructions in the Audacity manual.
In short, it seems that Audacity gives access to a feature of windows called "WASAPI" that's useful in this case.
In Audacity, choose the “Windows WASAPI” audio host, and then choose an appropriate loopback device, such as “Speakers (loopback)” or “Headphones (loopback).” source
See this discussion on the Audacity wiki.