I have one speaker next to my computer which I use mostly as a headphone amplifier. On occasion I need to use it as a loudspeaker. Is it possible to quickly change the audio output from stereo to mono, either system-wide or as a plugin for a media player?
7 Answers
Find the name of your audio sink by running
pacmd list-sinks | grep name:Then run this command (taking care to remove the angled brackets from the result of previous command):
pacmd load-module module-remap-sink sink_name=mono master=NAME_OF_AUDIO_SINK_GIVEN_BY_PREVIOUS_COMMAND channels=2 channel_map=mono,mono
or add
load-module module-remap-sink sink_name=mono master=NAME_OF_AUDIO_SINK_GIVEN_BY_PREVIOUS_COMMAND channels=2 channel_map=mono,mono
to /etc/pulse/default.pa to have it run at startup.
Then in Sound Preferences choose "Mono" as the output, but remember to reduce volumes by half, since two channels are getting mixed into one, or else you'll have distortion. To test, run:
speaker-test -c 2 -t sine
Same thing in a single command:
pacmd load-module module-remap-sink sink_name=mono master=$(pacmd list-sinks | grep -m 1 -oP 'name:\s<\K.*(?=>)') channels=2 channel_map=mono,mono
To remove the mono channel, just use:
pacmd unload-module module-remap-sink
I've cast answer 1 into a perl-script, so I don't need to remember these 2 commands:
#!/usr/bin/perl
use strict;
my @choices = ();
my $i = 0;
for (`pacmd list-sinks`) {
if( /name:.*<(.+)>/) {
$choices[$i++] = $1;
print "$i:\t$1\n";
}
}
my $choice = $choices[<>-1] or die "invalid choice";
exec (qw(pacmd load-module module-remap-sink sink_name=mono),
"master=$choice",
qw(channels=2 channel_map=mono,mono));
(I would've annotated that answer, but my karma is to low ;-) )
- 36,890
- 56
- 97
- 151
- 181
Modify PulseAudio configuration
load-module module-remap-sink sink_name=mono sink_properties='device.description="Fallback Mono"' channels=1 channel_map=mono
You could store the above line in the default.pa configuration file of PulseAudio or run the line by pacmd command in command line for the running instance of PulseAudio.
Then you have to set that sink default by e.g. pactl set-default-sink mono. The previous default sink keeps running, too, as you can see by pactl list sinks. (This seems to work at least in pulseaudio 15.99.1.)
Use PulseEffects
Alternatively, you could install pulseeffect from universe repository, run it, check Stereo Tools in its GUI and change Mode of Stereo Matrix to LR > L+R or what suits your needs.
Using PulseEffects seems to remove the mono sink from the running configuration, if it was there.
- 6,175
As an addendum, after you have created your mono sink with the above answers, you might map this script to a hotkey:
#!/bin/bash
if [ "* index: 0" == "$(pacmd list-sinks | grep "*" | sed 's/^ *//')" ];
then pacmd set-default-sink 1 && notify-send "Mono";
SINK=1;
else
pacmd set-default-sink 0 && notify-send "Stereo";
SINK=0;
fi;
pacmd list-sink-inputs | grep index | grep -o '[0-9]*' | while read -r line;
do pacmd move-sink-input $line $SINK;
done;
This will toggle between sinks and remap the current stream to the new sink(ma
- 36,890
- 56
- 97
- 151
- 111
You might be able to use the pulseaudio sound settings manager to change stereo to mono. Or perhaps you can try just panning everything to the left or right speaker.
It seems there is no easy way to do this.
You can do it though, by proxying all PulseAudio output to a Jack sink. Too cumbersome to be used casually...
- 2,776