Advertisement
Guest User

Untitled

a guest
Mar 14th, 2018
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.07 KB | None | 0 0
  1. #!/bin/bash
  2. # bash is required for the <<<
  3.  
  4. sinkdata=$(pacmd list-sinks)
  5. listsink_rv=$?
  6.  
  7. if [ $listsink_rv -ne 0 ]
  8. then notify-send "pulse plugins" "pulseaudio isn't running"
  9.     exit
  10. fi
  11.  
  12. if grep -q "<null>" <<< $sinkdata
  13. then notify-send "pulse plugins" "already activated"
  14.     exit
  15. fi
  16.  
  17. # Add ladspa sinks
  18. # LADSPA_PATH didn't work for me
  19. pacmd load-module module-ladspa-sink sink_master=0 sink_name=lowfre_butt \
  20.     plugin=/usr/local/lib/ladspa/butterworth_1902.so label=buttlow_iir control=50,
  21.     #~ plugin=butterworth_1902 label=buttlow_iir control=50,
  22. pacmd load-module module-ladspa-sink sink_master=0 sink_name=lowfre_tsche \
  23.     plugin=/usr/local/lib/ladspa/lowpass_iir_1891.so label=lowpass_iir control=40,3
  24.     #~ plugin=lowpass_iir_1891 label=lowpass_iir control=40,3
  25.  
  26. # Add null sink, loopback the ladspa sinks into it, set the null sink as default
  27. # and adjust volume ratios
  28. # code (modified) provided by georgC (via irc)
  29. pacmd load-module module-null-sink
  30. # adjust_time=0 avoids the latency offsets, however with this enabled, in time
  31. # the overall latency grows bigger and bigger
  32. # increasing latency_msec also didn't seem to fix the problem
  33. pactl load-module module-loopback latency_msec=30 adjust_time=1 \
  34.     source=null.monitor sink=lowfre_butt
  35. pactl load-module module-loopback latency_msec=30 adjust_time=1 \
  36.     source=null.monitor sink=lowfre_tsche
  37. pactl load-module module-loopback latency_msec=30 adjust_time=1 \
  38.     source=null.monitor sink=0
  39. pacmd set-default-sink null
  40. lowfre_index=$(pacmd list-sink-inputs | ag "<lowfre_butt>" -B4 | head -n1 | \
  41.     cut -f2 -d":")
  42. pacmd set-sink-input-volume $lowfre_index 0x10000
  43. pacmd set-sink-input-volume $((lowfre_index+1)) 0x18675
  44. #~ pacmd set-sink-input-volume $((lowfre_index+1)) 0x10000
  45. pacmd set-sink-input-volume $((lowfre_index+2)) 0x7800
  46. #~ pacmd set-sink-input-volume $((lowfre_index+1)) 0x7800
  47.  
  48. notify-send "pulse plugins" "activated"
  49.  
  50. # module-combine-sink also shows the latency offset problem(s)
  51. # it also doesn't remember the volume configurations
  52. # the problem also appears with two (instead of three) sinks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement