Test and Evaluate Echo Cancellation in an Embedded Device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Arun,

Finally I got some good results.

I'm loading the AEC echo cancell module using this cmd line.

pactl load-module module-echo-cancel source_name=echosource
sink_name=echosink aec_method=webrtc channels=1 rate=8000
sink_properties=device.description="Noise_Reduction"
aec_args="analog_gain_control=0\ digital_gain_control=0\
drift_compensation=1 save_aec=1"

OBS: I tried to use save_aec but I did not  succeed, the files are created
in the /tmp but all the files were with lenght=0 bytes.


@Arun
These underflows sound bad. Does capture work fine without AEC?
The capture works good without AEC, I fix the capture with AEC using
tsched=0.

I configured the rate and audio format in gstreamer and pulse to
format=S16LE and rate=8000. I used the tsched=0 to "fix" the audio
crackling, I don't know if is the best option to do, but works. I would
like to know if is a good choice.


am_poc.pa

.nofail

.fail

load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1

load-module module-alsa-sink sink_name=mastersink device=hw:0,0 tsched=0

load-module module-alsa-source source_name=mastersource device=hw:0,0
tsched=0

load-module module-filter-heuristics
load-module module-filter-apply

set-default-source mastersource
set-default-sink mastersink


voip_script.sh

#!/bin/sh

IPDEST=$1

case "$2" in
   start)
         echo "Starting gstlaunch"
        export PULSE_PROP="filter.want=echo-cancel"
                gst-launch-1.0 -v \
                pulsesrc ! "audio/x-raw, format=(string)S16LE,
layout=(string)interleaved, rate=(int)8000, channels=(int)1" ! \
                alawenc ! rtppcmapay ! queue ! udpsink port=4000
host=$IPDEST sync=true &
                gst-launch-1.0 -v udpsrc
caps="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)PCMA"
port=4000 ! \
                  rtppcmadepay ! alawdec ! \
                  pulsesink sync=true\
                &
            ;;
   stop)
          echo "Stopping gstlaunch"
                killall gst-launch-1.0
           ;;
        *)
          echo "Usage: $0 <ipaddress> start|stop"
          exit 1
          ;;
esac


Pulse daemon.conf

exit-idle-time = -1
resample-method = trivial
flat-volumes = no
default-sample-format = s16le
default-sample-rate = 8000

Thank you very much!

Regards,

Caio Pereira

Em qua, 1 de jun de 2016 às 07:10, Arun Raghavan <arun at arunraghavan.net>
escreveu:

