Skip to content

Instantly share code, notes, and snippets.

@southpolemonkey
Created May 5, 2019 12:23
Show Gist options
  • Save southpolemonkey/d8dc8ed3827b4cc84f142c0ce475d82d to your computer and use it in GitHub Desktop.
Save southpolemonkey/d8dc8ed3827b4cc84f142c0ce475d82d to your computer and use it in GitHub Desktop.
bash function which utilise text-to-speech command to pronounce english vocabulary, with customer file and rate
#!/usr/bin/env bash
pronounce_word () {
declare -a myArray
# echo "$args"
# myArray=(`cat "$args"`)
myArray=(`cat $dir`)
say "test begin[[slnc 2000]]"
for i in "${myArray[@]}"
do
say "$i [[slnc $duration]]" #change number to custom pause duration
done
}
# args=("$@")
if test $# = 2
then
dir=$1
duration=$2
else
echo "Usage: script <filename> <pause_duration>" 1>&2
exit 1
fi
echo "$dir"
# echo "$duration"
pronounce_word
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment