58

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?

  • As a side note I can do this on my android phone using the Voodoo Control app which requires a custom kernel that tweaks the headphone amp found in the galaxy phones – daithib8 Sep 17 '11 at 08:56
  • If you're in Ubuntu 22.10 (which uses PipeWire instead of PulseAudio) you can install EasyEffects for this; check this answer. – geekley Nov 20 '22 at 00:07

6 Answers6

88
  1. Find the name of your audio sink by running

    pacmd list-sinks | grep name:
    
  2. 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.

  1. 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
  1. To remove the mono channel, just use:

    pacmd unload-module module-remap-sink
    
cebola
  • 3
daithib8
  • 3,351
  • Worked like a charm! Good stuff! I had to do this because I only have 1 speaker left (of 4 speakers, using only the front connector) and the Phone Booth DVD was playing some sound in the wrong channel or something. – Bruce van der Kooij Mar 15 '12 at 09:05
  • Am I the only one who gets system sound distortion even at low volumes when I try this? – Severo Raz Apr 23 '12 at 03:52
  • 2
    Be sure to reduce the "Applications" volume (also found within the Sound Preferences) as well as the "Output" volume. If you play music from the terminal you can adjust that volume from there. – daithib8 May 21 '12 at 16:04
  • For me sound get extremely faint using the new sink and it doesn't combine the two channels. – Christian Sep 05 '12 at 21:17
  • 8
    Just a comment for anyone who gets a little confused (as I did): when @daithib8 writes "or add the argument to pacmd to /etc/pulse/default.pa", that means doing sudo emacs /etc/pulse/default.pa (or sudo nano or whatever editor you prefer), scrolling down to the end, and then pasting everything from the command except the pacmd part in to a new line at the bottom of the file. Then save and restart :-) – machineghost May 03 '13 at 21:40
  • 8
    You're a lifesaver for people with single-sided hearing loss. – Omri Barel Mar 08 '14 at 22:04
  • I managed to get rid from output distortion on my raspberry pi with following command: load-module module-remap-sink sink_name=mono master= channels=4 channel_map=left,right,left,right master_channel_map=left,left,right,right – domax May 26 '15 at 02:00
  • 2
    And I am doing fine by channels=1 channel_map=mono. – jarno Sep 06 '15 at 10:56
  • Besides, as for step 3, I don't find need to reduce volumes by half. No distortion here. – jarno Sep 06 '15 at 20:13
  • This is broken: I get Module load failed (and no other output) when I try to run the pacmd load-module command. – Jonathan Cast Aug 02 '17 at 14:11
  • For those who might encounter the below error, be sure to use REGULAR /bin/grep instead of EXTENDED GREP (/bin/egrep).

    I always have my 'grep' command aliased to /bin/egrep. @jcast, you might want to try what I'm suggesting here. The error message when using extended grep is: "grep: conflicting matchers specified"

    – Vahid Pazirandeh Sep 17 '17 at 07:17
  • 1
    On Ubuntu 19-04 pacmd is replaced to pactl. Please update. – RedEyed May 15 '19 at 12:37
  • my volume is reduced to about half (ubuntu 18.04) any way to boost it with something like a pre-gain? – Chad Jan 23 '20 at 14:37
  • 1
    Just want to follow up my own comment, reduced volume is because the remap takes the volume of the source. So if my original "Headphones - built-in Audio" is set to 20%, then I select "Remapped Built-in Audio..." and set my volume to 100%, it is in fact only 20%, the original 20%. Stop your sound, select the original source and turn it up to 50-100%, then select the Remapped and you will get a "normal" volume range – Chad Feb 06 '20 at 16:17
  • 1
    Mind that the master argument name_of_audio_sink_given_by_previous_command is one param instead of two (despite the space in the value). (Unfortunately can't edit bc it changes to little characters, wt…?) – Benjamin Peter Dec 20 '20 at 12:04
  • Thank you so much! I am deaf on one ear and prefer to use headphones. You have no idea how many songs are mixed with half of the instruments on one channel and the rest on the other! – Job Sep 07 '21 at 08:22
  • After upgrading to Ubuntu 22.10 (which uses PipeWire instead of PulseAudio) it seems to no longer work. On pacmd list-sinks I'm getting No PulseAudio daemon running, or not running as session daemon.. Can someone update this answer to PipeWire too? This stupid earphone I bought is outputting right-channel on both sides and left on none >:( If it was mono it'd be less bad at least. – geekley Nov 08 '22 at 03:40
  • Using pactl instead of pacmd and grep Name: instead of grep name: worked for me! https://discussion.fedoraproject.org/t/downmixing-stereo-audio-to-mono-audio/74982 helped me find pactl. I then used "PulseAudio Volume Control" to set the "Remapped" Output Device as the fallback. – Solomon Ucko Sep 08 '23 at 01:21
18

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 ;-) )

David Foerster
  • 36,264
  • 56
  • 94
  • 147
  • How can you hide the output of pacmd command? – jarno Sep 06 '15 at 11:04
  • 2
    Oh, you could replace the exec command by exec "pacmd load-module module-remap-sink sink_name=hono master=$choice channels=1 channel_map=mono >/dev/null"; (This hides output, and uses slightly simpler mapping.) – jarno Sep 06 '15 at 11:16
4

If you are using jack, then you can do so using patchage(which can be installed with apt-get install patchage ). It has a very intuitive interface.

1

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

1

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

David Foerster
  • 36,264
  • 56
  • 94
  • 147
0

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.

  • Paning won't work. It will not mix both channels together, it will mute one of the speakers and take just the output from one of the channels. – Rafał Cieślak Apr 22 '11 at 09:50
  • Panning is what David is asking for. Panning is the act of mixing two channels together in order to output them to one speaker, usually in order to give the impression that the sound is coming from a particular direction. Hence the name pan(orama)ing. A variant of this, called panning straight up, mixes the channels together but outputs an equal amount of the result to each speaker. Since he is only using one speaker this would also work for him. Pulseaudio volume control only adjusts the balance, where the volume at each speaker is adjusted though no mixing takes place. – daithib8 Apr 22 '11 at 13:05