Announcement

Collapse
No announcement yet.

TTS Speaking

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    TTS Speaking

    Hi

    I was hoping for some advice.
    I have eight zones.

    Previously I have events which Switch the Line In of a Speaker, then I have HomeSeer Speak to a Line In of a ZP120.
    There is a 1-2 second delay for Brian to speak.


    I have just tried the $SONOS$TTS$:Bathroom and noticed a 5-6 second delay and a different voice, Ann?


    My question is, is there a better way of doing this?

    Kind Regards
    Chris
    Attached Files

    #2
    Originally posted by smokeycoles View Post
    Hi

    I was hoping for some advice.
    I have eight zones.

    Previously I have events which Switch the Line In of a Speaker, then I have HomeSeer Speak to a Line In of a ZP120.
    There is a 1-2 second delay for Brian to speak.


    I have just tried the $SONOS$TTS$:Bathroom and noticed a 5-6 second delay and a different voice, Ann?


    My question is, is there a better way of doing this?

    Kind Regards
    Chris
    Chris, did you check the help file how to set up TTS? This $SONOS$TTS$:Bathroom is probably not what you have in mind. :bathroom here doesn't look right, not sure what you had in mind. TTS is actually not using any of your speaker clients. Can you post a screen shot of the linkgroup table as well and the event you created.

    When you use TTS actually Window's Text to Speech settings are used so check which voice is your standard voice. You can overwrite the standard voice by embedding sapi tags (do a search on syntax).

    Dirk

    Comment


      #3
      I did read it, but accept I probably got it wrong.

      I have attached the trial I did yesterday.
      I just hit the Run Event button.


      If I have got it very wrong, please let me know what I have done and will try again. Would be good to stop using these events.

      Just to explain what I am currently doing,
      my HS Server speaker jack feeds into my Master Bedroom Connect Amp, I then use an event to switch to the audio in. For example I am running text through a bathroom speaker using the line in from the master bedroom.

      I did this a long time back, either because I was having problems getting it to go back to music after speaking (I think the webpage for the playlist use to lock up - red lines would appear through all the buttons) or because it was slow. I can't remember which error made me come up with my method... I now wonder if I had it wrong, or there was a bug in the release. But if I can make it less complex and try TTS correctly, I'd like that.

      Also for some reason unknown to me TV-Room_RF is the stereo pair for the TV Room. Unnamed Room is the stereo pair for the living room.
      Attached Files

      Comment


        #4
        Originally posted by smokeycoles View Post
        I did read it, but accept I probably got it wrong.

        I have attached the trial I did yesterday.
        I just hit the Run Event button.


        If I have got it very wrong, please let me know what I have done and will try again. Would be good to stop using these events.

        Just to explain what I am currently doing,
        my HS Server speaker jack feeds into my Master Bedroom Connect Amp, I then use an event to switch to the audio in. For example I am running text through a bathroom speaker using the line in from the master bedroom.

        I did this a long time back, either because I was having problems getting it to go back to music after speaking (I think the webpage for the playlist use to lock up - red lines would appear through all the buttons) or because it was slow. I can't remember which error made me come up with my method... I now wonder if I had it wrong, or there was a bug in the release. But if I can make it less complex and try TTS correctly, I'd like that.

        Also for some reason unknown to me TV-Room_RF is the stereo pair for the TV Room. Unnamed Room is the stereo pair for the living room.
        Chris;

        Dirk will likely answer in more detail, but let me try to explain linkgroups. In your screenshot:

        Click image for larger version

Name:	tts2.jpg
Views:	1
Size:	23.9 KB
ID:	1190354

        To speak to this Linkgroup you would use $SONOS$TTS$

        It will only speak to the Bathroom client and will not set the volume or un-mute it if muted.

        In Dirk's plug-in, he wanted the Linkgroups to do all the heavy lifting. When you send a TTS to linkgroup, the plug-in will store the current status and grouping of every player, then it will build a new group based on the Linkgroup settings, send the TTS to it, then return all Sonos clients to the state and grouping they were in prior to the announcement. With 10 clients in my system, this process takes a total of 5-10 seconds on top of the time to make the announcement. It takes about 2-3 seconds before the announcement starts, then another 5+ seconds to return the clients to what they were doing.

        You build a Linkgroup for each specific purpose. You have the ability to determine the source client for the Linkgroup, in your screenshot it is the Bathroom Sonos. You can also select the Line-in on that client as the source if it has one. This would be if you were going to use that input to play to a group, it is not to be used when sending a TTS to that client. Then you can set the destination clients for the Linkgroup and individually set the volume and mute status of each destination. For illustration here are two different Linkgroups that I use

        Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	59.0 KB
ID:	1190355

        They are essentially the same except for the levels. I use $SONOS$ALL$ for household announcements and $SONOS$ALERT$ for warnings and alerts. Both of them speak to all clients except for the deck outside the master bedroom. No matter what is playing on any of the clients, what their volume setting is or if they are muted, an announcement sent to the Linkgroup will store the current state of all the clients, build the announcement group, set the volumes and mute status for all clients and make the announcement. At the conclusion of the announcement all clients will return to the stored status prior to the announcement. It is very thorough and works reliably 99% of the time. There are times it can hiccup, but it is rare. It also takes about 5-10 minutes after the plug-in is started for all of the clients to be rediscovered and accessible to the plug-in.

        I have about a half dozen Linkgroups set up for specific announcement or client playback scenarios. We don't send announcements to the Master Bedroom and we reduce the alert volumes at Night. I do not use the plug-in much for normal playback of the clients, mostly for TTS announcements and reporting the current status of each client to HomeSeer for use in events.

        In your Linkgroup above, set the volume of the Bathroom to 50 and select Mute Override. Then change your event to speak to $SONOS$TTS$ and test it. It should pause the bathroom client if it is playing, remove it from any group in which it might be included, play the announcement, then return the Bathroom client to exactly where it was prior to the announcement.
        HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

        Comment


          #5
          Originally posted by smokeycoles View Post
          I did read it, but accept I probably got it wrong.

          I have attached the trial I did yesterday.
          I just hit the Run Event button.


          If I have got it very wrong, please let me know what I have done and will try again. Would be good to stop using these events.

          Just to explain what I am currently doing,
          my HS Server speaker jack feeds into my Master Bedroom Connect Amp, I then use an event to switch to the audio in. For example I am running text through a bathroom speaker using the line in from the master bedroom.

          I did this a long time back, either because I was having problems getting it to go back to music after speaking (I think the webpage for the playlist use to lock up - red lines would appear through all the buttons) or because it was slow. I can't remember which error made me come up with my method... I now wonder if I had it wrong, or there was a bug in the release. But if I can make it less complex and try TTS correctly, I'd like that.

          Also for some reason unknown to me TV-Room_RF is the stereo pair for the TV Room. Unnamed Room is the stereo pair for the living room.
          It actually looks pretty good. I think your misinterpretation is the :bathroom use in the speaker client string. The only thing of importance is $SONOS$ so the PI knows it is an event meant for it, the $TTS$ (case sensitive!!) which tells the PI which linkgroup to use, the last thing (where you use :bedroom) should be a speakerclient name. This part in HS3 is not really of relevance anymore as HS3 is now using a text-to-speech subsystem versus a speaker client; it has relevance only if you have a "post-announcement" setting, which you don't have.

          So it would be enough to write $SONOS$TTS$ .

          If you want to send your speech to another player (not bedroom) you need to make more linkgroups with different configurations.

          If you want to use another voice use a sapi tag. Here are some links
          https://forums.homeseer.com/showthre...pi#post1290927
          https://forums.homeseer.com/showthread.php?p=1290902

          Last but not least the player names; here's what's happening. Whenever you pair Sonos players, be it with a playbar or as a stereo pair, Sonos gives both players the same name. This is very confusing for the users of the PI because they now see multiple players with the same name and they can't figure out which to chose if they want events to happen on a specific player. Moreover, you wouldn't have to specify both players to send an announcement to the pair, picking one is enough. So what the PI does, it keeps the name of the Sonos player BEFORE it got paired, so your unnamed room player, shows it because you never gave it a name and paired it, the PI remembers the original name. So if you don't like it, unpair them, assign a name and pair them again; all while the PI is running!!! Now if the pairing happened BEFORE the PI discovered the players, so far I have not found anyway to retrieve the old player name, so if the PI discovers a paired player set for the first time, they still used to show up with the same name. If it was paired with a playbar you now had 3 players with the same name. So I added some code to give then somewhat unique names by adding a suffix.

          If linking and playing the announcement takes 5~6 seconds for a single player, you should take a trace because that wouldn't be normal. If you group all your players, that's what is likely to happen as it require a lot of commands and ack to go around to group many players.

          Hope this gives you some insight.

          Dirk

          Comment


            #6
            I am having just a little trouble with my SAPI tag.

            What I have input into the test box is this:

            <voice required="IVONA 2 Brian - British English male voice [22kHz]" />I am testing my speech, this is what I sound like from the bathroom.


            Am I doing something wrong?

            Comment


              #7
              Originally posted by smokeycoles View Post
              I am having just a little trouble with my SAPI tag.

              What I have input into the test box is this:

              <voice required="IVONA 2 Brian - British English male voice [22kHz]" />I am testing my speech, this is what I sound like from the bathroom.


              Am I doing something wrong?
              What do you get? Wrong voice, no voice ?
              Do you see errors in the log?
              I think you close off the tag with > not />
              If that's not it my second reaction would be, is this the right name (IVONA 2 Brian - British English male voice [22kHz]) or is it just (IVONA 2 Brian)?

              Which version of the PI are you using right now? It only works in the R3.1.x.x. version of the PI

              Dirk

              Comment


                #8
                Ok thank you, got it.

                So I have run my tests.

                Test 1 - HS3 Event based switching of Line In works in 01:18 sec
                Test 2 - Instant <1sec but only comes out of my 2 HSTouch tablets?
                Test 3 - Correct Speaker but TTS takes 04:51 sec


                Please would you look at test 2, I wonder if I am doing something wrong?

                Thanks
                Chris
                Attached Files

                Comment


                  #9
                  Originally posted by dcorsus View Post
                  Brian - British English male voice [22kHz]) or is it just (IVONA 2 Brian)?
                  I think the short name is correct.
                  HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

                  Comment


                    #10
                    Sorry I meant why the input is going out of the tablets and not the bathroom speaker.

                    If I understood correctly.
                    Task 2, switches the bathroom speaker to the master bedroom line-in? (As I selected the use Audio-Input)?

                    Comment


                      #11
                      Originally posted by smokeycoles View Post
                      Sorry I meant why the input is going out of the tablets and not the bathroom speaker.

                      If I understood correctly.
                      Task 2, switches the bathroom speaker to the master bedroom line-in? (As I selected the use Audio-Input)?
                      Dirk will have to weigh in, but I am certain the Line In is not compatible with TTS. You can use Line In in a Linkgroup to send audio that is sent to the Line In to all of the other clients in a group, but if you send TTS to a Linkgroup set for Line In it will fail. TTS generates an audio file that is forwarded to the various clients directly from the plug-in.

                      Also it is normal for it to take 2-3 seconds for the plug-in to save the status of all clients, build the Linkgroup and begin an announcement. Your 4-5 seconds may be normal. Generally if you send a TTS announcement to a linkgroup, the audio will be queued to play as soon as the plug-in has set up the linkgroup. I have seen it take longer to build a linkgroup if the clients are already grouped or if they are playing multiple audio streams.
                      HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

                      Comment


                        #12
                        Ok great I see, well I use a lot of SONOS for feedback on button pressing and 5 seconds is just to long, but Dirk - don't get me wrong its brilliant and I think for a free plugin, its superb. Well you know because of the effort I put into my HSTouch for SONOS and Spotify.

                        So I want to stick with my manual switching events but remove the event element and instead revert to a called script, it makes everything neater in the Event Editor.

                        To be warned - I am no scripter, so I imagine my syntax is wrong, shocking or awful.

                        This is what I have so far:

                        Code:
                        '---------------------------------------------------------------------------
                        ' Public Variables
                        '---------------------------------------------------------------------------
                        
                        
                        
                        '---------------------------------------------------------------------------
                        ' Main Method
                        '---------------------------------------------------------------------------
                        Sub Main(parm As Object)
                        End Sub
                        
                        
                        
                        '---------------------------------------------------------------------------
                        ' Speak Method
                        '---------------------------------------------------------------------------
                        Sub speakSomething(speakername, volume, tts)
                        
                        	Dim speakernameID As Integer
                        	Dim speakervolumeID As Integer
                        	Dim getOriginalVolume As Integer
                        
                        	Select Case speakername
                        		Case bathroom
                        					speakernameID = 11
                        					speakervolumeID = 77
                        		Case masterbedroom
                        					speakernameID = 8
                        					speakervolumeID = 22
                        		Case livingroom
                        					speakernameID = 9
                        					speakervolumeID = 40
                        		Case frontroom
                        					speakernameID = 292
                        					speakervolumeID = 321
                        		Case downstairs
                        					speakernameID = 293
                        					speakervolumeID = 339
                        		Case frontdoor
                        					speakernameID = 12
                        					speakervolumeID = 95
                        		Case else
                        					hs.WriteLogEx("SONOS TTS", "Destination Speaker Incorrect", "#008000")
                        	End Select
                        	
                        	' Get speakerNameNumber original volume
                        		getOriginalVolume = hs.DeviceValueEx(speakervolumeID)
                        
                        	' Set speakerNameNumber to pause
                        		hs.SetDeviceValueByRef(speakernameID, 1003, True)
                        
                        	' Set speakerNameNumber to new volume
                        		hs.SetDeviceValueByRef(speakervolumeID, volume, True)
                        
                        	' Set speakerNameNumber to master bedroom audio input 
                        		?????? possibly run an event?
                        
                        	' Set speakerNameNumber to resume
                        		hs.SetDeviceValueByRef(speakernameID, 1001, True)
                        
                        	' Speak $tts to HOMEAUTOMATION:DEFAULT speaker - not sure how to do this		?????
                        		hs.Speak(tts)
                        
                        	' Set speakerNameNumber to original volume
                        		hs.SetDeviceValueByRef(speakervolumeID, getOriginalVolume, True)
                        		
                        	' Set speakerNameNumber to stop
                        		hs.SetDeviceValueByRef(speakernameID, 1002, True)
                        End Sub

                        Comment


                          #13
                          Originally posted by smokeycoles View Post
                          Sorry I meant why the input is going out of the tablets and not the bathroom speaker.

                          If I understood correctly.
                          Task 2, switches the bathroom speaker to the master bedroom line-in? (As I selected the use Audio-Input)?
                          In contradiction what I wrote above, if you select the line-in option it is crucial that you add the right speaker client, ie. the speaker client on the device that is connected to your line-in. So in test 2, because you didn't specify a speaker client it goes to the default one, so you have to fix that.

                          As I said, 5 seconds (for start of announcement!!) for a single player is not normal but if you want me to look at it, you must take a trace. The only thing I can think off is that you have a large amount of tracks in the queue and the saving of that queue (either source of destination player) takes too long.
                          My announcements for a single player start < 2 seconds. Maybe a resource issue?

                          Dirk

                          Comment


                            #14
                            Originally posted by smokeycoles View Post
                            Ok great I see, well I use a lot of SONOS for feedback on button pressing and 5 seconds is just to long, but Dirk - don't get me wrong its brilliant and I think for a free plugin, its superb. Well you know because of the effort I put into my HSTouch for SONOS and Spotify.

                            So I want to stick with my manual switching events but remove the event element and instead revert to a called script, it makes everything neater in the Event Editor.

                            To be warned - I am no scripter, so I imagine my syntax is wrong, shocking or awful.

                            This is what I have so far:

                            Code:
                            '---------------------------------------------------------------------------
                            ' Public Variables
                            '---------------------------------------------------------------------------
                            
                            
                            
                            '---------------------------------------------------------------------------
                            ' Main Method
                            '---------------------------------------------------------------------------
                            Sub Main(parm As Object)
                            End Sub
                            
                            
                            
                            '---------------------------------------------------------------------------
                            ' Speak Method
                            '---------------------------------------------------------------------------
                            Sub speakSomething(speakername, volume, tts)
                            
                                Dim speakernameID As Integer
                                Dim speakervolumeID As Integer
                                Dim getOriginalVolume As Integer
                            
                                Select Case speakername
                                    Case bathroom
                                                speakernameID = 11
                                                speakervolumeID = 77
                                    Case masterbedroom
                                                speakernameID = 8
                                                speakervolumeID = 22
                                    Case livingroom
                                                speakernameID = 9
                                                speakervolumeID = 40
                                    Case frontroom
                                                speakernameID = 292
                                                speakervolumeID = 321
                                    Case downstairs
                                                speakernameID = 293
                                                speakervolumeID = 339
                                    Case frontdoor
                                                speakernameID = 12
                                                speakervolumeID = 95
                                    Case else
                                                hs.WriteLogEx("SONOS TTS", "Destination Speaker Incorrect", "#008000")
                                End Select
                                
                                ' Get speakerNameNumber original volume
                                    getOriginalVolume = hs.DeviceValueEx(speakervolumeID)
                            
                                ' Set speakerNameNumber to pause
                                    hs.SetDeviceValueByRef(speakernameID, 1003, True)
                            
                                ' Set speakerNameNumber to new volume
                                    hs.SetDeviceValueByRef(speakervolumeID, volume, True)
                            
                                ' Set speakerNameNumber to master bedroom audio input 
                                    ?????? possibly run an event?
                            
                                ' Set speakerNameNumber to resume
                                    hs.SetDeviceValueByRef(speakernameID, 1001, True)
                            
                                ' Speak $tts to HOMEAUTOMATION:DEFAULT speaker - not sure how to do this        ?????
                                    hs.Speak(tts)
                            
                                ' Set speakerNameNumber to original volume
                                    hs.SetDeviceValueByRef(speakervolumeID, getOriginalVolume, True)
                                    
                                ' Set speakerNameNumber to stop
                                    hs.SetDeviceValueByRef(speakernameID, 1002, True)
                            End Sub
                            Confucius asked: "ask yourself this, why do you think your script will be faster than the PI code, once you start coding very similar actions the PI takes?"

                            The delays are NOT in the PI, the delays are caused by the players and goes up the more players you have. Moreover, blasting the player too quickly with commands and commands will get lost. Moreover, and here's the irony, you setting the HS devices IS calling the PI, which is talking to the players which takes the same or more time

                            So if you don't care about saving what the players are doing, in any configuration, you can do this with a few commands and probably reasonably fast. HOWEVER, players tend to get grouped, have specific volume settings and once you begin scripting all those permutations I guarantee you your script will much longer to execute that what you have now. If you don't care about state, stick to what event you had, it is fast and straight forward. If you do care about state of involved players, find out why it takes 5 seconds to start, if you don't solve that, scripting is not the solution and more likely, Sonos might not be the solution if you look for sub-second responses.

                            Dirk

                            Comment


                              #15
                              That is some good feedback, thank you.


                              You are right I do regret certain elements of SONOS, there are a lot of limitations with it. That said - it's in now, and very happy with this plugin - it integrates smoothly in my HSTouch now. I also do like how the whole SONOS music selection works, I love it.


                              I appreciate what the linkgroup is doing, for me I use my SONOS for a lot of button pressing feedback, I also very very rarely grouping devices. I also don't mind about the playlist being lost, because I use Spotify - the playlists are long and randomised. I probably wouldn't even notice listening to the same track twice. I also appreciate that it takes a few seconds for actual SONOS via the SONOS app to build/deconstruct groups so the plugin can't become faster when the hardware is not fast and the API linkgroups have a larger scope than what my limited script (which just emulates my events I've done).


                              So I think I use it differently to a lot of people, maybe make a suggestion here for a feature to be added to the bottom of the request list. The ability to have a tick box on the linkgroup config, which allows bypassing the link group checks and the storing the playlists, and possible other options.

                              Thanks Dirk & Randy for the help
                              Once I've done it, I will upload.
                              Chris

                              Comment

                              Working...
                              X