TTS interface (text to speech)



Last time I will bother you. Below is the wireshark data on a successful Environment -> Soundbar -> PC (media streaming capability). It worked!

Speaker = Samsung HW-MS650 Soundbar
Hubitat - Speaker using driver "Samsung Soundbar TTS" (a small test driver).
Comms Path:
	Environment --> Speaker DMR port (SOAP request)
	Speaker --> PC, HEAD request
	PC --> Speaker, OK response
	Speaker --> PC, HEAD request (yes, a repeat)
	PC --> Speaker, OK response
	Speaker --> PC, GET request
	PC --> Speaker, Partial Content
	Note:	Somewhere after accepting file, Speaker returned respons
		to SetAVTransport and Play commands.

Wireshark HTTP Tree Information for Successful URI Playback from Windows Media Streamer
=====INITIAL SEQUENCE==============================================
Speaker --> PC HEAD Request
    HEAD /WMPNSSv4/3656398341/0_N182YWM0YzE2YS0xNjgyNw.mp3 HTTP/1.1\r\n
    Host:\r\n 1\r\n

PC --> Speaker Response
    HTTP/1.1 200 OK\r\n
    Content-Length: 10076\r\n
    Content-Type: audio/mpeg\r\n
    Last-Modified: Thu, 07 Jun 2018 12:06:10 GMT\r\n
    Server: Microsoft-HTTPAPI/2.0\r\n
    Accept-Ranges: bytes\r\n
    ContentFeatures.DLNA.ORG: DLNA.ORG_PN=MP3X;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000\r\n
    Scid.DLNA.ORG: 158878508\r\n
    TransferMode.DLNA.ORG: Streaming\r\n
    Date: Sat, 09 Jun 2018 13:42:22 GMT\r\n

=======REPEATED OF INITIAL SEQUENCE===================================
NOTE:  The initial sequence repeated (every time)

=======SECOND MESSAGE SEQUENCE =====================================
Speaker --> PC GET Request
    GET /WMPNSSv4/3656398341/0_N182YWM0YzE2YS0xNjgyNw.mp3 HTTP/1.1\r\n
    Range: bytes=0-\r\n
    User-Agent: samsung-agent/1.1\r\n
    Accept: */*\r\n
    Accept-Encoding: deflate, gzip\r\n

PC --> Speaker Response
    HTTP/1.1 206 Partial Content\r\n
    Content-Length: 10076\r\n
    Content-Type: audio/mpeg\r\n
    Last-Modified: Thu, 07 Jun 2018 12:06:10 GMT\r\n
    Server: Microsoft-HTTPAPI/2.0\r\n
    Accept-Ranges: bytes\r\n
    Content-Range: bytes 0-10075/10076\r\n
    Scid.DLNA.ORG: 158878508\r\n
    TransferMode.DLNA.ORG: Streaming\r\n
    Date: Sat, 09 Jun 2018 13:42:22 GMT\r\n
NOTE:  Listed "Media type: audio/mpeg (10076 bytes)


ok, not following along here, we're trying to figure out if the lack of Hubitat providing a content type in the response to the speakers get request to the tts url is causing the issue.
What I see in the above is that it does work (for whatever reason) with content type "audio/mpeg".
What does this same trace look like when you use a Hubitat tts url?


Mike, Thanks for trying.

I can't get the trace between the Soundbar and the Hubitat device (my system does not have a promiscuous mode WiFi adapter and even on the LAN adapter, the PC has to be one of the devices for the capture to work). I use wireshark, so if there is one that does LAN capture between all devices?



Ok, I can add the content type and do some internal testing, so long as it doesn't break sonos, and it shouldn't, I'll add it to our hub code.
If that doesn't fix the issue, I'm out of ideas...


OK, content type audio/mpeg has been added to the tts response and will be in the next release, as I said, this is just a wild guess as to what the problem is.


You are data limited and I understand! You've already done above and beyond. I will test ASAP after update.




Mike, it is up to you. I would be happy to slim up and test the Samsung Multiroom Speaker device handler to replicate the Sonos Speaker API you currently have - none of the extra features. Why - give a consistent set of speaker drivers tested with an agreed upon Selection app.

I would then use child devices to add-in the unique functionality in three packages: basic (source select, equalizer), internal player control (presets, shuffle/repeat), and grouping.

Does that seem like a good idea or a waste of time?

PS - if you want any tech data on these speakers, I actually know quite a bit and am willing to share.


that would make it more attractive to include in future builds, though I can't give you any idea on when or if that might be, more of a when than an if probably.



Tested tts on latest version (just returned from a long trip). Did not work; however, please close issue. Not worth the time/effort on your part.





It is literally a "feature" of the speaker AVTransport handler where it is apparently looking for something that is not present in your output; therefore, not actually connecting to/playing the URL. I would say the Samsung Soundbar is the odd-system-out, not Hubitat.


Lots of other options that don't take too much to get going. I'm using VLC player for a door open tone now, but I was using it for TTS and it worked really well. Also, if you have a Google Home or Mini, the Google Assistant Relay port is really nice and gives you a choice of voices.


Appreciate the comment.

History. The issue is with some code I am writing. It works for the Samsung Multi-room speakers, but not the soundbar. I can do TTS with AWS fine on the speakers. Have to use another TTS service for the soundbar. When used, the sound will interrupt the playing steam, play the notification text, and then resume the playing stream. Speakers are synced so that the same can be played throughout the house.

PS - This is not for me. It is for other users of the devices - I want it to be as easy as possible for them to be able to utilize the functions of the speakers-soundbars; including TTS, playing channels, and controlling the device settings. It is a lot of code and all works well except tts on the soundbar.


Thanks for the background. Hope you figure that one out. Great of you to beat your head against the wall for the good of the community! :grin:


I know we can set the TTS voice globally, but is there a way to set it "locally" in a rule for example
Something like:
speak "this is a test" using Sally voice or "this is another test" using Matthew voice

P.S. I have both Sonos speaker and Google Home


Yes you can in the code that calls the textToSpeech.

Map textToSpeech(String stringToBeSynthesized, String voice = null)

The English, US voices are:

  • Ivy
  • Joanna
  • Kendra
  • Kimberly
  • Salli
  • Joey
  • Justin
  • Matthew


"In the Code"? I have to write an app?

The only available commands I have are these (Sonos speaker)


No, then. You are sort of out of luck since the Sonos interface does not have a voice parameter input during speak nor playText.

I would put in a feature request for the Capability "SpeechSynthesis" by adding
command "setVoice", [enum]
attribute ttsVoice, "string"