No sound when WAV sent directly to playBytes?

Hello,
If I try to send a wav directly to the audio server over MQTT I get an acknowlegement but no sound plays. Sound generated by sending text to “hermes/tts/say” plays normally, and is audible.

A minimal example (assuming the usual imports/setup of paho-mqtt) would be:

wav = wave.open('path/to/wav','rb')
client.publish("hermes/audioServer/my-site-id/playBytes/0", 
    wav.readframes(100))

I see receipt of the the message and a message that play has finished, just no sound:

[DEBUG:2020-09-19 12:08:39,706] rhasspyspeakers_cli_hermes: <- AudioPlayBytes(12689152 byte(s))
[DEBUG:2020-09-19 12:08:39,707] rhasspyspeakers_cli_hermes: ['aplay', '-q', '-t', 'wav', '-D', 'default']
[DEBUG:2020-09-19 12:08:39,794] rhasspyspeakers_cli_hermes: -> AudioPlayFinished(id='0', session_id='')

If anyone has a clue here, I’d love some guidance. I’ve stared at the source code of the tts and audioServer modules, and as far as I can tell what I’m doing should work.

It looks like you’re sending the WAV frames without the header. Try sending the whole thing and see if it works:

client.publish("hermes/audioServer/my-site-id/playBytes/0",
    open("path/to/wav", "rb").read())

Well that’s embarrassing. Solved! Thanks for taking the time to look at this, @synesthesiam.

1 Like

No worries :slight_smile: