synesthesiam/homeassistant-satellite

custom awake sound not working

Closed this issue · 2 comments

First of all, great project that works really nicely - thanks!

I wanted to customise the awake sound that is played, and while the included awake.wav works nicely, trying to replace it with another .wav file with --awake-sound sounds/otherfile.wav results in the following error after wakeword detection:

ERROR:__main__:Unexpected error
Traceback (most recent call last):
  File "/home/pi/homeassistant-satellite/homeassistant_satellite/__main__.py", line 214, in main
    play(media=args.awake_sound)
  File "/home/pi/homeassistant-satellite/homeassistant_satellite/snd.py", line 90, in play_subprocess
    with wave.open(ffmpeg_proc.stdout, "rb") as wav_file:
  File "/usr/lib/python3.9/wave.py", line 509, in open
    return Wave_read(f)
  File "/usr/lib/python3.9/wave.py", line 163, in __init__
    self.initfp(f)
  File "/usr/lib/python3.9/wave.py", line 128, in initfp
    self._file = Chunk(file, bigendian = 0)
  File "/usr/lib/python3.9/chunk.py", line 63, in __init__
    raise EOFError
EOFError

The pipeline is also interrupted and the script has to be restarted.

I have checked that the file is playable with aplay without issues.
Any ideas?

System info:
Raspberry Pi 3A+ running Raspbian bullseye

You're welcome!

The WAV file may have an incorrect length in the header. "Converting" it to a WAV through sox or ffmpeg should fix this.

That worked like a charm!
(For future reference, the command is: ffmpeg -i <input_file> <output_file>.wav)
Thanks for the lightning fast response, now I can enjoy my Star Trek computer beep :)