Python 3 support for ReSpeaker needed

I recently obtained a ReSpeaker USB Mic Array which I want to use for a Rhasspy ASR application, integrated with Home Assistant. I need to create an MQTT audio server for this application.

Unfortunately all the instructions and libraries seem to assume Python 2.7 which is deprecated — and is now QUITE a pain to install on Ubuntu or current versions of Debian on the Rasp Pi. I DID manage to get everything working after a lot of messing about to install python 2.7, pip2, compatible libraries (hints: you have to use pyaudio==0.2.9 as new versions ONLY support python 3, and you have to manually install pep517, and you have to use the “python2.7 -m pip” command to invoke pip…).

However, to avoid future bitrot and for compatibility with other things I’m working on I REALLY want python 3 support.

So… I could go through all the modules and port them to python 3 myself, but ideally that would be done in the official support. Python 2.7 is considered dead by the OS providers.

Actually, in the end this was not too hard - actually easier than installing Python 2.7:

  • tuning.py needs a small fix: “response.tostring” needs to be changed to “response.tobytes”.
  • All the example scripts need to surround the arguments to “print” in parentheses

Then it works with Python 3 and with recent versions of pyaudio, etc. Yeah! However, updating the docs and tuning.py in the release would be nice.

Yes, I was also looking for a solution for my Mac with Python3 and found the great fix from DavidGoedicke

Now I can use the ReSpeaker Mic Array v2.0 with Python3 on my Mac.
All the best,
Florian