Grab a fresh image of Raspbian.
PS on a Pi4 64bit OS is actually about 15-20% faster but just grab a 32bit raspbian lite and give it a fresh flash just to get to grip with things.
Install that horrid respeaker driver.
I am not even going to bother with the Loopbacks on the 6mic and just stick to what I know. I am presuming they are just the same but hardware loopbacks that the kernel provides with ```
snd-aloop and you can play with those later.
I am pretty sure the echo mentions of Respeaker are snake-oil as the silicon lacks DSP.
From the repo https://github.com/voice-engine/ec do as it says.
For some reason Raspbian still includes the RC version of SpeexDSP and its up to you as the compile of the latest build is easy and if this is additional or not I will just run through here or just jump to the instructions of https://github.com/voice-engine/ec
git clone https://github.com/xiph/speexdsp
Grab the latest and then cd speexdsp`` Add some compile tools ``sudo apt-get install autotools-dev autoconf libtool pkg-config
Think its ./autogen.sh
From memory
./configure -h
will show the options only one you need to add is the libs-dir= which is that funny /usr/lib/gnu-linux-whatever folder
so ./configure --lib-dir=gnu-whatever
Donāt enable neon as it just causes errors and gets enabled anyway
Then make
then sudo make install
That gives you the release version and installs speexdsp rather than the raspbian RC version it contains but both still work.
So if you didnāt compile install speexdsp as in https://github.com/voice-engine/ec#build
clone EC cd to the dir and make.
Stay in that directory when you run ./ec as its not in any path anywhere.
But cd ⦠and then do as https://github.com/voice-engine/ec#use-ec-with-alsa-plugins-as-alsa-devices
Then copy https://github.com/voice-engine/ec/blob/master/asound.conf to either /etc/asound.conf (system wide) or ~/.asoundrc (user)
The cd back into the EC folder do as https://github.com/voice-engine/ec#ec-for-raspberry-pi and ignore the hardware loopback directions for now.
You need to do a aplay -l / arecord -l to get the index of the respeaker but likely
./ec -i plughw:0 -o plughw:1 -d 20
I tend to disable pi audio when not used as it just makes things more tidy
sudo nano /etc/modprobe.d/raspi-blacklist.conf
add blacklist snd_bcm2835
save reboot and now your respeaker will be index 0 for capture and playback and the 3.5mm soc_audio will of gone.
Not essential but yeah a little more tidy when it comes to audio asound.conf and things.
so then it becomes ./ec -i plughw:0 -o plughw:0 -d 20
Leave that open in a terminal windows so you can see stndout in the window.
Open another terminal and the asound.conf we set earlier will of set the defaults but just set the sampling rate, format and file to record to.
arecord -fS16_LE -r16000 rec.wav
In another terminal playback an example wav whilst talking into the mic.
wget https://file-examples.com/wp-content/uploads/2017/11/file_example_WAV_10MG.wav
aplay file_example_WAV_10MG.wav
When its finished playing go back to the arecord terminal and press ctrl+c and that will stop recording.
Ec ends when the recording ends so it will not be accessing the card and you can just aplay -Dplughw:0 rec.wav
to check your results.
Thats just the test and wise just to do to make sure all is working as then we just need to add a few lines to the Mycroft start service and script as EC only kicks in when media is playing and thats it done.
What I suggest you do is record a non EC via plughw:0 without EC running
arecord -Dplughw:0 -fS16_LE -r16000 no-ec.wav
In a seperate terminal
aplay -Dplughw:0 file_example_WAV_10MG.wav
Into the mic talk proverbial
ctrl+c arecord terminal on end
Then run ./ec
then the same but use the asound.conf defaults
arecord -fS16_LE -r16000 ec.wav
In a seperate terminal
aplay file_example_WAV_10MG.wav
Into the mic talk proverbial
ctrl+c arecord terminal on end
Then compare if all OK then we will automate the startup, prob seems all complex but once you have done that step by step once it will all become fairly apparent and easy.