Talk:Tutorial - Recording Computer Playback on Linux

Steve 16Sept11: Most (by popularity) Linux desktop systems use PulseAudio as the default sound system. In the past PulseAudio has been buggy on many systems, but is very much improved these days, so I propose that the first method in the Recording Computer Playback on Linux tutorial should be to use PulseAudio.

In cases where PulseAudio is the default sound system, I don't think it is necessary to go into a description of what PulseAudio is (you don't need to explain the engine management system within instructions for how to drive a car). So here's a proposal of some revised text (taken from this post on the forum):

PulseAudio
If the Device toolbar lists pulse then you can record computer playback using PulseAudio.

You will need the Pulse Audio Volume Control application (pavucontrol), so if not already installed, install it now. If available, it may also be useful to install the PulseAudio Device Chooser (padevchooser) for easy access to the Pulse Audio Volume Control.

Audacity will now record whatever is playing through the soundcard.
 * Open Audacity and select pulse as the recording device.
 * Click on the Recording meter to activate it, then open Pulse Audio Volume Control. Audacity should be listed in the Recording tab of pavucontrol.
 * Set Audacity (in pavucontrol) to record from the "Monitor" of your soundcard. The available options are typically Internal Audio Analog stereo and Monitor Internal Internal Audio Analog Stereo, in which case you would select the latter.

For a more detailed description, see Stereo Mix with Ubuntu 10 on the Audacity wiki.

Some thoughts added by Bruno (transferred from the Audacity forum)

Bruno 15Dec 2011: 1. Using a loopback cable is shown as the first option on top of the page. I hope this doesn't give the idea that this is the preferable solution. I think this should be a last resource solution when everything else fails and I'd put it at the end.
 * steve 16Dec 2011: Agreed. I've moved that section down to the bottom.

2. The Alsamixer section looks a bit too long and specially the first 3 or 4 paragraphs sound a bit confusing and contain some unnecessary information.
 * steve 16Dec 2011: I've moved the PulseAudio and Jack paragraphs to the top (as these are probably the more common scenarios on modern Linux distributions). The ALSA section could possibly be edited down to little more that "Select the Mix option in AlsaMixer (if available)". Is Mix commonly available? It has not been present on any of my Linux set-ups for the last couple of years.

3. ALSA PCM file: to make it more newbie proof, it should be more clear that setting the variable FLASH_ALSA_DEVICE=teeraw on the command-line won't affect already running instances of the web browser, neither will affect freshly started ones unless they're started from the command-line. The example given "FLASH_ALSA_DEVICE=teeraw firefox" will start firefox from the command-line if and only if there's a binary or link/script named firefox in the path. In some distros this might not be true and if the user uses a different browser this doesn't apply either.

4. ALSA PCM file: either I missed or it's not said on the text that the "recorded" sound will go to a file in the /tmp folder and that (in the first example) it is saved as "raw PCM".
 * steve 16Dec 2011: I'm not really familiar with the above two methods (3 and 4). Could someone else have a look at those sections?

5. PulseAudio: it's the default on Ubuntu, but I'm [not]so sure about Debian, though I haven't made a fresh install of the latest release so it might have changed... I also don't like the second phrase where it says PulseAudio works like a plug-in for ALSA.
 * steve 16Dec 2011: The default for Debian Squeeze (stable) is ALSA. I'll correct that.

6. PulseAudio: pulse loopback module should be mentioned here.
 * steve 16Dec 2011: The loopback module is not required for recording computer playback.

7. OSS: not sure if anyone is going to write this section... Mostly everyone is using ALSA on Linux nowadays and OSS support on Audacity (AFAIK) is very limited. Is it worth writing such a section?
 * steve 16Dec 2011: Some enthusiasts are zealous proponents of OSS4 (from 4Front Technologies). Installing OSS4 appears to require the complete removal of both Pulse and ALSA, so for OSS4 users there are no other options. This only applies to a small number of people, so I've linked to www.opensound.com to cover this.

Steve 10May 12: I propose that the Alsamixer section is severely pruned. It is only really relevant to Linux users that do not have PulseAudio or Jackd. Most modern distributions have PulseAudio or Jackd by default and on such systems the instructions in this Alsa section are potentially damaging.

Other Methods
An alternative to recording streaming audio from the Internet is to download the data directly to disk, either by using command-line tools such as streamripper or mplayer, or with a web browser plug-in (many available for Firefox), or writing the stream to disk from a media player such as VLC or xmms, or using a graphical down-loader such as streamtuner.

Alsamixer
For systems that have ALSA but do not have PulseAudio or Jack Audio System, it may still be possible to record sounds playing on the computer. Alsamixer is a command-line tool with "view" options to represent the sound device graphically. It is installed by default in most desktop distributions. To view the http://linux.die.net/man/1/alsamixer alsamixer manual], open a terminal window and enter man alsamixer.

To start alsamixer, type alsamixer in a terminal window. If a Mix device is shown as a capture device, set this as the active device to enable recording sounds that are playing on the computer.