User Tools

Site Tools


ubuntu:pluseaudio

Reset Pulseaudio Settings

Ubuntu 12.10 (and later)

rm -r ~/.pulse*; pulseaudio -k

Ubuntu 13.04/Raring (and later)

rm -r ~/.config/pulse; pulseaudio -k

To see the module names run pulse audio with the shell from the terminal

pulseaudio -C

Use this command to get the list of local sinks in the pa shell

list-sinks

module-combine is able to combine only local sinks, so you need to create a tunnel sink that will send sound from local pa server to the remote one

load-module module-tunnel-sink server=soundserver.local

Now combine sinks

load-module module-combine sink_name=combined slaves="tunnel.soundserver.local,alsa_output.pci_10de_26c_sound_card_0"

replace “alsa_output.pci_10de_26c_sound_card_0” and “soundserver.local” with your own values

pacmd list-sinks
pacmd load-module module-tunnel-sink server=soundserver.local
pacmd load-module module-combine sink_name=combined slaves="tunnel.soundserver.local,alsa_output.pci_10de_26c_sound_card_0"
load-module module-native-protocol-tcp auth-anonymous=1

Noise Reduction Script

#!/bin/bash
time=5
workDir='/tmp'
record()
{
    echo "Recording background noise. Keep quiet for $time seconds."
    sleep 3
    arecord -f cd noise.wav &
    PID=$!
    sleep $time
    kill $PID
    aplay noise.wav
}
 
#get pulse audio devices
devices=`pactl list | grep -E -A2 '(Source|Sink) #' | grep 'Name: ' | grep -v monitor | cut -d" " -f2`
if [ `echo "$devices" | grep -c aloop` -lt 1 ]; then
    echo "No loopback device created. Run 'sudo modprobe snd_aloop' first."
    exit
fi
 
cd $workDir
 
#record noise sample
record
while true; do
    read -p "Do you wish to re-record the noise sample?" yn
    case $yn in
        [Yy]* ) record;;
        [Nn]* ) break;;
        * ) echo "Please answer yes or no.";;
    esac
done
 
#create noise profile
sox noise.wav -n noiseprof noise.prof
 
input=`echo "$devices" | grep input.*pci`
output=`echo "$devices" | grep output | grep 1b`
 
echo "Sending output to loopback device. Change recording port to <Loopback Analog Stereo Monitor> in PulseAudio to apply. Ctrl+C to terminate."
 
#filter audio from $input to $output
pacat -r -d $input --latency=1msec | sox -b 16 -e signed -c 2 -r 44100 -t raw - -b 16 -e signed -c 2 -r 44100 -t raw - noisered noise.prof 0.2 | pacat -p -d $output --latency=1msec
ubuntu/pluseaudio.txt · Last modified: 2019/01/11 12:23 by tschulz