When I run a audio file with like mpg321 or aplay or sox or even in TTS's (Text to speak) audio only outputs correctly from the second time I reproduce the audio file...

per example in Text to speech: If write "Hello World!" it only speaks "orld" or if I write "you are a good boy" it only speaks "a good boy"... Why?

How can I fix this?

in TTS's this happens with all TTS: espeak, Google Api, VoiceRSS Api, etc... and happens in my old raspberry (Raspbian) too , not only in my Ubuntu (14.04.1 LTS)

I guess is because audio engine or something like that has a delay of 0.5 - 2 sec to start. And then skips the fisrt second or two of the audio.

And if I run the same audio twice or triple, etc , from the second time it runs well, but only if I am quickly...

I need it for Text to Speak.

Both Raspberry Pi and Ubuntu Machine are connected by HDMI.

How can I solve it? To speak all the words? And the audios from the begin of beginnings?

2 Answers 2


Your output device which you've connected via HDMI needs a couple of seconds to synchronize to the datastream it starts receiving from your system. You could look into adding a couple of seconds of silence first, or to continually play silence during your application to keep the synchronization going, and then mixing in the TTS output when that's needed.

EDIT: Seems related to this question, the suggestions there may also help: askubuntu.com

  • Thanks, How can I add A couple of silence to this: #!/bin/bash; say() { local IFS=+; mpg321 "http://api.voicerss.org/?src=$*"; }; say $* Feb 13, 2015 at 12:48
  • Can you tell me how I can add silence in this code please: gist.github.com/DiogoSaraiva/aa0dbf6cb95fa642d223 Feb 13, 2015 at 12:55
  • 1
    I have no experience with TTS, but won't adding spaces translate into silence? It looks like you can specify what audio format that API should return, so you could record some silence in that same format and then first play that, and then do the say() call.
    – wurtel
    Feb 13, 2015 at 13:00
  • please help, I tryed to add spaces, a silence, a tone before and didn't worked.... :( Feb 13, 2015 at 14:12
  • 1
    Have you tried the suggestions in the askubuntu.com link?
    – wurtel
    Feb 13, 2015 at 14:56

Opening pavucontrol will leave the synchronization open, so just start it when you want to do TTS.

NOTE: On my system having it open prevents me from starting SPDIF passthrough(i.e. Dolby Digital) but closing it and waiting a few seconds before starting the passthrough makes them work.

  • This issue has been fixed for me in newer Fedora Cora releases.
    – jamie
    May 16, 2023 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .