[pulseaudio-discuss] pa echo-cancel module and alsa

Monkey Bizness monkey at infra-monkey.com
Sun May 24 05:21:36 UTC 2020


Currently, my setup is on a pi4, not a pi3, maybe that makes a
difference.I record sound from usb webcam directly from the pulseaudio
source (usb3 port).Bus 001 Device 003: ID 045e:075d Microsoft Corp.
LifeCam Cinema

I know it is not a well supported webcam on linux but it works well
enough for now. I had to plug it on usb3 for it to work correctly.
I won't have much time to test today, but i'll do more tomorrow.

I said the sound if fine and cancelled correctly. However in the
journal i get quite a lot of :

May 24 05:07:59 rpi4.dyn.empire.lan pulseaudio[2298]: Doing resync

May 24 05:07:59 rpi4.dyn.empire.lan pulseaudio[2298]: Playback after
capture (-233332), drop sink 59808

May 24 05:08:43 rpi4.dyn.empire.lan pulseaudio[2298]: Doing resync

May 24 05:08:43 rpi4.dyn.empire.lan pulseaudio[2298]: Playback too far
ahead (6198), drop source 792

May 24 05:08:43 rpi4.dyn.empire.lan pulseaudio[2298]: Doing resync

May 24 05:08:43 rpi4.dyn.empire.lan pulseaudio[2298]: Playback too far
ahead (40575), drop source 5192

May 24 05:08:43 rpi4.dyn.empire.lan pulseaudio[2298]: Doing resync

May 24 05:08:43 rpi4.dyn.empire.lan pulseaudio[2298]: Playback too far
ahead (20057), drop source 2564

May 24 05:08:44 rpi4.dyn.empire.lan pulseaudio[2298]: Playback after
capture (-6488), drop sink 1736

May 24 05:08:45 rpi4.dyn.empire.lan pulseaudio[2298]: Playback after
capture (-293), drop sink 152

May 24 05:08:54 rpi4.dyn.empire.lan pulseaudio[2298]: Playback after
capture (-45), drop sink 88

May 24 05:09:08 rpi4.dyn.empire.lan pulseaudio[2298]: Playback after
capture (-73), drop sink 96

May 24 05:10:21 rpi4.dyn.empire.lan pulseaudio[2298]: Doing resync

May 24 05:10:21 rpi4.dyn.empire.lan pulseaudio[2298]: Playback too far
ahead (6823), drop source 872

May 24 05:10:22 rpi4.dyn.empire.lan pulseaudio[2298]: Doing resync

May 24 05:10:22 rpi4.dyn.empire.lan pulseaudio[2298]: Playback too far
ahead (67265), drop source 8608

May 24 05:10:22 rpi4.dyn.empire.lan pulseaudio[2298]: Doing resync

May 24 05:10:22 rpi4.dyn.empire.lan pulseaudio[2298]: Playback too far
ahead (3225), drop source 412

May 24 05:10:23 rpi4.dyn.empire.lan pulseaudio[2298]: Playback too far
ahead (12683), drop source 1620

May 24 05:10:24 rpi4.dyn.empire.lan pulseaudio[2298]: Playback too far
ahead (8742), drop source 1116

May 24 05:10:25 rpi4.dyn.empire.lan pulseaudio[2298]: Playback too far
ahead (9509), drop source 1216

May 24 05:10:26 rpi4.dyn.empire.lan pulseaudio[2298]: Playback too far
ahead (10054), drop source 1284

May 24 05:10:27 rpi4.dyn.empire.lan pulseaudio[2298]: Playback too far
ahead (10024), drop source 1280

May 24 05:10:29 rpi4.dyn.empire.lan pulseaudio[2298]: Playback after
capture (-44), drop sink 88

May 24 05:10:37 rpi4.dyn.empire.lan pulseaudio[2298]: Playback after
capture (-137), drop sink 112

May 24 05:10:43 rpi4.dyn.empire.lan pulseaudio[2298]: Playback after
capture (-284), drop sink 152

May 24 05:11:03 rpi4.dyn.empire.lan pulseaudio[2298]: Playback after
capture (-86), drop sink 96

May 24 05:11:14 rpi4.dyn.empire.lan pulseaudio[2298]: Playback after
capture (-70), drop sink 96

May 24 05:11:26 rpi4.dyn.empire.lan pulseaudio[2298]: Playback after
capture (-216), drop sink 128

