Skip to content

Instantly share code, notes, and snippets.

@andrewn
Last active February 13, 2018 13:46
Show Gist options
  • Save andrewn/8b6557aefdf36a657952e04ff4207a45 to your computer and use it in GitHub Desktop.
Save andrewn/8b6557aefdf36a657952e04ff4207a45 to your computer and use it in GitHub Desktop.
Pi text-to-speech (TTS)

speechd is a wrapper around tts systems festival is the thing that speaks

sudo apt-get install speech-dispatcher festival -y

See which voices are available:

spd-say --list-synthesis-voices

Say something:

spd-say "I am a computer"

Say something in a scottish accent:

spd-say --synthesis-voice en-scottish "I am scottish"

Chromium should use speechd when the --enable-speech-dispatcher flag is used. But it doesn't :-(

If it did work then you should be able to get the list of voices via JS:

speechSynthesis.getVoices()

And speaking like:

speechSynthesis.speak(new SpeechSynthesisUtterance('Am I webscale?'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment