While experimenting with the tiptoi pen from Ravensburger we needed to generate audio files for our product.
We started with installing espeak, a popular text-to-speech tool:
# apt-get install espeak
Let’s talk espeak
Say “Hello, World!” Is as easy as piping the generated audio into the command play:
$ espeak --stdout "Hello, World" | play -
Generate a Vorbis audio file with espeak
The pen mentioned above needs the audio file with Vorbis audio comression.
Small Vorbis samples can be generated directly with the command line only (use -o hello.ogg
to store the sample Vorbis encoded in a file):
$ espeak --stdout "Hello" | oggenc -o hello.ogg -
Longer text may be read from a text file:
$ espeak --stdout -f speech.txt | oggenc -o speech.ogg -
In case you don’t target English as your spoken language you can list your options with —voices=<language>
$ espeak --voices=de
Pty Language Age/Gender VoiceName File Other Languages
5 de M german de
6 de M german-mbrola-2 mb/mb-de2
6 de F german-mbrola-3 mb/mb-de3
6 de M german-mbrola-4 mb/mb-de4
6 de M german-mbrola-6 mb/mb-de6
7 de F german-mbrola-5 mb/mb-de5
7 de F german-mbrola-7 mb/mb-de7
and choose the language file of your choice with -v
.
espeak -v german --stdout “Guten Morgen” | oggenc -o oggs/
In combination with our Running a Docker Soundbox on Mac you can use a Docker base approach to test your sounds:
$ docker run -it -e PULSE_SERVER=docker.for.mac.localhost -v ~/.config/pulse:/home/tttool/.config/pulse -v $(pwd):/workspace --entrypoint=/bin/bash tttool -c "espeak --stdout 'Willkommen zur tiptoi Einheit - Bilanz' | play -"
For local experiments (on the host with all necessary tools installed locally) you can just run the bash command:
$ espeak -v german --stdout ‘Guten Morgen!’ | play -
It was a lot of fun playing around with the freshly discovered ventriloquist!