Last active
April 28, 2018 19:37
-
-
Save JakubVanek/cb2d6c8dece0994da0426b237b3fe18b to your computer and use it in GitHub Desktop.
Fake Pulseaudio balanced mono-output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Creates a mono "balanced" output from a stereo unbalanced one. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Inverts only one channel + uses less remaps. | |
# shorthands | |
ldmap="pacmd load-module module-remap-sink" | |
ldplug="pacmd load-module module-ladspa-sink" | |
ldcomb="pacmd load-module module-combine-sink" | |
# find output soundcard | |
ALSA="$(pacmd list-sinks | grep 'name:' | grep alsa | tail -n1 | sed -E 's/.*<(.*)>.*/\1/')" | |
# more shorthands | |
CH1="channels=1" | |
CH2="channels=2" | |
OUTMAP="master_channel_map" | |
INMAP="channel_map" | |
DESC="sink_properties=device.description" | |
MIX="remix=yes" | |
NOMIX="remix=no" | |
# passthrough for non-inverted output | |
$ldmap sink_name=passNon "$CH1" master="$ALSA" "$OUTMAP=front-left" "$INMAP=mono" "$NOMIX" "$DESC=PassNoInv" | |
# remap inv to side | |
$ldmap sink_name=comboInv "$CH1" master="$ALSA" "$OUTMAP=front-right" "$INMAP=mono" "$NOMIX" "$DESC=MergeInv" | |
# invert inv channel | |
$ldplug sink_name=inv "$CH1" master=comboInv plugin=inv_1429 label=inv "$DESC=Invert" | |
# duplicate mono channel | |
$ldcomb sink_name=split "$CH1" slaves=passNon,inv "$DESC=Duplicate" | |
# mix L/R to mono | |
$ldmap sink_name=monomix "$CH2" master=split "$OUTMAP=mono,mono" "$INMAP=mono,mono" "$MIX" "$DESC=MonoMix" | |
# set default | |
pacmd set-default-sink monomix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Inverts only one channel. | |
# shorthands | |
ldmap="pacmd load-module module-remap-sink" | |
ldplug="pacmd load-module module-ladspa-sink" | |
ldcomb="pacmd load-module module-combine-sink" | |
# find output soundcard | |
ALSA="$(pacmd list-sinks | grep 'name:' | grep alsa | head -n1 | sed -E 's/.*<(.*)>.*/\1/')" | |
# more shorthands | |
CH1="channels=1" | |
CH2="channels=2" | |
OUTMAP="master_channel_map" | |
INMAP="channel_map" | |
DESC="sink_properties=device.description" | |
MIX="remix=yes" | |
NOMIX="remix=no" | |
# remap inv/noninv back to R/L output | |
$ldmap sink_name=comboNon "$CH1" master="$ALSA" "$OUTMAP=front-left" "$INMAP=mono" "$NOMIX" "$DESC=MergeNoInv" | |
$ldmap sink_name=comboInv "$CH1" master="$ALSA" "$OUTMAP=front-right" "$INMAP=mono" "$NOMIX" "$DESC=MergeInv" | |
# invert inv channel | |
$ldplug sink_name=inv "$CH1" master=comboInv plugin=inv_1429 label=inv "$DESC=Invert" | |
# split mono/mono to individual inv/noninv | |
$ldmap sink_name=splitNon "$CH1" master=comboNon "$OUTMAP=mono" "$INMAP=front-left" "$NOMIX" "$DESC=SplitNoInv" | |
$ldmap sink_name=splitInv "$CH1" master=inv "$OUTMAP=mono" "$INMAP=front-right" "$NOMIX" "$DESC=SplitInv" | |
# duplicate mono/mono | |
$ldcomb sink_name=split "$CH2" slaves=splitNon,splitInv "$DESC=Duplicate" | |
# mix L/R to mono/mono | |
$ldmap sink_name=monomix "$CH2" master=split "$OUTMAP=front-left,front-right" "$INMAP=mono,mono" "$MIX" "$DESC=MonoMix" | |
# set default | |
pacmd set-default-sink monomix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Inverts two channels and then picks one. | |
# shorthands | |
ldmap="pacmd load-module module-remap-sink" | |
ldplug="pacmd load-module module-ladspa-sink" | |
ldcomb="pacmd load-module module-combine-sink" | |
# find output soundcard | |
ALSA="$(pacmd list-sinks | grep 'name:' | grep alsa | head -n1 | sed -E 's/.*<(.*)>.*/\1/')" | |
# more shorthands | |
CH1="channels=1" | |
CH2="channels=2" | |
OUTMAP="master_channel_map" | |
INMAP="channel_map" | |
DESC="sink_properties=device.description" | |
MIX="remix=yes" | |
NOMIX="remix=no" | |
# remap inv/noninv back to R/L output | |
$ldmap sink_name=comboNon "$CH1" master="$ALSA" "$OUTMAP=front-left" "$INMAP=front-left" "$NOMIX" "$DESC=MergeNoInv" | |
$ldmap sink_name=comboInv "$CH1" master="$ALSA" "$OUTMAP=front-right" "$INMAP=front-right" "$NOMIX" "$DESC=MergeInv" | |
# invert inv channel | |
$ldplug sink_name=inv "$CH2" master=comboInv plugin=inv_1429 label=inv "$DESC=Invert" | |
# duplicate mono/mono | |
$ldcomb sink_name=split "$CH2" slaves=inv,comboNon "$DESC=Duplicate" | |
# mix L/R to mono/mono | |
$ldmap sink_name=monomix "$CH2" master=split "$OUTMAP=front-left,front-right" "$INMAP=mono,mono" "$MIX" "$DESC=MonoMix" | |
# set default | |
pacmd set-default-sink monomix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Unload modules. | |
pacmd unload-module module-combine-sink | |
pacmd unload-module module-remap-sink | |
pacmd unload-module module-ladspa-sink |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment