Adventures in Speech Synthesis

Can they make audio output on Linux any more complicated?  It appears that even in the 21st century, they can…

So, I added a little speaker to the USB audio on the robot today, and wanted to get it talking.

Theoretically, this should have been as easy as running

espeak "this is some text to speak"

from the command line.

Yeah. Right. Easy.

What I actually had to do was the following:

create the file ~/.asoundrc to tell it to use audio output 1 rather than 0 (the onboard Beaglebone Black audio via HDMI, which has nothing connected in this case)

pcm.!default {
type hw
card 1
}

ctl.!default {
type hw
card 1
}

Then, ensure pulseaudio -D is running for the current user.

Finally, pipe the espeak output via aplay to get it to the right device, seeing as espeak tries to use jack, which for some fucking reason insists on screwing around with dbus via $DISPLAY (and no, I do not want a bloody X server running on an embedded linux board)

espeak "this is some text to speak" --stdout |aplay -D 'pulse'

Presumably, like any other piece of software not written by a moron, espeak actually does have an option to specify the output audio device somewhere and bypass this crap called “jack”.  However, if it does I cannot locate it *anywhere*.

Still. Problem solved, via three other indirect steps, as usual.

Leave a Reply

Your email address will not be published. Required fields are marked *