>
>
> On Sat, 28 May 2016, at 12:05 AM, Caio wrote:
> > I forgot the pulseaudio log.
> >
> >
> > Jan 01 05:39:46 colibri-imx6 pulseaudio[1230]: E: [alsa-source-HiFi
> > wm8962-0] module-echo-cancel.c: Doing resync
> > Jan 01 05:39:46 colibri-imx6 pulseaudio[1230]: E: [alsa-source-HiFi
> > wm8962-0] module-echo-cancel.c: Playback after capture (-1705478), drop
> > sink 109170
> > Jan 01 05:39:46 colibri-imx6 pulseaudio[1230]: E: [alsa-source-HiFi
> > wm8962-0] module-echo-cancel.c: Playback too far ahead (261821), drop
> > source 16756
> > Jan 01 05:39:48 colibri-imx6 pulseaudio[1230]: E: [alsa-source-HiFi
> > wm8962-0] module-echo-cancel.c: Playback after capture (-168495), drop
> > sink
> > 10802
> > Jan 01 05:48:55 colibri-imx6 pulseaudio[1230]: E: [alsa-source-HiFi
> > wm8962-0] module-echo-cancel.c: Doing resync
> > Jan 01 05:48:55 colibri-imx6 pulseaudio[1230]: E: [alsa-source-HiFi
> > wm8962-0] module-echo-cancel.c: Playback after capture (-2897082), drop
> > sink 185432
>
> What is the sink device in this case? It looks like there is a lot of
> drift between the two. You could try setting drift_compenasation=1 in
> the aec_args for the webrtc canceller.
>
> >
> > 2016-05-27 15:28 GMT-03:00 Caio <caiortp at gmail.com>:
> >
> > > Arun,
> > >
> > > Sorry for the delay.
> > >
> > > Thanks for the answers.
> > >
> > > "I'm not sure I follow correctly -- you're saying that if you do things
> > > this way, the AEC works fine?"
> > >
> > > Yes, I follow correcty your instruction is working very good.
> > >
> > >
> > >
> > > But Now I'm trying to avoid the "audio underrun" (the audio is
> cracking).
> > > When I use the paplay the audio is ok and the cpu is around 14%, when I
> > > start the test the cpu goes to 26% and the audio start to cracking.
> > > I'm having difficult to configure the pulseaudio.
> > >
> > >
> > > Thank you very much.
> > >
> > > The gstreamer log:
> > >
> > > root at colibri-imx6-jfl:~/wavs# ./teste_pulseaudio_echo.sh input.48.wav
> > > Setting pipeline to PAUSED ...
> > > 0:00:00.093887667  1258  0x1bac100 WARN                 basesrc
> > >
> /home/icchw/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0/1.4.1-r0/gstreamer-1.4.1/libs/gst/base/gstbasesrc.c:3460:gst_base_src_start_complete:<filesrc0>
> > > pad not activated yet
> > > 0:00:00.094892667  1258  0x1bb5750 FIXME                default
> > >
> /home/icchw/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0/1.4.1-r0/gstreamer-1.4.1/gst/gstutils.c:3643:gst_pad_create_stream_id_internal:<wavparse0:src>
> > > Creating random stream-id, consider implementing a deterministic way of
> > > creating a stream-id
> > > Pipeline is live and does not need PREROLL ...
> > > Setting pipeline to PLAYING ...
> > > New clock: GstPulseSrcClock
> > > 0:00:00.098627667  1258  0x1bb5780 FIXME                default
> > >
> /home/icchw/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0/1.4.1-r0/gstreamer-1.4.1/gst/gstutils.c:3643:gst_pad_create_stream_id_internal:<pulsesrc0:src>
> > > Creating random stream-id, consider implementing a deterministic way of
> > > creating a stream-id
> > > 0:00:01.350294000  1258  0x1bb5750 WARN           audiobasesink
> > >
> /home/icchw/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-mx6qdl-angstrom-linux-gnueabi/gstreamer1.0-plugins-base/1.4.1-r0/gst-plugins-base-1.4.1/gst-libs/gst/audio/gstaudiobasesink.c:1288:gst_audio_base_sink_skew_slaving:<pulsesink0>
> > > correct clock skew 22728553 > 20000000
> > > 0:00:01.904267667  1258  0x1bb5750 WARN           audiobasesink
> > >
> /home/icchw/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-mx6qdl-angstrom-linux-gnueabi/gstreamer1.0-plugins-base/1.4.1-r0/gst-plugins-base-1.4.1/gst-libs/gst/audio/gstaudiobasesink.c:1288:gst_audio_base_sink_skew_slaving:<pulsesink0>
> > > correct clock skew 21428670 > 20000000
> > > 0:00:03.019438001  1258  0x1bb5750 WARN           audiobasesink
> > >
> /home/icchw/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-mx6qdl-angstrom-linux-gnueabi/gstreamer1.0-plugins-base/1.4.1-r0/gst-plugins-base-1.4.1/gst-libs/gst/audio/gstaudiobasesink.c:1288:gst_audio_base_sink_skew_slaving:<pulsesink0>
> > > correct clock skew 20980685 > 20000000
> > > 0:00:03.947815667  1258  0x1bcb5a0 WARN                   pulse
> > >
> /home/icchw/oe-core/build/out-glibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/gstreamer1.0-plugins-good/1.4.1-r0/gst-plugins-good-1.4.1/ext/pulse/pulsesink.c:678:gst_pulsering_stream_underflow_cb:<pulsesink0>
> > > Got underflow
>
> These underflows sound bad. Does capture work fine without AEC?
>
> -- Arun
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-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/20160613/540f9f2b/attachment.html>


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux