I saw many tts engines, like festival, espeak, etc.. I wanted to know if any of these could select the output device, like an USB sound device. If it's possible, what the command line to make it happens?
1 Answer
I don't have my Pi in reach right now, but you can do it like this: First, find out which playback devices you have. You can do this with aplay
:
$ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=PCH
HDA Intel PCH, ALC892 Analog
Default Audio Device
front:CARD=PCH,DEV=0
HDA Intel PCH, ALC892 Analog
Front speakers
surround40:CARD=PCH,DEV=0
HDA Intel PCH, ALC892 Analog
4.0 Surround output to Front and Rear speakers
...
This is for my Linux PC, but the Raspberry Pi will show something similar. Then tell you TTS tool to output to stdout, which is easy for espeak
. Pipe the output through aplay, with the specified device:
espeak "Hello world" --stdout | aplay -D 'default'
Instead of default
, you can use any of the listed device names.