Categories
dev ears envs hardware_

ReSpeaker Mic Hat in Docker on Jetson

A quick post, to describe the issues encountered getting the Respeaker 2-mic hat working in a docker on the Jetson Nano.

Based off the instructions:

First, you need to ls /usr/src to find out your linux headers version number, and replace it in the instructions.

Then, copied this excerpt from Dusty NV’s jetson-voice container to my own container build.

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
		  alsa-base \
            libasound2-dev \
            alsa-utils \
            portaudio19-dev \
		  libsndfile1 \
		  unzip \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get clean
    
RUN pip3 install soundfile pyaudio wave

Then, needed to run the container with –privileged=true

And once again, run this bit inside the container.

cd ~/seeed-linux-dtoverlays
alsactl -f extras/wm8960_asound.state-jetson-nano restore 1

Then arecord and aplay worked.

But in order to run the python code at respeaker’s github I had to change to the following lines, from the OG record program:

RESPEAKER_RATE = 44100 #16000
RESPEAKER_CHANNELS = 1 #2
...
data = stream.read(CHUNK,exception_on_overflow = False) 

Now I’m able to record and play WAV files from inside the docker.