Understanding TTS settings for Sonos


#1

1) Give a description of the problem
Trying to understand the TTS options available with Sonos. I don’t understand the difference between “Speak Text”, “Speak Text and Resume” and “Speak Text and Restore”. I can’t find documentation on this anywhere

Similarly, I am seeking clarification on volume settings:
Adjust Level – does this mean raise the current level by x percent?
Set Level - does this mean to set the level at a certain level from scratch (not based on current level)?
SetLocalLevel - I have no idea what this does

2) What is the expected behaviour?
I’m assuming that this will announce that my toddler opened her bedroom door, then do nothing.

3) What is happening/not happening?
Last night, it announced at 4am that her door opened, but started blasting music after wards.

**4) Post a Green Snapshot of the piston![image|45x37]


#2

on my way to my computer…i’ll answer your questions…


#3

First of lets simplify your piston… A single TRIGGER and followed by 3 conditions in SAME IF BLOCK would work better.

IF Contact sensor 2 changes to OPEN (the main trigger)
Then
     **IF Time is between 6am and 7.45am**
     Then
     With 
     Music player 6, 1, 2, 
     Speak text "door just opened"
     **IF Time is between 8.45pm and 11pm**
     Then
     With 
     Music player 6, 1, 2, 3
     Speak text "door just opened"
     **IF Time is between 11pm and 6am**
     Then
     With 
     Music player 6, 2
     Speak text "door just opened"

I have sonos speakers in the house and SPEAK TEXT might fail to work sometimes…FYI
Set level to 50 - means between 0-100, set the level to 50…Regardles what it was before.
SetLocalLevel - I have no idea either. Never used it.
Adjust level - never needed. I’d like to just tell sonos what level I want…

Speak Text and Resume - SUPPOSED to speak your text and once it’s done, continue to play what ever it was playing before - But again FAILS to work most of the time.

In my experience, instead of speak text using PLAY TRACK worked much better.
There are many text to speech websites. I go to one of them, put the text and get mp3 download. I host that mp3 on a web hosting place and use the URL for play track.
Works like a charm. never fails.

Here is the website I use for text to speech
http://www.fromtexttospeech.com


#4

@ike2018 has made some excellent suggestions. :+1:

To elaborate a bit, I try to encourage new users to totally avoid using ELSE for a few months. (until you get familiar with how webCoRE processes, but even then, very sparingly) In the tens of thousands of pistons I have created, I use ELSE less than 1% of the time.

For example.

IF 
   X
   and
   Y
Then 
   Do stuff
ELSE 
   Do other things
END IF

When this piston executes, the ELSE block will run if:

  • X is true, and Y is false … or
  • X is false, and Y is true … or
  • both X & Y are false

Also, one other pointer, for the most part, we should never put a trigger (lightning bolt) inside another trigger. The likelihood that both will be true at the same instant is slim-to-none, so the inner trigger will never fire.

Ike’s example above keeps only one trigger (first line), and then the rest of the code is guided by conditions… Not triggers. This is usually my preferred method.


#5

Pro Tip:
Notice in my last post how the ELSE blocks run in 3 out of 4 possible outcomes. If I were to add another condition up top (IF X and Y and Z) then the ELSE would dominate 5 out of 6 possible outcomes.


I should probably mention that when using OR instead of AND, then the statistics get reversed.

IF 
   X
   *OR*        <-- the only line I changed
   Y
Then 
   Do stuff
ELSE 
   Do other things
END IF

When this piston executes, the ELSE block will only run if:

  • both X & Y are false

All other possible outcomes will run the THEN commands


Hopefully , these examples emphasize why I would avoid using ELSE entirely until you understand webCoRE’s logic at a deep level. Over 99.9% of code can be written without using ELSE at all. (it might actually be 100%)


#6

I agree… I have over 100 active pistons and not a single one uses ELSE…


#7

This is all very helpful, thank you all so much!! I will make the necessary adjustments. I have a domain that I use as a file server for my security videos, so I will use that to host files that announce my speech stuff and use “play track” instead. Thanks again!