Quantcast
Channel: CodeSection,代码区,Linux操作系统:Ubuntu_Centos_Debian - CodeSec
Viewing all articles
Browse latest Browse all 11063

How to use Pulse to manage sound on Linux

$
0
0

It happens to everyone, and usually only when it matters the most. You might be gearing up for a family Christmas video chat, settling in for a movie night on your big screen TV, or getting ready to record a tune that popped into your head and needs freeing. At some point, if you use a computer, sound is going to need to be routed.

How linux audio works

Without going into technical detail, here's a map of how Linux audio works.


How to use Pulse to manage sound on Linux

First of all, there's a source and there's a target: something is making sound and something else is supposed to receive and process that sound.

For most everyday tasks, doing all this translates to using an application (like VLC Media Player , for instance) generating sound and a device (like your speakers or headphones) receiving that sound and delivering it to your ears.

The other way round is basically the same; a device (like a microphone) generates sound and sends it to an application (like Jitsi video chat or the Qtractor DAW) for processing.

No matter what, the model is always the same. Sound is generated by one thing and sent to another.

Between those two end points exists a Linux sound system, because, after all, something needs to route the sound.

Without going too far back in history, Advanced Linux Sound Architecture (ALSA) traditionally managed Linux audio. In fact, ALSA still manages Linux audio. The difference is that on modern Linux, users don't generally need to deal directly with ALSA to route sound. Instead, they can use tools sitting on top of ALSA, like Pulse Audio .

If you have sound working on your Linux machine on a daily basis, but you get thrown off balance when you need to get specific about sound inputs and outputs, read on. This is not an article about how to install drivers or set sound defaults. If you want to know more about that level of sound configuration, visit support forums such as Linux Questions and documentation sites such as Slackermedia to help you. This article is about getting comfortable with the sound controls of a modern Linux system.

Why Pulse?

Why is Pulse necessary?

Strictly speaking, it isn't. ALSA works so well that some distributions are just starting to integrate Pulse by default. However, dealing directly with ALSA can require a lot of manual hacking. I'm not talking about the initial setup. Using ALSA could result in some pretty convoluted configs and wrapper-scripts, and you still never get one configuration to serve your every use case. The problem wasn't always with ALSA. Sometimes it was the fault of the application itself, but that doesn't change the end result. Your box was still "broken" until you could swap out config files and restart the service.

The thing is, we're demanding a lot more of our computers now than ever before. Audio output used to be either a speaker or headphones, but now we want our computer to beam audio across the room to the screen we use as a TVand to pick up audio from a Bluetooth mic in a phone.

Pulse sits patiently between the thing that is generating sound and the thing meant to receive that sound, making sure everything plays nicely with one another. It adds several bonus features, too, such as the ability to send audio to a different computer and invisibly changing the sample format or channel count.

Learning Pulse

To get comfortable with Pulse, you need to remember three things:

Check your cables (virtual and physical) Set sound input or output from source of sound Manage your targets from Pulse Audio Control ( pavucontrol ) Step 1: Check cables and hardware

Check your cables. Check volume knobs. Check mute buttons and power buttons. You're living in the "turn it off, and then on again" school of audio engineering.


How to use Pulse to manage sound on Linux

Admit it. You've done this once or twice yourself, too.

If you left your headphones plugged in, or you forgot to power on your speakers, or turned the volume down on your speaker or the application playing sound, then spending time and effort configuring your system is pointless. Do the "dummy check" first.

Step 2: Check application preferences

Similar to checking cables and knobs, check the settings of the sound application you're using on your computer. Not all applications give you much of a choice, but there's usually has some kind of menu somewhere governing what the application does with its sound. VLC, for example, gives you lots of choices:


How to use Pulse to manage sound on Linux

While an application like Google Hangouts gives you a simplified view:


How to use Pulse to manage sound on Linux

The point is, you need to decide where your sound is headed once it leaves its parent application. Make sure it's set sanely.

If you're confused by all the choices, it's usually safe to send sound to Pulse.

Send sound to Pulse to benefit from Pulse's simplified worldview. You can send it to Pulse and manage it from Pulse's control panel―Pulse's job is to manage sound dynamically.

Send sound to ALSA if you want direct control. This may be important if you're using pro apps, like a soft synth and an effects rack and a DAW, and you need absolute control over channel routing (with JACK or Patchage, for instance) and processing order.

Pulse has an ALSA plug-in, so even if your first choice as a destination is ALSA, you'll still have some ability to manage that sound from Pulse. Pulse doesn't "steal" your audio, so you don't have to worry about Pulse intercepting your signal and re-routing it some place else. Pulse always respects the choices made at lower levels (and ALSA is about as low as you can get in the sound system, drivers notwithstanding).

Step 3: Pulse audio volume control (pavucontrol)

The nerve center of Pulse Audio is pavucontrol , more commonly known as "the sound control panel," because its default home is in Gnome's System Settings. (It's also available as pavucontrol-qt for KDE System Settings.) It can be installed and invoked as a standalone application, too, so remember its official title.

You use pavucontrol on a daily basis to set sound levels and routing on your computer. It's listed as step 3 in my list of things to do, but realistically it's your first stop for normal, everyday sound management (in fact, when you adjust the volume on the Gnome desktop, you're tapping into these same controls, so you use it daily whether you realise it or not).

pavucontrol is a dynamic panel consisting of five tabs:

Configuration: activates sound cards and defines the usage profile. On my desktop machine, for instance, I generally have HDMI de-act

Viewing all articles
Browse latest Browse all 11063