EC respeaker echo cancellation

That is no consideration to a consumer and purchaser and hence why I have been on a mission to reduce cost.
The margins Google & Amazon make on product are low, in fact they are almost dumping product , but unless reasonable alternatives can be found then there are no reasonable alternatives.
But actually the silicon is really cheap couple of $ cheap WM8281 and likes, they have access and we don’t.
So its either some lateral thought or silly priced product or the great priced commercial alternatives.

@j1nx Mimic does sound better as have noticed, wondered if it was just my ears and memory.
The pulseaudio daemon does have config for RT

 high-priority = yes
 nice-level = -11

 realtime-scheduling = yes
 realtime-priority = 5

But haven’t read up on it.

With the above raspbian image and

load-module module-echo-cancel aec_method=webrtc aec_args="analog_gain_control=0 digital_gain_control=1 agc_start_volume=85 drift_compensation=1" source_name=echoCancel_source sink_name=echoCancel_sink

set-default-source echoCancel_source
set-default-sink echoCancel_sink

The voice stays very much in sync and for some reason specifying drift compensation=1 does that but also introduces an amount of bleed or doesn’t subtract the echo completely.
Its massively better than how I started with speex and sure actually it could be used.
But will have to see as an spi sound card that has a syncronised input and output might even be better and I can run without drift compensation and get no bleed.

Also take a look at the “tsched” parameter which you can enable/disable for the alsa/udev sink. You can reduce the latency with that as well. There are also some timing parameters related to it, but that is very hardware dependent.

I have “tsched=0” for mycroft which helps a lot to make sound way snappier. Especially for the wake sound not being so delayed because of the time based schedular. (On a rpi that is)

@j1nx Next one is to work out module-role-ducking as think voice_detection=1 hopefully adds a media.role property? As otherwise totally bemused hwo to implement it.

The documentation is just disasterous and had enough and it will have to be another day.
Waiting for the 2 mic to turn up and see if Forrest Mycroft can be stopped.

I will reread the posts one time and try tsched with the USB.

Ducking is already merged within mycroft and is needed to duck played music when TTS kicks in.

Is that just pulse ducking or internal as presume its picked up via --stream-name=mycroft-voice

Yeah I want to try the same with the Mic and see how it goes as its VAD so hopefully its added over a threshold.
To be honest VAD in how you can utilise it or what function it has is a documentation mystery.

I discussed it here;

Yeah its not the duck module but if what VAD gives out I will have to watch the pulse server and d-bus I guess when it running.
It just doesn’t say anywhere like quite a lot of the freedesktop documentation it is incomplete at best.
Wondering if VAD threshold is hit then its flagged as phone.mode… dunno, doesn’t say and havent tried.

No clue what you mean this time😂

1 Like

No I haven’t really as there is absolutely zero documentation for the VAD in the pulseaudio aec webrtc module.
Apart from voice_detection=1 - VAD - Voice activity detection and was just crossing my fingers this may add or change stream parameters as it hits a threshold as coul prob use that.
Otherwise its like the beamforming and just a non implemented cul-de-sac.
So I am also the same as know there is a setting for VAD but what it does is also a mystery

PS can you change the the sensitivity of precise on the run or is that all part of its setup?

Sorry, never played with it myself.

PS from playing with RT quite a lot supports even mpg123 -T but unless you run as root and sudo it will not work.
The daemon setting for RT with pulse seem to work as it states in the journal, but would seem some apps need elevation.

Haven’t really done much with it but give it a try as wow the load rockets with the Mycroft services.
It does even make the s-pipe pi audio out sound better, still sounds relatively s-pipe but is definately improved.
The load increase you get with RT prob means its a no go though, did you give it a try?

There is a little bit of documentation in the sourcecode of pa-webrtc module - at least you can see all available parameters and their default values:

Yeah what it does still seems to be a bit of a mystery.
There are a few things that confuse me as pulseaudio seem to of added drift compensation to speex with the adjust_time and adjust_threshold but webrtc has drift_compensation that you enable and not sure even if it should apply to webrtc… ? As then it has double drift compensation but unfortunately can not turn the first off.

I did sort out why speexdsp seems to be missing from alsa-plugins.
libspeexdsp-dev is 1.2rc1 but even back to the installed alsa of 1.8.1 1.2rc2 is required.
So cloned speexdsp-dev 1.2rc2 installed then compiled alsa-plugins 1.8.1

So at least I can test speex without pulseaudio drift compensation when the 2 mic turns up.
But even with the code I am still wondering if some items make any sense :slight_smile:

I believe RT is only nice for systems that are designed to run for ionly one thing. And, yes although mycroft is to be considered a one thing. Way to many packages / software is involved to really get it running nice.

Would be nice for a very small pulseaudio satelite microhone device though, but don’t believe in it on a full fledged OS with all those different running python tasks etc.

Long story short: Nope didn’t try it.

Yeah on a Pi4 it goes over 3, but same as for a satelite microphone could be ideal.

But actually if you leave it then at about 10 minutes onwards the avg load drops quite a lot.

That is normal load I see at MycroftOS by default.

Yeah it just the initial boot.

Because it is pulling a lot of pip python packages. Also the reason, RT stuff will bite your ass big time😉

1st card to turn up is the 4 mic linear 4 Pi.

So not using loopback and running ec rather than ec_hw

The ec load seems very low on a Pi4 no OC

Now strangely because I have the 4 mic linear I haven’t been able to run ec_hw yet as not really sure which channel is the loopback.
But will try but the 4 mic linear seems great and actually not bad for £25 but the linear mic strip suits prob a retangle ‘radio’ shape box due to length.

I am pretty sure I can add some extra filters forgot the music term but that will filter out the low volume and that should reduce even further.

Speex & EC doesn’t totally remove echo and really needs the same sound card as clock drift kills its function.
But on a soundcard and presuming the 2mic will be the same its likely effective EC can be used to give a mic signal fit for purpose.