Your home at your fingertips

Sound & UI – Voice Announcement with SONOS and Google text-to-speech

Home >> Node-RED App Library

This flow demonstrates how to make Voice Announcements with SONOS speakers using Google TTS.

  • Google TTS – Pros: easy setup
  • Google TTS – Cons: robotic voice

To convert text the Google  ‘text-to-speech’ service is used.  The TTS converts an arbitrary text to an audio file, several languages and voices are supported. An audio file is the result of the operation. The audio files stored on the realKNX file system. The SONOS speaker downloads the audio file from the realKNX via HTTP. The HTTP server provides the audio file to the SONOS speaker.

The input to Google TTS in this flow is either

  • plain text or
  • SSML, Speech Synthesis Markup Language

SSML example


https://developers.google.com/actions/reference/ssml

<speak>
 Here are <say-as interpret-as="characters">SSML</say-as> samples.
 I can pause <break time="2s"/>.
 I can play a sound
 <audio src="https://actions.google.com/sounds/v1/animals/animal_bark_and_growl.ogg">didn't get your MP3 audio file</audio>.
 I can speak in cardinals. Your number is <say-as interpret-as="cardinal">10</say-as>.
 Or I can speak in ordinals. You are <say-as interpret-as="ordinal">10</say-as> in line.
 Or I can even speak in digits. The digits for ten are <say-as interpret-as="characters">10</say-as>.
 I can also substitute phrases, like the <sub alias="World Wide Web Consortium">W3C</sub>.
 Finally, I can speak a paragraph with two sentences.
 <p><s>This is sentence one.</s><s>This is sentence two.</s></p>
 </speak>


Required nodes

  • node-red-contrib-better-sonos

 

SONOS Google TTS

Download Codesound-ui-google-tts.json

How-to import: Video Tutorial