werman / noise-suppression-for-voice

Noise suppression plugin based on Xiph's RNNoise
GNU General Public License v3.0
4.73k stars 228 forks source link

Add ALSA config example #53

Open Nephiel opened 3 years ago

Nephiel commented 3 years ago

After some trial and error I finally got the LADSPA plugin to work with ALSA (without PulseAudio).

Here's a snippet for the capture PCM device, to use in ~/.asoundrc or your preferred alsa conf file:

[...]

  capture.pcm {
    # Add an ALSA plug for LADSPA
    type plug
    slave.pcm {
      # Add the LADSPA noise filter
      type ladspa
      slave.pcm {
        # Convert from float to int
        type lfloat
        slave {
          format "S16_LE"
          pcm "hw:1,0"       # Use card 1 (e.g. USB webcam soundcard), device 0 (the default)
        }
      }
      # LADSPA configuration for the noise filter
      # See https://github.com/werman/noise-suppression-for-voice
      path "/usr/lib/ladspa"
      capture_plugins [
        {
          label noise_suppressor_mono
          input { controls [ 50 ] }      # VAD Threshold %
        }
      ]
    }
  }

[...]

Maybe it could be helpful to add this to the How-to, under Linux.

werman commented 3 years ago

Thank you! I'll add this snippet.

StuartIanNaylor commented 3 years ago

The above is an absolutely golden example as had been battling away and would never of got type lfloat

Had to rename capture.pcm to pcm.capture compiled on a Pi4 running @ 2.0Ghz.

Had to drop the VAD sensitivity to really low values though.

no-rnnoise https://drive.google.com/open?id=1pIH5O_TP6YoNrp9ql2rr_t5LmnpMB9QE rnnoise https://drive.google.com/open?id=1_Qr-XaaaxEy-nQeiS8GaTVCWCd1egde_

Its actually a good attempt by the pi4 running pios 64bit lite @ 2.0Ghz There is prob some optimisation and neon use that could provide much better results as its very good for what it is. Have a hunch though the Aarch64 compile may not work as well as x86_64

PS pcm.capture { was all I had to change