How to play a wav file with hermes/audioServer/<siteId>/playBytes/<requestId>? Example needed



I try to play a sound wav through hermes but I need a more detailed example to understand the command.

I am in a JavaScript script using MQTT to manipulate snipes. It looks like:
getAction(“Mqtt”).static.publish(“snips”, “hermes/audioServer/” + siteId + “/playBytes/1”, “{”/usr/share/snips/assistant/custom_dialogue/sound/start_of_input.wav"}");

Anybody a hint for me?

Thanks in advance!


You need to publish the wav file as a buffer, not as a filename.
That is why the topic has the name: playBytes, it plays bytes :slight_smile:


Not sure about the java script part in particular, but you need to send it as a binary payload and that’s all. So you need to read that wav file into a buffer and send it. Using paho you may need to set the payloadFormatIndicator to false to indicate binary.


Thanks @Romkabouter and @tschmidty!
I’ll try to take it to the next level. :slight_smile:



this is how i do it on the command line:
{{path to}}/mosquitto_pub -h {{ mqtt hostname }} -p 1883 -t 'hermes/audioServer/{{ site_id }}/playBytes/{{ session_id }}' -f '{{ path to wav file }}'


Hi @diplix,

thank you!

Is it a local path or a server path (with Snips)?



i use local wav files, but as long as the path resolves to a valid and accessible wav file, any path should work.