noise suppression with librespeaker in RespeakerCorev2

info about ReSpeaker series products

Moderators: lily.li, violet, seth.welday

chdyejiewei
Pre-kindergarten
Pre-kindergarten
Posts: 22
Joined: Mon Oct 15, 2018 3:11 pm

Re: noise suppression with librespeaker in RespeakerCorev2

Post by chdyejiewei » Thu Dec 20, 2018 10:16 am

Hi Fred,

The capture and playback sample rate of seeed voicecard should be the same in Alsa setup. So we have to configure Alsa(edit /etc/asound.conf file) as follow:

Code: Select all

sudo nano /etc/asound.conf

Code: Select all

pcm.!default {
    type asym
    #capture.pcm "hw:Loopback,1,0"
    capture.pcm "seeedvoicecard"
    #playback.pcm "plughw:seeed8micvoicec,1"
    playback.pcm "play"
}

defaults.pcm.rate_converter "samplerate"

pcm.seeedvoicecard {
    type plug
    slave.pcm "hw:seeed8micvoicec,0"
    #slave.rate 48000
    #slave.format FLOAT_LE
    ttable.0.0 1
    ttable.1.1 1
    ttable.2.2 1
    ttable.3.3 1
    ttable.4.4 1
    ttable.5.5 1
    ttable.6.6 1
    ttable.7.7 1
}

pcm.play {
    type plug
    slave.pcm "hw:seeed8micvoicec,1"
    slave.rate 48000
}
After configuration, you can still play your audio at any sample rate as you want, because Alsa will resample it to 48K automatically.
Hope this helps!

Thanks,
Jerry.

frederic.bost
Pre-kindergarten
Pre-kindergarten
Posts: 10
Joined: Fri Mar 23, 2018 10:22 am

Re: noise suppression with librespeaker in RespeakerCorev2

Post by frederic.bost » Fri Dec 21, 2018 3:56 am

Good catch!
That works great now.
Thank you very much

In the meantime, I also tried to play with the hybrid node but could not compile the line:
hybrid.reset(HybridNode::Create(true,3,1,0,true,0,false));

The compilation returned a load error:
$ g++ arecord_lv.cc -o arecord_lv -lrespeaker -lsndfile -fPIC -std=c++11 -fpermissive -I/usr/include/respeaker/ -DWEBRTC_LINUX -DWEBRTC_POSIX -DWEBRTC_NS_FLOAT -DWEBRTC_APM_DEBUG_DUMP=0 -DWEBRTC_INTELLIGIBILITY_ENHANCE
/tmp/ccPFm7fm.o: In function `main':
arecord_lv.cc:(.text+0x812): undefined reference to `respeaker::HybridNode::Create(bool, int, int, int, bool, int, bool)'
collect2: error: ld returned 1 exit status

Do you know if this function is still in the new version of the library?

Thanks
Fred

chdyejiewei
Pre-kindergarten
Pre-kindergarten
Posts: 22
Joined: Mon Oct 15, 2018 3:11 pm

Re: noise suppression with librespeaker in RespeakerCorev2

Post by chdyejiewei » Fri Dec 21, 2018 5:18 pm

Hi Fred,

Yes, there is a bug in this node and thank you to point this out. I have recompiled the librespeaker, please download it again at this link:
https://v2.fangcloud.com/share/11a20219 ... f8?lang=en

Thanks so much!
Jerry

frederic.bost
Pre-kindergarten
Pre-kindergarten
Posts: 10
Joined: Fri Mar 23, 2018 10:22 am

Re: noise suppression with librespeaker in RespeakerCorev2

Post by frederic.bost » Sat Dec 22, 2018 4:08 am

This one works perfectly well
Thanks you very much
Great service
Fred

frederic.bost
Pre-kindergarten
Pre-kindergarten
Posts: 10
Joined: Fri Mar 23, 2018 10:22 am

Re: noise suppression with librespeaker in RespeakerCorev2

Post by frederic.bost » Sun Jan 06, 2019 8:14 pm

Hello,

I have some issues with with the noise reduction example using aloop.
When I record after an "aplay" command, I have a big initial pop in my recording.
For example:
aplay phrase.wav
sox -d -t wavpcm -c 1 -b 16 -r 16000 -e signed-integer --endian little record.wav trim 0 1
Then in my file record.wav, there is a big pop at the beginning that you can hear with aplay.

If I record twice in a row, then the second file is good, meaning:
aplay phrase.wav
sox -d -t wavpcm -c 1 -b 16 -r 16000 -e signed-integer --endian little record.wav trim 0 1
sox -d -t wavpcm -c 1 -b 16 -r 16000 -e signed-integer --endian little record2.wav trim 0 1
The file record.was has the pop but the file record2.wav is good (no initial pop in it).

I hope that you can reproduce and let me know how to fix this because it is causing problem when submitted next to the ASR.

Moreover, I noticed big variation in the volume of my recording. It varies from one recording to another but sometimes within the recording itself (e.g. starting loud and finishing low). I played with the agc parameter and even disable it but without any luck.

Thanks for your help

chdyejiewei
Pre-kindergarten
Pre-kindergarten
Posts: 22
Joined: Mon Oct 15, 2018 3:11 pm

Re: noise suppression with librespeaker in RespeakerCorev2

Post by chdyejiewei » Mon Jan 14, 2019 9:58 am

Hi Fred,

Can you try to record at first and aplay after it? And the format of pharse.wav should be same as the recordings, which means it should be 16-bit. If pharse.wav is not 16-bit, I think you should use an Alsa plugin to play it.

Post Reply