Advertisement
Hipekhop

Simulation of channels volume desynchronization

Mar 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.92 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # set 100% for all channels;  don't print STDOUT;
  4. amixer -D pulse sset Master 100% 1>/dev/null
  5.  
  6. # print result
  7. echo -ne "\nbefore:\n"
  8. amixer
  9.  
  10. # prepare for nice comparation in `vimdiff`
  11. amixer_a=$(echo "before:"; amixer)
  12.  
  13. # 100 times parallel decrase volume for all channels by 1%
  14. # don't print STDOUT; don't print STDERR
  15. # it's working also with, for example 1%-, but
  16. # I choose changing by number according to
  17. # https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#Volume_adjustment_does_not_work_properly
  18. for x in {1..100}
  19. do
  20.     ( amixer -D pulse sset Master 700- 1>/dev/null 2>/dev/null ) &
  21. done
  22.  
  23. # wait for for in ugly way... but KISS, that's only simulation ;)
  24. sleep 3s
  25.  
  26. # print result
  27. echo -ne "\nafter:\n"
  28. amixer
  29.  
  30. # prepare for nice comparation in `vimdiff`
  31. amixer_b=$(echo "after:"; amixer)
  32.  
  33. # nice comparation in `vimdiff`
  34. vimdiff <(echo "$amixer_a") <(echo "$amixer_b")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement