Sending wav File to rhasspy client

I would like to send a wav file to one of my zeros (Alarm) with node red.
I can do this with curl:
curl -X POST “http://10.2.30.1:12101/api/play-wav” -H “Content-Type: audio/wav” --data-binary @"/home/kaykoch/beep.wav"

I tried it with node red:


[{“id”:“193b6f2e.e444e1”,“type”:“http request”,“z”:“eefcaba0.cea7d8”,“name”:"-> Wohnzimmer",“method”:“POST”,“ret”:“bin”,“paytoqs”:false,“url”:“http://10.2.30.1:12101/api/play-wav",“tls”:"",“persist”:false,“proxy”:"",“authType”:"",“x”:680,“y”:1060,“wires”:[[]]},{“id”:“5d7e7c8d.179844”,“type”:"file in”,“z”:“eefcaba0.cea7d8”,“name”:"",“filename”:"/data/beep.wav",“format”:"",“chunk”:false,“sendError”:false,“encoding”:“none”,“x”:480,“y”:1100,“wires”:[[“b1eeeb0f.064a48”,“193b6f2e.e444e1”]]},{“id”:“6bcc905f.a777”,“type”:“inject”,“z”:“eefcaba0.cea7d8”,“name”:"",“topic”:"",“payload”:"",“payloadType”:“date”,“repeat”:"",“crontab”:"",“once”:false,“onceDelay”:0.1,“x”:220,“y”:1100,“wires”:[[“5d7e7c8d.179844”]]},{“id”:“b1eeeb0f.064a48”,“type”:“debug”,“z”:“eefcaba0.cea7d8”,“name”:"",“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“payload”,“targetType”:“msg”,“x”:670,“y”:1140,“wires”:[]}]

The wav file is recognized, but no sound at zero.
file-in sends wav as single buffer object to /api/play-wav

may you help me?

Does your flow set the Content-Type header? If it’s not set to audio/wav, Rhasspy will interpret the incoming data as a URL and try to download it before playing.

1 Like

Thats it. Thank you.

1 Like

Hello,
could you please post your nodered flow as preformatted text so that I can import it ?
I´m trying to send wav files in the same way.
Thank you !

Hi,

I would also love to know if there is a way of sending a .wav through mqtt to a satellite? I assume there is, but I am not a great programmer and would love a mqtt pub example or just explain it like I am 5 (ELI5) kind of thing. Also I have done a lot of googling and I can’t seem to find what .wav specs work with Rhasspy, I found 3 variations so far :frowning:

Thanks

For Rhasspy to play a wav file, a message can be send to the endpoint api/play-wav

This can be done by three methods:

  • set Content-Type to “audio/wav”, the data you post will be assumed raw data
  • Post a string starting with “/”, then the wav file from that path will be played (so the file should be on the filesystem of Rhasspy
  • post a url, the wav file from that url will be played.

If you want it to play on a certain satellite, you must include the siteId in the querystring on the endpoint, see the reference