Last active
May 7, 2020 09:43
-
-
Save WorldDownTown/cb1fb7dfe64302d08dc2ac2279fe02c4 to your computer and use it in GitHub Desktop.
volume-configured say command
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/sh | |
| |
# ~/say_with_volume.sh "hello world" # default volume is 20 | |
# ~/say_with_volume.sh "hello world" 30 | |
| |
volume=`osascript -e "output volume of (get volume settings)"` | |
default_volume=20 | |
say_volume=$2 | |
| |
if [ $volume = "0" ]; then | |
# If the volume is zero, the script doesn't do anything. | |
exit 0 | |
fi | |
| |
if [ "${say_volume}" = "" ]; then | |
osascript -e "set Volume output volume ${default_volume}" | |
else | |
osascript -e "set Volume output volume ${say_volume}" | |
fi | |
say -v Samantha "${1}" | |
osascript -e "set Volume output volume ${volume}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment