Store and play wavenet voice message

This flow stores a custom Google Wavenet voice message locally and plays it on your Sonos and Google Cast devices.

Flow flow

(If you are satisfied with the standard node-red-contrib-cast voices and only use Google Cast speakers, this flow is not relevant for you.)


Copy the flow below to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option.

Remember to install the required nodes before importing this flow into Node-RED (check out Node types box on this page)

[{"id":"977be705.a26bc8","type":"tab","label":"Wavenet text-to-speech","disabled":false,"info":""},{"id":"7aa7dcbf.994d14","type":"inject","z":"977be705.a26bc8","name":"Add new","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":140,"wires":[["64e6dd8.1df2c24"]]},{"id":"64e6dd8.1df2c24","type":"function","z":"977be705.a26bc8","name":"spoken message here","func":"msg.payload = \"<emphasis>Someone rang the doorbell</emphasis><break time='100ms'/><emphasis level='strong'>Maybe it's pizza!</emphasis>\"\n\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":140,"wires":[["f1e69f1a.2c396"]]},{"id":"f1e69f1a.2c396","type":"wavenet","z":"977be705.a26bc8","name":"Wavenet","key":"","voice":"emma","rate":"1.0","pitch":"0","volume":"0","sample":"24000","encoding":"MP3","x":570,"y":140,"wires":[["791e231d.f4364c"]]},{"id":"791e231d.f4364c","type":"file","z":"977be705.a26bc8","name":"","filename":"/data/wavenet_test.mp3","appendNewline":true,"createDir":true,"overwriteFile":"true","encoding":"none","x":770,"y":140,"wires":[["a1bae999.6d08c8","f84c4b5.05347b8"]]},{"id":"3d185f6c.8435b","type":"http in","z":"977be705.a26bc8","name":"","url":"/wavenet_test.mp3","method":"get","upload":false,"swaggerDoc":"","x":160,"y":230,"wires":[["4c0f0610.c6a1c8"]]},{"id":"4c0f0610.c6a1c8","type":"file in","z":"977be705.a26bc8","name":"","filename":"/data/wavenet_test.mp3","format":"","chunk":false,"sendError":false,"x":390,"y":230,"wires":[["3f90c69d.cfbe2a"]]},{"id":"3f90c69d.cfbe2a","type":"http response","z":"977be705.a26bc8","name":"","statusCode":"","headers":{"content-type":"audio/mpeg"},"x":570,"y":230,"wires":[]},{"id":"963c8dcb.b0ac7","type":"comment","z":"977be705.a26bc8","name":"Wavenet voice - Sign in to Google Developer Console to get a Speech API key.","info":"","x":340,"y":100,"wires":[]},{"id":"e2c03496.f59628","type":"comment","z":"977be705.a26bc8","name":"store voice message locally","info":"","x":780,"y":100,"wires":[]},{"id":"7681ce8.21d7d3","type":"comment","z":"977be705.a26bc8","name":"Make local voice message available to smart speakers via http","info":"","x":290,"y":190,"wires":[]},{"id":"9eb5c4f6.9c86d8","type":"comment","z":"977be705.a26bc8","name":"Link to latest version of this flow: https://flows.nodered.org/flow/ac3d25616af3030bdc859762bd2e9e86","info":"","x":410,"y":40,"wires":[]},{"id":"631adbf6.2b8374","type":"cast-to-client","z":"977be705.a26bc8","name":"","url":"","contentType":"","message":"","language":"","ip":"192.168.3.67","port":"","volume":"","x":760,"y":340,"wires":[[]]},{"id":"830b58fd.c56708","type":"inject","z":"977be705.a26bc8","name":"Play","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":340,"wires":[["a1bae999.6d08c8","f84c4b5.05347b8"]]},{"id":"ee36e61c.5ff388","type":"comment","z":"977be705.a26bc8","name":"Play locally stored wavenet voice message","info":"","x":220,"y":300,"wires":[]},{"id":"a1bae999.6d08c8","type":"trigger","z":"977be705.a26bc8","op1":"{\"url\":\"http://192.168.3.62:1880/wavenet_test.mp3\",\"contentType\":\"audio/mp3\",\"volume\":70}","op2":"{\"volume\":30}","op1type":"json","op2type":"json","duration":"7","extend":true,"units":"s","reset":"","bytopic":"all","name":"tts + reset volume","x":510,"y":340,"wires":[["631adbf6.2b8374"]]},{"id":"f4345b77.7cb1d8","type":"comment","z":"977be705.a26bc8","name":"use your own speaker config or IP","info":"","x":770,"y":300,"wires":[]},{"id":"f84c4b5.05347b8","type":"change","z":"977be705.a26bc8","name":"tts + reset volume","rules":[{"t":"set","p":"payload","pt":"msg","to":"http://192.168.3.62:1880/wavenet_test.mp3","tot":"str"},{"t":"set","p":"volume","pt":"msg","to":"70","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":400,"wires":[["1e6db6dc.9dc389"]]},{"id":"7c37530f.932acc","type":"comment","z":"977be705.a26bc8","name":"use your own Node-RED IP","info":"","x":500,"y":300,"wires":[]},{"id":"1e6db6dc.9dc389","type":"sonos-universal","z":"977be705.a26bc8","confignode":"","compatibilityMode":false,"command":"group.play.notification","state":"","stateType":"str","name":"Sonos speaker","x":750,"y":400,"wires":[[]]}]

Flow Info

Created 4 years, 3 months ago
Updated 4 years, 1 month ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x1)
  • comment (x7)
  • file (x1)
  • file in (x1)
  • function (x1)
  • http in (x1)
  • http response (x1)
  • inject (x2)
  • trigger (x1)
Other

Tags

  • wavenet
  • google
  • cast
  • sonos
  • TTS
  • text-to-speech
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option