Stereo mix with Ubuntu 10

From Audacity Wiki
Jump to: navigation, search
This tutorial is about recording audio playing on the computer (such as internet radio), using Audacity on Ubuntu 10.x. This is commonly known by the Microsoft Windows terminology as recording "Stereo Mix". The set-up and procedures described are likely to be similar on other Linux distributions that use PulseAudio.


Contents

Installing Audacity

The Ubuntu-packaged version of Audacity (1.3.12 for Ubuntu 10) can be installed using the "Ubuntu Software Centre".

  • Applications menu > Ubuntu Software Centre.
  • Type the word "Audacity" (without quotes) into the search box.
  • Select Audacity and click on "Install".
  • Enter password when prompted.

Installing other recommended packages

The Ubuntu Software Centre can again be used to install the following recommended packages:

  • PulseAudio Device Chooser
  • PulseAudio Volume Control

Restart your computer after installing these packages.

Installing optional components

The Ubuntu Software Centre can again be used to install the following optional components:

  • Ubuntu Restricted Extras

Testing the installation

Launch Audacity from Applications > Sound & Video > Audacity and open Audacity Preferences Edit > Preferences. Select "Devices" in the left column and ensure that the following settings are selected:

  • Host: ALSA
  • Playback
    • Device: default
  • Recording
    • Device: default
    • Channels: 2 (stereo)

Click the "OK" button to confirm the settings and close Preferences.

Generate a tone using Generate > Tone... > OK Press the Play button to play back the tone. If you are unable to hear the tone playing back, check the computer playback volume settings (see next section).

Volume Controls

Now that PulseAudio Volume Control is installed there will be two volume controls. In the top panel you will see the default Gnome Volume Control icon. Click on this icon to reveal the master playback volume slider. Click on "Preferences" to reveal the full Gnome Volume Control interface.

Gnome Volume Control showing the input tab.

There is now also an additional icon in the upper panel which is for the PulseAudio Device Chooser. Click on the PulseAudio Device Chooser icon PulseAudio Device Chooser icon and select "Volume Control" from the drop down menu.

Note: Due to a bug in Ubuntu 10.x the PulseAudio Device Chooser will not have the correct icon in the panel.

The PulseAudio Volume Control duplicates the controls in the standard Gnome Volume Control, but also adds additional functionality.

PulseAudio Volume Control showing the 'Input Devices' tab.

PulseAudio Volume Control Settings

  • On the Configuration tab, ensure that your soundcard is set to "Duplex".
  • The 'Input Devices' tab will display all available physical inputs, with slider controls for adjusting the input level of each This duplicates the Input slider(s) in the Gnome Volume Control.
  • The 'Output Devices' tab will display all available output (playback) devices, with slider controls for adjusting the output level of each. The first slider duplicates the master playback volume slider. There may be a second slider below this which is a "virtual" output device. If the physical soundcard device is called "Internal Audio Analogue Stereo", then the virtual device will be called "Simultaneous Output to Internal Audio Analogue Stereo". This second slider will only be shown if 'virtual devices' are enabled. Virtual devices are not necessary for recording "Stereo Mix". If you have more than one physical soundcard installed, there will be sliders for each device.
PulseAudio Volume Control showing an internal soundcard and an external USB device.
  • The Recording tab displays all active recording applications. Audacity will only appear here when in Record, Paused Record or Monitor mode.
  • The Playback tab displays all active playback applications. Audacity will only appear here when in Play or Paused Play mode.

Simultaneous Output

PulseAudio has an option to allow output to multiple audio devices simultaneously through a virtual device. For users with multiple soundcards there may be circumstances where this feature is useful, but outputting to multiple audio devices carries a performance penalty so in most cases it would not be used. To enable or disable Simultaneous output; PulseAudio Device Chooser > Configure Local Sound Server.

Software Playthrough

Software Playthrough is a feature in Audacity that allows the audio input to be routed through to the audio output via software. It is not normally required when using PulseAudio as equivalent functionality can be achieved with much lower latency from within PulseAudio. When recording sounds that are playing on the computer, Software Playthrough must be switched off to avoid creating echoes and feedback loops.