May 24 05:11:39 rpi4.dyn.empire.lan pulseaudio[2298]: Playback after
capture (-126), drop sink 112

On Sat, 2020-05-23 at 18:30 +0000, Stuart Naylor wrote:
> I just tried a totally different sound input 2x I2S mics on the Pi3
> Gpio (Pi3 this time)
> 
> 
> 
> Did the tsched thing and without but no luck.
> 
> 
> 
> load-module module-udev-detect tsched=0
> 
> 
> 
> If you really want AEC on a pi via software just for now best I have
> been able to achieve is detailed here.
> 
> https://community.rhasspy.org/t/2x-1-80-i2s-mems-mics-pi-3-5mm-ec-but-buy-adafruit-if-you-can/1015
> 
> Its Alsa has to have a single sound card clock.
> 
> 
> 
> Even though listed as x2 soundcards its the same I2s clock on the Pi.
> 
> USB soundcards are the same as one clock so synced with
> playback/capture
> 
> Respeaker work but hate the drivers.
> 
> 
> 
> If you have USB say PS3eye and Pi 3.5mm the speexdsp can not handle
> the unsynced clock drift and basically doesn’t work.
> 
> 
> 
> But right sound source and the above so far is best method on the Pi,
> dunno why or what is happening with WebRTC but the results are bad.
> 
> 
> 
> Stuart
>  
> Sent from 
> Mail for Windows 10
>  
> 
> From: pulseaudio-discuss-request at lists.freedesktop.org
> 
> Sent: 23 May 2020 13:00
> 
> To: pulseaudio-discuss at lists.freedesktop.org
> 
> Subject: pulseaudio-discuss Digest, Vol 109, Issue 16
> 
>  
> Send pulseaudio-discuss mailing list submissions to
> 
>         pulseaudio-discuss at lists.freedesktop.org
> 
> 
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 
>         
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
> 
> or, via email, send a message with subject or body 'help' to
> 
>         pulseaudio-discuss-request at lists.freedesktop.org
> 
> 
> 
> You can reach the person managing the list at
> 
>         pulseaudio-discuss-owner at lists.freedesktop.org
> 
> 
> 
> When replying, please edit your Subject line so it is more specific
> 
> than "Re: Contents of pulseaudio-discuss digest..."
> 
> 
> 
> 
> 
> Today's Topics:
> 
> 
> 
>    1. Re: pa echo-cancel module and alsa (Monkey Bizness)
> 
> 
> 
> 
> 
> -------------------------------------------------------------------
> ---
> 
> 
> 
> Message: 1
> 
> Date: Fri, 22 May 2020 20:06:19 +0200
> 
> From: Monkey Bizness <monkey at infra-monkey.com>
> 
> To: "pulseaudio-discuss at lists.freedesktop.org"
> 
>         <pulseaudio-discuss at lists.freedesktop.org>
> 
> Subject: Re: [pulseaudio-discuss] pa echo-cancel module and alsa
> 
> Message-ID:
> 
>         <
> 2d4b5114769a3e27b327c945eff56abb6b1c7c10.camel at infra-monkey.com>
> 
> Content-Type: text/plain; charset="utf-8"
> 
> 
> 
> Hi Stuart,
> 
> I've tried to specify sink_master=alsa_output.default which is the
> sink
> 
> create by the alsa-sink module but wierdly my echoCanel_sink is
> slaved
> 
> to the alsa_input of the usb webcam.... 
> 
> I'll probably do more testing and file a bug report is needed.
> 
> Anyhow, I could work around the race for default sink by disabling
> the
> 
> manual module-alsa-sink and adding the "tsched=off" option to load-
> 
> module module-udev-detect tsched=offI just hope it doesn't mess with
> 
> the usb mic. The capture was working well. If it is messed up i'll
> have
> 
> to go back to setting the sinks manually or find a way to deal with
> it
> 
> through autodetect module.
> 
> Now the autodetected sinks use this option. The echo-cancel module
> uses
> 
> the autodetected sink and source and default masters. This means i
> 
> don't have to modify the alsa configuration.The set-default-sink and
> 
> set-default-source are now correctly used.
> 
> I can see some drops sink and drop source in the pa logs.I'll
> 
> investigate into that and there must be some tweaking to do. 
> 
> webrtc seems to have some interesting additional features i want to
> try
> 
> like noise suppression and mobile loud-speakerphone profile i want to
> 
> try out.I couldn't find any docs on the speex module so i didn't
> really
> 
> look into it 
> 
> So far so good.
> 
> PS i just started with all the pulseaudio and aec so i'll do as much
> 
> testing and reading. I'll come back with more results soon.
> 
> Thanks for the advice.
> 
> Monkey
> 
> On Fri, 2020-05-22 at 13:28 +0000, Stuart Naylor wrote:
> 
> > You are supposed to be able to define the master source & sink
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > My usual is 
> 
> > 
> 
> > 
> 
> > 
> 
> > >>>load-module module-echo-cancel use_master_format=1
> 
> > aec_method=webrtc aec_args=?analog_gain_control=0
> 
> > digital_gain_control=1 agc_start_volume=85?
> 
> > source_name=echoCancel_source sink_name=echoCancel_sink
> 
> > >>> 
> 
> > >>>set-default-source echoCancel_source
> 
> > >>>set-default-sink echoCancel_sink
> 
> > 
> 
> > 
> 
> > use_master_format=1 just seemed easier than the problems I had in
> 
> > attaining a working defined sink/source
> 
> > 
> 
> > I have forgot where I found the details for master_sink &
> 
> > master_source parameters maybe its in the code but going to have a
> 
> > good look again at PA webrtc.
> 
> > 
> 
> > 
> 
> > 
> 
> > I also got into some problems as wanted to have asound.conf that
> 
> > would use pulse.
> 
> > 
> 
> > 
> 
> > 
> 
> > Using pulseaudio_alsa and
> 
> > 
> 
> > 
> 
> > 
> 
> > >>># Use PulseAudio by default
> 
> > >>>pcm.!default {
> 
> >   >>>type pulse
> 
> >   >>>fallback "sysdefault"
> 
> >   >>>hint {
> 
> >   >>>  show on
> 
> >   >>>  description "Default ALSA Output (currently PulseAudio Sound
> 
> > Server)"
> 
> >   >>>}
> 
> > >>>}
> 
> > >>> 
> 
> > >>>ctl.!default {
> 
> > >>> type pulse
> 
> > >>> fallback "sysdefault"
> 
> > >>>}
> 
> > 
> 
> > 
> 
> > 
> 
> > But seemed to get stuck in this tail chasing of default sound on
> 
> > reboots.
> 
> > 
> 
> > 
> 
> > 
> 
> > As said this weekend going to have another good look at PA Webrtc
> AEC
> 
> > on the Pi but I found when using the Pi output and usb mic the
> clock
> 
> > drift was quite excessive.
> 
> > 
> 
> > I am using soundcards with a singular clock and card for
> sink/source
> 
> > and getting similar results which has me head scratching.
> 
> > 
> 
> > You can wire up 2x I2s mics to a Pi quite easily and that would
> share
> 
> > the same clock as the Pi output (doesn?t work pi4 sadly)
> 
> > 
> 
> > 
> 
> > 
> 
> > I will look forward to how you get on as my SpeexEc results have
> been
> 
> > quite good on the Pi and expected PA WebRTC AEC to be better but
> 
> > actually seems worse.
> 
> > 
> 
> > PS both of us are setting autogain and from speex that isn?t really
> a
> 
> > good idea as it makes thing much harder for the adaptive FFT
> routine.
> 
> > 
> 
> > AGC needs really long attack/delay values in fact with voice in
> 
> > manner of speech its hard to use AGC and not just amplify noise.
> 
> > 
> 
> > Really the gain shouldn?t be there are its problematic anyway.
> 
> > 
> 
> > 
> 
> > 
> 
> > Stuart
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > Sent from 
> 
> > Mail for Windows 10
> 
> >  
> 
> > 
> 
> > 
> 
> > 
> 
> -------------- next part --------------
> 
> An HTML attachment was scrubbed...
> 
> URL: <
> https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20200522/5cf73dcc/attachment-0001.htm
> >
> 
> 
> 
> ------------------------------
> 
> 
> 
> Subject: Digest Footer
> 
> 
> 
> _______________________________________________
> 
> pulseaudio-discuss mailing list
> 
> pulseaudio-discuss at lists.freedesktop.org
> 
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
> 
> 
> 
> 
> 
> ------------------------------
> 
> 
> 
> End of pulseaudio-discuss Digest, Vol 109, Issue 16
> 
> ***************************************************
>  
> 
> 
> 
> 
> _______________________________________________pulseaudio-discuss
> mailing listpulseaudio-discuss at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20200524/e31539d1/attachment-0001.htm>


More information about the pulseaudio-discuss mailing list