Last active
August 13, 2016 17:09
-
-
Save willeccles/18363bda30d016c01533d639b3898ad4 to your computer and use it in GitHub Desktop.
Bash file to speak a file out loud on OS X, with options for volume, voice, and interactive reading.
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 characters
#! /bin/bash | |
if (( $# == 1 )) && [ "$1" == "?" ] | |
then | |
say -v ? | |
echo "" | |
echo "Voices should be specified in quotes if 2+ words." | |
exit 0 | |
fi | |
if (( $# == 4 )) && [ "$4" == "-i" ] | |
then | |
osascript -e "set Volume $2" | |
cat "$1" | say -v "$3" -i | |
elif (( $# == 3 )) | |
then | |
osascript -e "set Volume $2" | |
cat "$1" | say -v "$3" | |
elif (( $# == 2 )) | |
then | |
osascript -e "set Volume $2" | |
cat "$1" | say | |
elif (( $# == 1 )) | |
then | |
cat "$1" | say | |
else | |
echo "Usage: speakfile [? | [filename] [volume 1-10] [voice] [-i]]" | |
echo " For a list of voices: speakfile ?" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For a good time, download Moby Dick and copy it to
moby.txt
and run this:./speakfile moby.txt 2.5 Daniel
. Enjoy! 😄Another fun thing is to put the files all in a user's folder on another computer in the office, then you ssh into their computer as them and then run that script. It will make the computer randomly start talking, and hilarity will surely ensue.