Connecting Applications to Audio Devices

PulseAudio Volume Control takes care of routing the audio stream in and out of audio programs through to audio devices. The audio device may be a physical soundcard or a virtual audio device.

Default Record and Playback Devices

The default input (recording) and output (playback) device is set per application, so you can set a different default device for each audio application. If the default device is not available (for example if set to an external USB device that is disconnected, then PulseAudio will attempt to switch to the fallback device.

To set the fallback recording (input) device for all audio applications, open the PulseAudio Volume Control and select the "Input Devices" tab.

To select a physical (hardware) device, select "Hardware Input Devices" from the "Show" dropdown menu, then click on the green tick icon to select the device.
To select a virtual device, select "All Output Devices" from the "Show" dropdown menu, then click on the green tick icon to select the device.

To set the fallback play (output) device for all audio applications, open the PulseAudio Volume Control and select the "Output Devices" tab, then set the fallback device in the same way as setting the fallback input device.

Setting the default Record and Playback devices for an application

To set the default recording or playback device for an application, open the application, then open the PulseAudio Volume Control.

Some audio applications have their input / output ports permanently available, in which case the application will be listed in the Playback and/or Recording tabs of PulseAudio Volume Control.

Other applications, including Audacity, only have input / output ports available when in playback / recording mode. When idle, such applications do not appear in the PulseAudio Volume Control.

To make the Audacity output ports active, import or generate some audio (generate "silence" will work), then press the Play button. Audacity will now appear in the Playback tab of the PulseAudio Volume Control. Audacity's playback port will remain visible as long as Audacity is either playing, or in Paused playback.
To make the Audacity input ports active, either press the Record button, or click in Meter Toolbar to activate monitoring.

When the application is visible in the Playback / Recording tabs of the PulseAudio Volume Control, the required playback / recording device can be connected to the application by clicking on the device button next to the application name.

Attach Audacity recording input (Capture) to the internal soundcard.

Recording From Another Application

Each audio device has a Monitor input. When an application plays through an audio device, PulseAudio can be configured to connect the Audacity recording input to the 'Monitor' of the device that is being used for playback.

Configuring the Application to be Recorded

Open the program that will be used for playback and open PulseAudio Volume Control. Start playback and look in PulseAudio Volume Control in the Playback tab. If the application is using PulseAudio for playback, then it will be listed in the Playback tab of Pulse Audio Volume Control. Here it can be configured to use any available audio device.

Selecting the playback device in PulseAudio

Usually this would be the Internal Audio device, though if other devices are connected, such as a USB soundcard, then the application playback can be routed to that device instead. To route the output to all playback devices, select the Simultaneous Output option.

If a playback device selection box does not display, you may have to enable a simultaneous virtual device and select that (and the corresponding monitor source for Audacity in the adjacent Recording tab). See the Simultaneous Output option.

Configuring Audacity

Launch Audacity and choose Edit > Preferences: Devices For a default Ubuntu installation the Host setting will only have the ALSA choice. Usually the Playback and Recording devices should be set to default but in some cases it may be necessary to specify pulse. Channels would normally be set to 2 (stereo) unless you specifically want to record in mono. Click the OK button to close Preferences.

In Audacity 1.3.13 and later, the device and channel options can be selected in the Device Toolbar

While the audio source application is playing, click on Audacity's recording meter to activate recording, then look in the PulseAudio Volume Control Recording tab. Audacity should be listed as a recording application. If it is not listed, click in the recording meter to stop monitoring, go back into Preferences and change the recording device from default to pulse.

When Audacity is listed on the recording tab of PulseAudio Volume Control, click on the button Alsa Capture from and select the Monitor for the device that is being used for playback, for example Monitor of Internal Audio.

Selecting the recording device in PulseAudio

Start recording in Audacity.

Personal tools

Donate securely by PayPal, using your credit card or PayPal account!