Ankündigung

Einklappen
Keine Ankündigung bisher.

Text To Speech with Amazon Polly and Sonos

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    Text To Speech with Amazon Polly and Sonos

    Hello,
    i share my flow.
    It uses Amazon Polly and Sonos to do TTS, so you need to install this (https://www.npmjs.com/package/node-r...trib-polly-tts) and this (https://www.npmjs.com/package/node-r...b-better-sonos)
    You need a free Amazon AWS subscription ad a Sonos stuff.
    How to use:
    Setup the Polly node, by adding your amazon ID
    Setup the Sonos node by selecting your sonos device.
    Click the "Put some queue" node.
    The interesting thing, ist that this flow buffers the text to be speeched out. You can send multiple subsequently speech texts and it'll read one text next to each other.
    Enjoy


    [{"id":"cddca8d.0dbc858","type":"tab","label":"Voic e alert SONOS Watson","disabled":false,"info":""},{"id":"4293f28 0.cb8afc","type":"http in","z":"cddca8d.0dbc858","name":"HTTP in","url":"/tts/tts.mp3","method":"get","upload":false,"swaggerDoc ":"","x":90,"y":300,"wires":[["7b52b45e.a20d4c"]]},{"id":"c44b6e92.dbfbf","type":"http response","z":"cddca8d.0dbc858","name":"","statusC ode":"","headers":{},"x":1010,"y":300,"wires":[]},{"id":"bfb4e804.10c568","type":"file in","z":"cddca8d.0dbc858","name":"Leggo file Polly","filename":"","format":"","chunk":false,"se ndError":false,"x":500,"y":300,"wires":[["a43c1841.f04958"]]},{"id":"a43c1841.f04958","type":"change","z":"cdd ca8d.0dbc858","name":"prepare response","rules":[{"t":"set","p":"headers['Content-Disposition']","pt":"msg","to":"attachment; filename=tts.mp3","tot":"str"}],"action":"","property":"","from":"","to":"","reg" :false,"x":850,"y":300,"wires":[["c44b6e92.dbfbf"]]},{"id":"52f955be.75293c","type":"inject","z":"cdd ca8d.0dbc858","name":"Auto Start","topic":"","payload":"true","payloadType":" bool","repeat":"","crontab":"","once":true,"onceDe lay":"2","x":110,"y":420,"wires":[["4511f6d1.e10a58"]]},{"id":"c0493f6f.b878c","type":"comment","z":"cdd ca8d.0dbc858","name":"Dummy HTTP server for the tts.mp3 requested by Sonos Node","info":"","x":250,"y":260,"wires":[]},{"id":"c3049fc6.89321","type":"polly","z":"cddca 8d.0dbc858","name":"","voice":"17","ssml":false,"d ir":"/tmp","config":"82e06d8e.ab227","x":530,"y":580,"wi res":[["6558b802.6a7158"],[]]},{"id":"7b52b45e.a20d4c","type":"function","z":"c ddca8d.0dbc858","name":"Read Querystring","func":"// Imposto il nome del file da mettere in oda\n// prendendolo dal querystring "f"\nmsg.filename=msg.payload.f;\nreturn msg;\n","outputs":1,"noerr":0,"x":290,"y":300,"wir es":[["bfb4e804.10c568"]]},{"id":"2c28d023.38f19","type":"better-sonos-status","z":"cddca8d.0dbc858","confignode":"3bce7f 52.6863a","name":"","x":500,"y":420,"wires":[["8c7b6010.9e6a"]]},{"id":"75845af0.fc0464","type":"inject","z":"cdd ca8d.0dbc858","name":"Manual stop","topic":"","payload":"false","payloadType":" bool","repeat":"","crontab":"","once":false,"onceD elay":"","x":110,"y":480,"wires":[["4511f6d1.e10a58"]]},{"id":"6558b802.6a7158","type":"function","z":"c ddca8d.0dbc858","name":"Querystring manipulation","func":"msg.payload={songuri:"http://192.168.1.16:1880/tts/tts.mp3?f=" + encodeURI(msg.file)};\nreturn msg;","outputs":1,"noerr":0,"x":750,"y":580,"wires ":[["5b77cdb5.c57414","bc07502b.cf7c7"]]},{"id":"5b77cdb5.c57414","type":"better-sonos-queue","z":"cddca8d.0dbc858","confignode":"3bce7f5 2.6863a","songuri":"","position":"directplay","pos itioninqueue":"0","name":"SONOS queue","x":1040,"y":580,"wires":[[]]},{"id":"bc07502b.cf7c7","type":"better-sonos-control","z":"cddca8d.0dbc858","confignode":"3bce7 f52.6863a","name":"Volume","mode":"","track":"","v olume":"volume","volume_value":"20","x":1020,"y":6 40,"wires":[]},{"id":"4511f6d1.e10a58","type":"trigger","z":"cd dca8d.0dbc858","op1":"true","op2":"0","op1type":"b ool","op2type":"str","duration":"-1","extend":false,"units":"s","reset":"false","byt opic":"all","name":"","x":300,"y":420,"wires":[["2c28d023.38f19"]]},{"id":"383ee1a1.38a37e","type":"function","z":"c ddca8d.0dbc858","name":"Buffer","func":"// This function handles TTS msg queues \n// If it receives a true payload, it sends the next item in the buffer\n// otherwise it stores the msg in the buffer\n\n// Read array of incoming messages\nvar aMessageQueue = flow.get('aMessageQueue')||[]; // Default empty array\n\nif (msg.payload===true) {\n if (aMessageQueue.length>0) {\n // Send next item in the array\n var sMsg=aMessageQueue[0];\n // Remove the TTS message from the queue\n aMessageQueue.splice(0,1);\n // Send the message\n node.send({payload:sMsg});\n }\n}else\n{\n // Add message to the queue\n aMessageQueue.push(msg.payload);\n}\nflow.set('aMe ssageQueue',aMessageQueue)\n","outputs":1,"noerr": 0,"x":330,"y":580,"wires":[["c3049fc6.89321"]],"outputLabels":["TTS text out"]},{"id":"8c7b6010.9e6a","type":"switch","z":"cddca 8d.0dbc858","name":"","property":"state","property Type":"msg","rules":[{"t":"neq","v":"playing","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x": 690,"y":420,"wires":[["8b1dd9de.7f78f8"]]},{"id":"8b1dd9de.7f78f8","type":"change","z":"cdd ca8d.0dbc858","name":"Send true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","t ot":"bool"}],"action":"","property":"","from":"","to":"","reg" :false,"x":820,"y":420,"wires":[["383ee1a1.38a37e"]]},{"id":"7adfb8c9.afbf48","type":"link in","z":"cddca8d.0dbc858","name":"TTS IN","links":["1e44e7ea.c9dac8"],"x":55,"y":580,"wires":[["383ee1a1.38a37e"]]},{"id":"1e44e7ea.c9dac8","type":"link out","z":"cddca8d.0dbc858","name":"TTS Out","links":["7adfb8c9.afbf48"],"x":495,"y":120,"wires":[]},{"id":"37acbbb5.865004","type":"inject","z":"cdd ca8d.0dbc858","name":"Put some queue","topic":"","payload":"true","payloadType":" bool","repeat":"","crontab":"","once":false,"onceD elay":0.1,"x":120,"y":120,"wires":[["bb3c5dae.abac1"]]},{"id":"bb3c5dae.abac1","type":"function","z":"cd dca8d.0dbc858","name":"Some queue","func":"node.send({payload:"Hello, this is the first line"});\nnode.send({payload:"Ciao, questa è la seconda linea"});\nnode.send({payload:"Hallo, diese ist die dritte Zeile"});","outputs":1,"noerr":0,"x":330,"y":120," wires":[["1e44e7ea.c9dac8"]],"outputLabels":["TTS text out"]},{"id":"b9f03d2e.cd911","type":"comment","z":"cdd ca8d.0dbc858","name":"TRY IT ! PUSH THE BUTTON BELOW","info":"","x":170,"y":80,"wires":[]},{"id":"926d4ddc.f9c19","type":"comment","z":"cdd ca8d.0dbc858","name":"FIRST SETUP THE SONOS IP AND THE VOLUME (below right)","info":"","x":250,"y":40,"wires":[]},{"id":"bb836cac.b995c","type":"comment","z":"cdd ca8d.0dbc858","name":"SETUP YOUR SONOS IP AND VOLUME","info":"","x":1120,"y":540,"wires":[]},{"id":"82e06d8e.ab227","type":"polly-config","z":"","name":"Polly"},{"id":"3bce7f52.686 3a","type":"better-sonos-config","z":"","name":"Soffitto","serialnum":"B8-E9-37-A8-90-DE:B","ipaddress":"192.168.1.109"}]
    You do not have permission to view this gallery.
    This gallery has 1 photos.

    #2
    Wow, sounds great! Will test ASAP and provide feedback. Thanks Jens

    Kommentar


      #3
      I think something has happened with the code, I think maye the server of this forum modified modified the content of the flow.
      Do you mind sending the flow in an email to jens@proknx.com ? Just export the flow and paste it into the email as content.
      Finally send a separate email to confirm the first email (if it was blocked by spam filters)
      I'll publish it on on our site
      Cheers

      Kommentar


        #4
        We have published the work of TheMax74 in our Node-RED library here: https://proknx.com/nodered/sound-ui-sonos-polly/
        Thanks for sharing the work!

        Kommentar


          #5
          Here the very early preview of a single node "do it all". It require at least Node 8.9.4 (you need to update realKNX to use this module)
          https://www.npmjs.com/package/node-r...-sonospollytts

          Kommentar


            #6
            Really nice work, Congratulations! Here's a screenshot of the test app with the config dialog to the right. All the essentials in one place!
            You do not have permission to view this gallery.
            This gallery has 1 photos.

            Kommentar


              #7
              Zitat von TheMax74 Beitrag anzeigen
              Here the very early preview of a single node "do it all". It require at least Node 8.9.4 (you need to update realKNX to use this module)
              https://www.npmjs.com/package/node-r...-sonospollytts
              If you want to try this new nice node, you'll have to upgrade NodeJS. Note that the HomeKit bridge might not work after an upgrade.

              For the time being, If you're using HomeKit we advice you to not upgrade NodeJS.

              Kommentar


                #8
                Hi I tested the latest version, and it is super easy to use and work it works really well, Congratulations!
                I tested with our new hardware which has NodeJs v9
                Did you install NodeJs v8.9 on the EDS14 or did you develop this node on another platform?

                Kommentar


                  #9
                  Hello Jeka
                  It runs on EDS14 with NodeJs v8.9.
                  I have other hardware as well, but EDS14 is my "core" system.
                  The integration with Siri & co is way so simple to use! Hope your new HW maintains the same "plug and play" philosophy.

                  Kommentar


                    #10
                    The realKNX software is more or less the same, the hardware is new and significantly faster !
                    BTW my concern that the HomeKit bridge would not work after an upgrade of NodeJs was unjustified?

                    Kommentar


                      #11
                      Mine is working with node 8....

                      Kommentar


                        #12
                        New version of SonosPollyTTS is out. V 1.1.8 with OwnFile node, that allow you to upload your custom audio files to play even if case of internet broken.
                        https://github.com/Supergiovane/node...-sonospollytts

                        Kommentar

                        Lädt...
                        X