PLA Tech Blog   

Bash Script - Text to Speech

Use the Bash script below to speak some text. I like to use this for alarms and completion messages on long running jobs. For example I burn Raspberry Pi thin client images at work which take over 30 minutes to complete.

You’ll need to obtain a key to use IBM Watson Text to Speech API.

At the bottom of the page is an example audio message uploaded to YouTube.

# Speak text
/usr/bin/curl  -v -X POST -u YourApiKeyGoesHere:YourPasswordGoesHere \
  --header "Content-Type: application/json" \
  --header "Accept: audio/wav" \
  --data '{"text":"'"$1"'"}' \
  --output "$temporaryFile" \
/usr/bin/mplayer "$temporaryFile"


~/ "Congratulations! The Raspberry Pi thin client image is ready. It took 41 minutes to burn."

Written on May 3, 2017.