Sonos: Long delay between playSound and Say

Before I issue a TTS command, I’d like to play a kind of beep on my Sonos speakers to attract attention. For whatever reason, there is a pause of 6 or even more seconds between the beep and the speech output.

I find this delay quite annoying because it is far too long. Does anyone have any idea how to solve this?

My setup looks like this:

say.items

String SayCommand <text>

say.rules (simplified)

rule "Say something"
when
	Item SayCommand received update
then
	var String audioSink = "sonos:PLAY5:miba"
	logInfo("say.rules", "Say: \"{}\" on audio sink [{}]", SayCommand.state, audioSink)
	playSound(audioSink, "doorbell.mp3")
	say(SayCommand.state, "voicerss:deDE", audioSink)
end

Call

SayCommand.postUpdate("Attention - this is the Say command")

I would say the total length of the pause including the is 20 seconds, which is the default setting for the notification sound length ( name of property translated from German!).
If you shorten that your tts notification migth get cut off at the end!

You could get around that by “mixing” the doorbell and the TTS sound into one file

1 Like

Thank you @opus for this explanation! That makes sense. So I understand that need a workaround to achieve my goal.

Can you give me a hint how to do this, please?

I’m sorry, but no.
If you have both soundfiles ( doorbell and TTS) and both are of the same type there could be a way. I’m using VoiceRSS, this service does store the files in a cache folder,m I have no idea about the other services.

Thank you, Jürgen. I am using VoiceRSS as well.

I have understood that it is not easy to play the sound and the spoken text one right after the other. If there are already generated (or cached) sound files they may be concatenated somehow. Is that right? However, this would not be a flexible solution, especially if the spoken text is generated dynamically.

Correct!

What a pity. Thank you for your support!

Hi Michael,
how did you solve this as I’m facing the same issue. I want to break the Radio-Stream, play notification sound, say warning and continue playing the Radio Stream. Unfortunately the delay between the playSound() and say() is too long so say interrupts the Radio Stream.
Thanks for any hint
Frieso

Hi Frieso @frieso,

unfortunately I did not pursue the matter further, because I (so far) did not see a practicable solution. I hope you can find something!