User Tools

Site Tools


ubuntu:pluseaudio

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ubuntu:pluseaudio [2019/01/11 10:19]
tschulz
ubuntu:pluseaudio [2019/01/11 12:23] (current)
tschulz [Ubuntu 13.04/Raring (and later)]
Line 12: Line 12:
  
 To see the module names run pulse audio with the shell from the terminal To see the module names run pulse audio with the shell from the terminal
-<​file>​+<​file ​bash>
 pulseaudio -C pulseaudio -C
 </​file>​ </​file>​
Line 32: Line 32:
 pacmd load-module module-tunnel-sink server=soundserver.local 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"​ pacmd load-module module-combine sink_name=combined slaves="​tunnel.soundserver.local,​alsa_output.pci_10de_26c_sound_card_0"​
 +</​file>​
 +<​file>​
 +load-module module-native-protocol-tcp auth-anonymous=1
 +</​file>​
 +
 +===== Noise Reduction Script =====
 +<file bash>
 +#!/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
 </​file>​ </​file>​
  
ubuntu/pluseaudio.1547223580.txt.gz · Last modified: 2019/01/11 10:19 by tschulz