Last active
November 11, 2016 09:58
-
-
Save jhuesser/efa188e8ddbe43c0d616f9889768e45a to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/bin/bash | |
if [ "$(id -u)" != "0" ]; then | |
echo "Please use sudo configure_sound.sh." | |
echo "ERROR: You are not root." | |
exit 1 | |
fi | |
apt-get update | |
apt-get -y install omxplayer | |
chmod a+rw /dev/vchiq | |
read -p "Please select default output: [A]udio jack | [h]dmi" output | |
if [[ -z "$output" ]] || [[ $output == "A" ]] || [[ $output == "a" ]]; then | |
amixer cset numid=3 1 | |
elif [[ -z "$output" ]] || [[ $output == "h" ]] || [[ $output == "H" ]]; then | |
amixer cset numid=3 2 | |
else | |
echo "invalid answer. setting to automatic." | |
amixer cset numid=3 0 | |
fi | |
chmod a+rw /dev/vchiq | |
read -p "Enter path to a file to test. Leave emtpy for example file: " file2play | |
if [ -z "$file2play" ]; | |
then | |
wget https://goo.gl/XJuOUW -O example.mp3 --no-check-certificate | |
omxplayer example.mp3 | |
else | |
omxplayer $file2play | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment