Created
January 19, 2014 13:53
-
-
Save mmstick/8505289 to your computer and use it in GitHub Desktop.
Revisions
-
mmstick revised this gist
Jan 19, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -36,9 +36,9 @@ else ## Present Sample Format in a Human Readable Format if [ -n $(echo $sampleFormat | grep float32) ]; then humanReadableSampleFormat="32-bit Floating Point" elif [ -n $(echo $sampleFormat | grep s32) ]; then humanReadableSampleFormat="32-bit Signed Integer" elif [ -n $(echo $sampleFormat | grep s24) ]; then humanReadableSampleFormat="24-bit Signed Integer" elif [ -n $(echo $sampleFormat | grep s16) ]; then -
mmstick created this gist
Jan 19, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,83 @@ #!/bin/bash # This script requires YAD to be installed # Input New Values if [ "$1" == "-gui" ]; then ## YAD Input Form YADInput=$(yad --form \ --title="PulseAudio Configurator" \ --separator="," \ --field="Sample Rate:CB" "22050\!44100\!48000\!96000" \ --field="Sample Format:CB" "s16ne\!s24ne\!s32ne\!float32ne" \ --field="Resample Method:CB" "src-sinc-fastest\!src-sinc-medium-quality\!src-sinc-best-quality" \ --field="Fragments:NUM" \ --field="Fragment Size:NUM") ## Parsed Input newSampleRate=$(echo $YADInput | cut -d \, -f 1) newSampleFormat=$(echo $YADInput | cut -d \, -f 2) newResampleMethod=$(echo $YADInput | cut -d \, -f 3) newFragments=$(echo $YADInput | cut -d \, -f 4 | cut -d \. -f 1) newFragmentSize=$(echo $YADInput | cut -d \, -f 5 | cut -d \. -f 1) else ## Grab the Current Settings for Comparison if [ -e ~/.config/pulse/daemon.conf ]; then sampleRate=$(grep "default-sample-rate" ~/.config/pulse/daemon.conf | cut -d \ -f 3) sampleFormat=$(grep "default-sample-format" ~/.config/pulse/daemon.conf | cut -d \ -f 3) resampleMethod=$(grep "resample-method" ~/.config/pulse/daemon.conf | cut -d \ -f 3) fragments=$(grep "default-fragments" ~/.config/pulse/daemon.conf | cut -d \ -f 3) fragmentSize=$(grep "default-fragment-size-msec" ~/.config/pulse/daemon.conf | cut -d \ -f 3) else sampleRate=$(grep "default-sample-rate" /etc/pulse/daemon.conf | cut -d \ -f 3) sampleFormat=$(grep "default-sample-format" /etc/pulse/daemon.conf | cut -d \ -f 3) resampleMethod=$(grep "resample-method" /etc/pulse/daemon.conf | cut -d \ -f 3) fragments=$(grep "default-fragments" /etc/pulse/daemon.conf | cut -d \ -f 3) fragmentSize=$(grep "default-fragment-size-msec" /etc/pulse/daemon.conf | cut -d \ -f 3) fi ## Present Sample Format in a Human Readable Format if [ -n $(echo $sampleFormat | grep float32) ]; then humanReadableSampleFormat="32-bit Floating Point" elif [ -n $(echo $sampleFormat | grep s32) ]; then humanReadableSampleFormat="32-bit Signed Integer" elif [ -n $(echo $sampleFormat | grep s24) ]; then humanReadableSampleFormat="24-bit Signed Integer" elif [ -n $(echo $sampleFormat | grep s16) ]; then humanReadableSampleFormat="16-bit Signed Integer" fi ## Echo Current Settings echo "Sample Rate: $sampleRate Hz" echo "Sample Format: $humanReadableSampleFormat" echo "Resample Method: $resampleMethod" echo "Fragments: $fragments" echo "Fragment Size: $fragmentSize ms" ## Input New echo "Input new Sample Rate:" read newSampleRate echo "Input new Sample Format:" read newSampleFormat echo "Input new Resample Method:" read newResampleMethod echo "Input number of fragments:" read newFragments echo "Input size of each fragment:" read newFragmentSize fi # Input Settings if [ -e ~/.config/pulse/daemon.conf ]; then rm ~/.config/pulse/daemon.conf fi touch ~/.config/pulse/daemon.conf echo "default-sample-rate = $newSampleRate" >> ~/.config/pulse/daemon.conf echo "default-sample-format = $newSampleFormat" >> ~/.config/pulse/daemon.conf echo "resample-method = $newResampleMethod" >> ~/.config/pulse/daemon.conf echo "default-fragments = $newFragments" >> ~/.config/pulse/daemon.conf echo "default-fragment-size-msec = $newFragmentSize" >> ~/.config/pulse/daemon.conf # Restart PulseAudio pulseaudio -k sleep 2 pulseaudio --dump-conf