This repository contains notes and personal configuration to set up system audio sharing pulseaudio configuration
This was tested on Ubuntu 18.04.
- Run the script :
./pulse_setup.sh
- Configure manually your media source and videoconference input with
pavucontrol
Here are some good-to-know things, I wish I knew some before starting working on this project :
- NEVER use headphones when tinkering with sound. It can be really dangerous, in case of driver malfunctioning, or sudden high volume.
- None of this is reboot-proof. You will have to re-execute the script after every reboot.
pulseaudio -k
restarts your pulseaudio daemon, reloading its configuration. Be careful however, it seems that sometimes it is not enough and makes weird stuff; if you have any doubt, reboot. (Actually,pulseaudio -k
kills your pulseaudio daemon, but your system should restart it automatically. If not, you can do it withpulseaudio --start-server
)- By default, pavucontrol may not display everything in its listings, pay attention to the filters at the bottom of the window.
- It's probably possible to make these modifications reboot-proof by specifying the configuration in pulseaudio configuration files.
Now a few explanations about the different kinds of devices involved. This is only what I have understood experimenting so far, it has no pretention to be absolutely true and flawless. The italicized words are vocabulary that I'm either not sure of, or made up for the sake of clarity.
- By "device", I mean either an application connected to pulseaudio API, a driver interfacing a hardware component with pulseaudio, or a virtual device created inside pulseaudio. Pretty much everything that you will see in pavucontrol listings.
- A sink is an audio output.
- The sinks are listed in the
Output Devices
of pavucontrol. - A sink can receive any number of streams from various players. In this case, these inputs are superposed.
- The classic example of sink is speakers, or headphones.
- The sinks are listed in the
- A player is obtained from a device executing some playback, that you would expect to be routed to your speakers by default.
- Players appear in the
Playback
tab of pavucontrol - The stream coming from a player is directly routed to a sink.
- You can select the target sink in the
Playback
tab of pavucontrol. - The stream from a player can only be routed to a single sink.
- A music player is a good example of such device.
- Players appear in the
- An input is created by a device that is not likely to output to speakers, but more likely to be discarded or routed to another program.
- Inputs appear in the
Input Devices
tab of pavucontrol. - The stream from an input in not routed anywhere by default. You have to capture it.
- A microphone is a very good example of such device.
- Inputs appear in the
- A recorder is a device that captures the stream of an input.
- Recorders are listed in the
Recording
tab of pavucontrol. - In this same tab, you can choose the input they're recording.
- A given recorder can only record a single input, but multiple recorders can listen to the same input.
- A good example of recorder is a videoconference program, that will both contain a player (for the playback), and a recorder (for sending your own voice through a microphone).
- Recorders are listed in the
- Every sink has an associated monitor.
- A monitor is an input, that mirrors the sink it is attached to.
- A good example of use is recording you desktop to make a video tutorial. A desktop recording program will likely provide you a recorder, that you can either attach to you microphone (to get your voice), or to the monitor of your speakers (to record the sound emitted by you desktop during the demo).
- A null sink is a virtual sink created with the
module-null-sink
of pulseaudio.- It behaves like a "real" sink, except that it discards the stream instead of outputing it to speakers (or whatever).
- It has an attached monitor as well.
- A loopback device is a virtual device created with the
module-loopback
of pulseaudio.- It behaves like the combination of a recorder and an input, relaying the stream from the former to the latter.
- Combined with monitors and null sinks, it should allow you to do basically anything you want.
Using the original author's schema.
- Input: None
- Output: virtualspeaker
- Input: virtualmic.monitor
- Output: source speaker
- Input: source mic
- Output: source speaker