rnnoise-cli icon indicating copy to clipboard operation
rnnoise-cli copied to clipboard

How to make renoise work on ReSpeaker Core v2?

Open DivanX10 opened this issue 2 years ago • 2 comments
trafficstars

There is a ReSpeaker Core v2 microphone array, where Debian 11 OS is installed. Python version 3.9. For Rhasspy Voice Assistant to work, I would like to set up microphone noise reduction using rnnoise to cut off various sounds, such as music, different background noises. I installed pip install r n noise-cli and I can't activate the virtual microphone, errors are pouring in, although the microphone appears

Hardware Architecture: ARMV7 (armhf)

image

How to make renoise work on ReSpeaker Core v2?

Log
respeaker@v2:~$ rnnoise
Usage: rnnoise [OPTIONS] COMMAND [ARGS]...

Options:
  --version      Show the version and exit.
  -v, --verbose  Print more.
  --help         Show this message and exit.

Commands:
  activate    Activate the noise suppression plugin.
  control     Subcommands to manage the control level.
  deactivate  Deactivate the noise suppression plugin.
  license     Show license info and exit.
  list        List available devices.
  status      Show whether the LADSPA plugin is loaded.
respeaker@v2:~$ rnnoise --version
rnnoise, version 1.0.3
respeaker@v2:~$ rnnoise list
[0]  alsa_output.platform-sound_0.seeed-2ch.monitor  Monitor of Built-in Audio seeed-2ch
[1]  alsa_input.platform-sound_0.seeed-8ch           Built-in Audio seeed-8ch
[2]  mic_denoised_out.monitor                        Monitor of Null Output
[3]  rnnoise_mic_denoised_out.monitor                Monitor of RNNoise Denoised Sink
respeaker@v2:~$ rnnoise status
The plugin is not loaded.
respeaker@v2:~$ rnnoise activate
[0]  alsa_output.platform-sound_0.seeed-2ch.monitor  Monitor of Built-in Audio seeed-2ch
[1]  alsa_input.platform-sound_0.seeed-8ch           Built-in Audio seeed-8ch
[2]  mic_denoised_out.monitor                        Monitor of Null Output
[3]  rnnoise_mic_denoised_out.monitor                Monitor of RNNoise Denoised Sink
Number or name of device to use [0]: 1
Traceback (most recent call last):
  File "/usr/local/bin/rnnoise", line 8, in <module>
    sys.exit(rnnoise())
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/decorators.py", line 38, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/rnnoise_cli/commands.py", line 100, in activate
    PulseInterface.load_modules(device, control, ctx.verbose, set_default)
  File "/usr/local/lib/python3.9/dist-packages/rnnoise_cli/pulse/pulse.py", line 121, in load_modules
    loaded[cls.ladspa_sink_name] = cls.pulse.module_load(
  File "/usr/local/lib/python3.9/dist-packages/pulsectl/pulsectl.py", line 691, in module_load
    raise PulseError('Failed to load module: {} {}'.format(name, args))
pulsectl.pulsectl.PulseError: Failed to load module: b'module-ladspa-sink' b'sink_name=rnnoise_mic_raw_in sink_master=rnnoise_mic_denoised_out label=noise_suppressor_mono plugin="/usr/local/lib/python3.9/dist-packages/rnnoise_cli/data/librnnoise_ladspa.so" control=50 sink_properties="device.description=\'RNNoise Raw Input Sink\'"'
respeaker@v2:~$ rnnoise deactivate
No loaded modules found (already deactivated?), try --force-unload-all if you are sure.
respeaker@v2:~$
respeaker@v2:~$ rnnoise status
The plugin is not loaded.

DivanX10 avatar Apr 09 '23 20:04 DivanX10

Looks like it fails to load the pulse module, but the error provided by the pulsectl lib doesn't provide much info. Can you check if the plugin path, /usr/local/lib/python3.9/dist-packages/rnnoise_cli/data/librnnoise_ladspa.so, actually exists and is accessible to your user? Maybe there's a limitation or issue in pulseaudio, or the pulsectl python bindings I'm using, or rnnoise-cli at some point that is specific to your platform or armv7, but I'm not familiar with it.

IniasP avatar Apr 11 '23 18:04 IniasP

Yes, there is such a thing/usr/local/lib/python3.9/dist-packages/rnnoise_cli/data/librnnoise_ladspa.so

image image

I managed to run NoiseTorch ng on this project, but something I don't like how it works, it eliminates the sounds, but the words are swallowed. I thought maybe your option would be better, the more it is put easier and easier to configure, but unfortunately it does not work on armv7

DivanX10 avatar Apr 11 '23 19:04 DivanX10