Talk:Tutorial - Recording Computer Playback on Linux

From Audacity Development Manual
Revision as of 17:11, 20 December 2011 by Stevethefiddle (talk | contribs) (alsamixer section)
Jump to: navigation, search

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.

  • 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 sound card. The available options are typically Internal Audio Analog stereo and Monitor Internal Internal Audio Analog Stereo, in which case you would select the latter.

Audacity will now record whatever is playing through the sound card.

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 plugin 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.




Alsamixer

Steve 20Dec11: I've copied this section to the discussion page as I think it needs quite extensive changes and discussion. In particular, the method described here requires that there is a Mix device listed in the Capture settings. As I understand it, the Mix setting is the equivalent of Stereo Mix on Windows, but as is the case on Windows this option is often not available on modern machines. It is not available on my machine. How common is this option these days? Should this section be framed in the context of Linux systems that do not have PulseAudio or Jackd?

To record computer playback with Audacity you can use the alsamixer mixer device to select the "capture" device of your sound card and adjust its input volume. This will record all audio playing through the sound card, including system sounds and possibly sounds from applications other than the one you want to record. To capture sound directly from the application producing it, try using the ALSA PCM file or (on many Linux distributions) PulseAudio.

Alsamixer should already be installed. Alsamixer is a command line tool with "view" options to represent the sound device graphically.

To start alsamixer, open a shell/terminal and start the program by typing alsamixer. There are three different views: Playback (default), Capture and All. This is the Playback view, which you can get to at any time by pressing TAB or F3

Alsamixer Playback view

Top left you should see some information about your sound card. Below are volume bars for adjusting the output volume for each named device: examples are Master, PCM, Line, CD and so on. The currently selected item appears in red and the volume percentages are displayed for left and right channels above the device name. For a mono device, only one value is shown.

You can scroll between devices using the left/right arrow keys. Use up/down arrow keys to adjust the volume. Press the M key to mute/unmute the device. When a device is turned off, M (mute) appears below the volume bar. When it's turned on, O in green appears instead.

Press the TAB key or F4 to switch to Capture view. This is preferable to switching to All view with Enter, because All may not show all of the capture devices for your card.

Alsamixer Capture view

Select the device called Capture with the spacebar. The red CAPTURE flag should appear underneath the Capture bar to indicate that capture is turned on for that device, and L and R letters will indicate that left and right channels are turned on. Devices whose capture are turned off are shown by ------. Select the "Mix" device (this might sometimes be called "Master").

Bill 07May11: At this point we're getting into stuff that should be in Setting up Audacity to record from your chosen input. Is this different enough from the generic instructions on that page that we should leave it here? Also, we may want to rewrite this to emphasize using the Device Toolbar.

Gale: Also for this and recording computer playback on Windows I guess we have to consider what is happening to the Wiki pages. I was envisaging they would not be replaced and would have more detail / mention more esoteric methods than the Manual (possibly to the extent of having an "image for every step" which is what Windows novices possibly need).
Bill: Indeed we will need to decide how much detail to put in these manual pages, and when to send people to the wiki. I've just copied everything for now. Easier, I think, to trim than to add. So, for example, we could lose the (empty) Jack and OSS sections on this page rather than try to write those sections, as they could be considered "esoteric".

Launch Audacity and open the preferences using CTRL + P or navigate to it by clicking Edit > Preferences then click on the Devices tab. Select Alsa: default as playback device and Alsa:<Vendor ID>:<Vendor ID> (hw:0,0) as recording device ("0" represents the default sound card). Click OK to exit Preferences, then press the red Record button or the R shortcut to start recording the audio playing on the computer. If the audio is too soft or too loud so it distorts, you will need to check both the output levels in the Playback view of alsamixer, and adjust the recording level in Audacity (or do so in the Capture view of alsamixer).