Playing audio files on remote machine and use their speakers - not the hosts'

Looks like they are serious and have given fair warning :slight_smile:

1 Like

:frowning:

Drats

But I guess like so many things nowadays:

There are alternatives.

If this is for TTS - I use the TTS ultimate node

I'm not sure if I can use that as I am not in the Sonos environment.

But I'll look at that and see if it may do what I need.

The Sonos is just a red herring :slight_smile:

Mines configured like this

image

I note that you have to save the tts output to file before playing to the bluetooth speaker, so how is that file output from node red, as this was Trying_to Learn's the issue with using Watson?

Sorry

here is my flow output

[{"id":"ded069953e574fc0","type":"ttsultimate","z":"d7c2e97da54dae65","name":"","voice":"en-GB","ssml":false,"sonosipaddress":"","sonosvolume":"20","sonoshailing":"0","config":"abf536dfafd7b1dd","property":"payload","propertyType":{},"rules":[],"playertype":"noplayer","speakingrate":"1","speakingpitch":"0","unmuteIfMuted":true,"x":515,"y":490,"wires":[["a2544bce9b62fd20"],[]],"l":false},{"id":"27d7e4a40f76b2e4","type":"file in","z":"d7c2e97da54dae65","name":"","filename":"filename","filenameType":"msg","format":"","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":780,"y":490,"wires":[["697f8556100b9244","1ad329619dc6e258","20d4ac3f43d3e5f8","61b937d9589ee3df","43b48eeb24035397"]]},{"id":"165dcd9abc84c14d","type":"change","z":"d7c2e97da54dae65","name":"","rules":[{"t":"set","p":"filename","pt":"msg","to":"filesArray[0]file","tot":"msg"},{"t":"set","p":"speech","pt":"msg","to":"filename","tot":"msg","dc":true},{"t":"change","p":"speech","pt":"msg","from":"/home/pi/.node-red/sonospollyttsstorage/ttsfiles/","fromt":"str","to":"","tot":"str"},{"t":"change","p":"speech","pt":"msg","from":"_en-GB01.mp3","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":635,"y":490,"wires":[["27d7e4a40f76b2e4"]],"l":false},{"id":"a2544bce9b62fd20","type":"switch","z":"d7c2e97da54dae65","name":"payload is true","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":575,"y":490,"wires":[["165dcd9abc84c14d"]],"l":false},{"id":"abf536dfafd7b1dd","type":"ttsultimate-config","name":"TTS Service","noderedipaddress":"127.0.0.1","noderedport":"1980","purgediratrestart":"leave","ttsservice":"googletranslate","limitTTSFilenameLenght":"220"}]

But how does reading the file output it to a bluetooth speaker?
image

OK
I was only posting to say I use the TTS ultimte node to do the text-to-speech conversion

I wasn't aiming to solve the whole issue :slight_smile:

I'll back away quietly :slight_smile:

I was wondering whether you had an alternative solution for output. The output from TTS is an mp3 in your flow, can it be output from TTS as a wav?

Thanks for the info on that node.

I am a bit stuck with how / where you set the voice though.

I am seeing the node config with the warning Any changes in this means you have to restart node-red

This is what I see though:

Which is similar to your second picture.

Thanks.

Though I am not at that stage yet, the player has other options.

I'm not at that page yet, but there may be options to make that part different and send a WAV or MP3 file out.

A simple setup using TTS ultimate node and ffplay (included if you have ffmpeg installed) working fine in my test setup. I can send text messages via MQTT and it is played fine on the remote computer

[{"id":"569773ae.930abc","type":"inject","z":"42439796e8ca77fd","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":160,"y":630,"wires":[["e066ce90.46f758"]]},{"id":"e066ce90.46f758","type":"function","z":"42439796e8ca77fd","name":"Via function","func":"// The simplest way\nmsg.payload=\"Benvenuti,Wilkommen,Wellcome!\";\nreturn msg;\n","outputs":1,"noerr":0,"x":300,"y":630,"wires":[["3d9635bc.53c14a"]]},{"id":"c272b47c.41e238","type":"inject","z":"42439796e8ca77fd","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":160,"y":670,"wires":[["2fcffdb7.1c76ea"]]},{"id":"2fcffdb7.1c76ea","type":"function","z":"42439796e8ca77fd","name":"Set volume","func":"// Set the Volume\nmsg.volume=\"60\"; // If not set, will take the volume from setting page\nmsg.payload=\"Benvenuti,Wilkommen,Wellcome!\";\nreturn msg;\n\n","outputs":1,"noerr":0,"x":300,"y":670,"wires":[["3d9635bc.53c14a"]]},{"id":"2bd6fd7f.9b9ae2","type":"inject","z":"42439796e8ca77fd","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":160,"y":710,"wires":[["aa3b6e42.669fc"]]},{"id":"aa3b6e42.669fc","type":"function","z":"42439796e8ca77fd","name":"Array of messages","func":"// Create an array of messages\nvar aMessages=[];\n// Add random messages\naMessages.push({volume:\"50\",payload:\"Benvenuti.\"});\n// Wheater in Italy\naMessages.push({volume:\"40\",payload:\"http://media.ilmeteo.it/audio/2020-12-23.mp3\"});\n// Add random messages\naMessages.push({volume:\"30\",payload:\"Cambia la tua voce nei settaggi.\"});\nreturn [aMessages];\n","outputs":1,"noerr":0,"x":320,"y":710,"wires":[["3d9635bc.53c14a"]]},{"id":"3e0d9b5c.fe01b4","type":"inject","z":"42439796e8ca77fd","name":"Hello World","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Ciao Mondo! Come stai?","payloadType":"str","x":180,"y":590,"wires":[["3d9635bc.53c14a"]]},{"id":"42e6fab4.e8d154","type":"comment","z":"42439796e8ca77fd","name":"Play text on Sonos. Single player or Group of players","info":"","x":290,"y":550,"wires":[]},{"id":"3d9635bc.53c14a","type":"ttsultimate","z":"42439796e8ca77fd","name":"","voice":"en-GB","ssml":false,"sonosipaddress":"192.168.1.109","sonosvolume":"30","sonoshailing":"0","config":"557d8082.eb5a8","property":"payload","propertyType":{},"rules":[],"playertype":"noplayer","speakingrate":"","speakingpitch":"","unmuteIfMuted":false,"elevenlabsStability":"","elevenlabsSimilarity_boost":"","x":540,"y":590,"wires":[["17d1372ec4e2fa56"],[]]},{"id":"11b198c7a57d0ab4","type":"debug","z":"42439796e8ca77fd","name":"debug 6","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1110,"y":750,"wires":[]},{"id":"17d1372ec4e2fa56","type":"switch","z":"42439796e8ca77fd","name":"","property":"filesArray","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":730,"y":660,"wires":[["b6292f5b6fb85a0f"]]},{"id":"b6292f5b6fb85a0f","type":"function","z":"42439796e8ca77fd","name":"function 6","func":"msg.payload = msg.filesArray[0].file;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":890,"y":660,"wires":[["9b644a0b5cb0fbc9"]]},{"id":"9b644a0b5cb0fbc9","type":"exec","z":"42439796e8ca77fd","command":"ffplay -nodisp -autoexit","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":1110,"y":660,"wires":[[],["11b198c7a57d0ab4"],[]]},{"id":"172b415bc9693c77","type":"mqtt in","z":"42439796e8ca77fd","name":"","topic":"TTS","qos":"2","datatype":"auto-detect","broker":"e284bf9.3fc124","nl":false,"rap":true,"rh":0,"inputs":0,"x":360,"y":800,"wires":[["3d9635bc.53c14a"]]},{"id":"557d8082.eb5a8","type":"ttsultimate-config","name":"googletranslate","noderedipaddress":"127.0.0.1","noderedport":"1980","purgediratrestart":"leave","ttsservice":"googletranslate","TTSRootFolderPath":""},{"id":"e284bf9.3fc124","type":"mqtt-broker","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
3 Likes

Thanks.

I seem to be missing a lot of things these days.

So I have ffmpeg installed on the machine and I have a similar thing set up so I can send words to be said on the existing tts system.

I import your flow and deploy it.
Press the Hello world button. SILENCE.

Sorry, but I'm not understanding why it isn't doing anything.

As a check: I try it on THIS machine (the big / powerful NUC - which also has ffmpeg installed)
Run it and also SILENCE.

The audio on this machine is working also.
So I don't understand what I am missing.

This is a screenshot of what I see (if the debug is active) and I press the button.

(ignore the top few messages shown)

P.S.
Ok, on one machine I am seeing a config not set and it is pointing to the tts node.
But not on the second machine.

UPDATE:

Changed the exec node to the one that was working with the other TTS, and now it is talking to me.

(I'll call it quits here. I fear this has dragged on far too long now.)
I've got the TTS working - other problems exist but they are outside the scope of this thread.

THANKS TO ALL WHO POSTED!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.