noise-suppression-for-voice icon indicating copy to clipboard operation
noise-suppression-for-voice copied to clipboard

Configuring with Raspberry Pi

Open RXAldreezee opened this issue 3 years ago • 13 comments

RXAldreezee avatar Mar 26 '21 01:03 RXAldreezee

Hello, I'm currently in the process of installing this in my Raspberry Pi. I'm having trouble with

This needs to be executed every time PulseAudio is launched. You can automate this by creating file in >~/.config/pulse/default.pa with the content:

.include /etc/pulse/default.pa

load-module module-null-sink sink_name=mic_denoised_out rate=48000 load-module module-ladspa-sink sink_name=mic_raw_in sink_master=mic_denoised_out label=noise_suppressor_mono >plugin=/path/to/librnnoise_ladspa.so control=50 load-module module-loopback source=your_mic_name sink=mic_raw_in channels=1 source_dont_move=true >sink_dont_move=true

set-default-source mic_denoised_out.monitor

RXAldreezee avatar Mar 26 '21 01:03 RXAldreezee

It doesn't work or am I missing something?

pi@raspberrypi:~ $ ~/.config/pulse/default.pa bash: /home/pi/.config/pulse/default.pa: No such file or directory pi@raspberrypi:~ $ .include /etc/pulse/default.pa bash: .include: command not found pi@raspberrypi:~ $ pi@raspberrypi:~ $ load-module module-null-sink sink_name=mic_denoised_out rate=48000 bash: load-module: command not found pi@raspberrypi:~ $ load-module module-ladspa-sink sink_name=mic_raw_in sink_master=mic_denoised_out label=noise_suppressor_mono plugin=/path/to/librnnoise_ladspa.so control=50 bash: load-module: command not found pi@raspberrypi:~ $ load-module module-loopback source=your_mic_name sink=mic_raw_in channels=1 source_dont_move=true sink_dont_move=true bash: load-module: command not found pi@raspberrypi:~ $ pi@raspberrypi:~ $ set-default-source mic_denoised_out.monitor bash: set-default-source: command not found

RXAldreezee avatar Mar 26 '21 01:03 RXAldreezee

Not sure if it helps,

this is what I use in a docker container:

FROM arm32v7/debian:buster-slim as buildbase

LABEL maintainer="R. van Twisk <[email protected]>"

ENV DEBIAN_FRONTEND noninteractive
RUN echo 'APT::Get::Assume-Yes "true";\nAPT::Get::allow-remove-essential "true";' > /etc/apt/apt.conf.d/90forceyes && \
    echo 'APT::Install-Recommends "false";\nAPT::Install-Suggests "false";' > /etc/apt/apt.conf.d/90norecommends

RUN apt-get update && \
    apt-get full-upgrade &&  \
    apt-get install ca-certificates git-core cmake build-essential pkg-config debhelper wget udev git

WORKDIR /tmp
RUN mkdir /tmp/build


##########################################################################################
FROM buildbase as ladspa
WORKDIR /tmp
RUN cd /tmp/build && \
    git clone https://github.com/werman/noise-suppression-for-voice && \
    cd noise-suppression-for-voice  && \
    cmake -Bbuild-x64 -H. -DCMAKE_BUILD_TYPE=Release && cd build-x64 && make && \
    ls -ial

rvt avatar Mar 26 '21 14:03 rvt

@RXAldreezee You just pasted the config in the terminal. Instead you should create a file with pulseaduio config as said in the readme. Also you should substitute /path/to/librnnoise_ladspa.so, your_mic_name, and so on with paths/names which are appropriate for your system.

werman avatar Mar 27 '21 11:03 werman

Ok, I should make a notepad file named default.pa in >~/.config/pulse/

The default.pa file should contain the following:

.include /etc/pulse/default.pa

load-module module-null-sink sink_name=mic_denoised_out rate=48000 load-module module-ladspa-sink sink_name=mic_raw_in sink_master=mic_denoised_out label=noise_suppressor_mono >plugin=/path/to/librnnoise_ladspa.so control=50 load-module module-loopback source=your_mic_name sink=mic_raw_in channels=1 source_dont_move=true >sink_dont_move=true

set-default-source mic_denoised_out.monitor

Is this correct?

RXAldreezee avatar Mar 27 '21 11:03 RXAldreezee

If your goal is to denoise microphone output then, yes, you should create this file, paste the configuration you pasted, and edit it to contain the microphone name your system has and the path to the plugin instead of placeholders I placed there.

It seems that it would be better for you to use a more newbie friendly solutions like PulseEffects or any other GUI which contain RnNoise implementation.

werman avatar Mar 27 '21 11:03 werman

I'm using an ARM based Raspberry Pi 4, I have checked Cadmus and NoiseTorch but none of them is compatible with the Pi. Are there any other solutions than those two?

RXAldreezee avatar Mar 27 '21 12:03 RXAldreezee

PulseEffects might work on RPi, however it seems to depends on distro... https://github.com/wwmm/pulseeffects/issues/804

werman avatar Mar 27 '21 12:03 werman

I also don't think that other apps are really incompatible, it's just that you probably would need to build them yourself.

werman avatar Mar 27 '21 12:03 werman

Here are the contents of my ~/.config/pulse/default.pa

.include /etc/pulse/default.pa

load-module module-null-sink sink_name=mic_denoised_out rate=48000 load-module module-ladspa-sink sink_name=mic_raw_in sink_master=mic_denoised_out label=noise_suppressor_mono plugin=/home/pi/Downloads/noise-suppression-for-voice-master/build/bin/ladspa/librnnoise_ladspa.so control=50 load-module module-loopback source=alsa_input.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00.analog-mono sink=mic_raw_in channels=1 source_dont_move=true sink_dont_move=true

set-default-source mic_denoised_out.monitor

Is everything all right?

RXAldreezee avatar Mar 27 '21 13:03 RXAldreezee

Looks right, however it's always hard to tell with pulseaudio, does it work?

werman avatar Mar 30 '21 20:03 werman

I just created the default.pa file using a text editor and changing the extension to .pa, is it correct?

I'm using Audacity to test but it doesn't work, There are three choices for input device which are: USB_PnP_Sound_Device, pulse and default.

RXAldreezee avatar Mar 31 '21 01:03 RXAldreezee

I managed to run this on raspberry pi. I tested it and it works! https://github.com/josh-richardson/cadmus/issues/64

RXAldreezee avatar Apr 17 '21 00:04 RXAldreezee