noisetorch / NoiseTorch

Real-time microphone noise suppression on Linux.
Other
9.35k stars 232 forks source link

Add support for CLI operation without opening the UI #37

Closed cipriancraciun closed 4 years ago

cipriancraciun commented 4 years ago

It would be lovely to have some CLI arguments to just load / unload the Pulse plugin, without having to resort to the UI.

This is especially useful for those that want to create quick shortcut scripts to run for example with dmenu, rofi or on a key binding.

lawl commented 4 years ago

Not sure about this one, I have two questions:

cipriancraciun commented 4 years ago

What would be the benefit over loading https://github.com/werman/noise-suppression-for-voice with a script directly?

Well the short answer is that NoiseTorch seems quite well focused and simple to use tool. (I'll take a look at that project.) Thus my only answer to this question is that NoiseTorch is the first tool I've used to for voice activation, thus I would prefer to keep using it. :)

How would you select which input device to load NT for?

In the end, if you want to keep things simple and not implement an entire CLI, how about this:

Now the user can just run noisetorch execute {token} or create a shortcut for that. (If it's a load command, and the plugin is already loaded, just unload it before re-loading it.)

It's not nice, but it allows one to "snapshot" a given configuration and load it quickly; say implementing a kind of "presets" outside NoiseTorch itself.

lawl commented 4 years ago

I'll have to decline that suggestion for the UI, this seems overly complicated, sorry. NoiseTorch also uses werman's project which I've linked, including some changes I have already upstreamed, so there's no difference there really. NoiseTorch just abstracts away the pulseaudio plumbing required to set it up.

Thinking about it, these would be the benefits over using werman's LADSPA wrapper directly:

That said, I'm torn at the moment if this is enough to justify making a CLI interface vs. telling people to just do the pulseaudio plumbing themselves.

cipriancraciun commented 4 years ago

What I've described was just a "quick hack" UI. In the end my feature request was just for a way (any way) to simply obtain the same loading / unloading effects without the UI, from the CLI.

lawl commented 4 years ago

Yes, understood, and I have a rough idea how a CLI could look like. But I want to think about this a bit more.

cipriancraciun commented 4 years ago

As a side-note, having these shortcuts might allow one to easily work around the high CPU usage issue as reported in #41.

stemid commented 4 years ago

Hi so NoiseTorch uses the werman noise-suppression-for-voice plugin. But when I tried the werman plugin I could not get proper audio. Only distorted.

If I use NoiseTorch, which is apparently just a wrapper, I get proper audio.

So my question is, what does NoiseTorch do different from the pacmd commands werman recommends? I would also really like to use the plugin directly.

Part of the reason for this is that NoiseTorch requests sudo when you enable it, why? I pressed Cancel and it still worked. So I denied it sudo and it still worked. Using pulseaudio should not require sudo.

Edit: Ok I read the docs now on why it requires sudo. Apparently my system does allow this loading so I just hit cancel.

I'd really just like to see the PulseAudio config that NoiseTorch implements so I can do it myself. I don't like having unnecessary big programs around.

lawl commented 4 years ago

@stemid please don't spam random issues with questions and create an appropriate issue if you have a question. I will flag this as off topic and hide it.

That said, you can find the module loading code here. https://github.com/lawl/NoiseTorch/blob/master/module.go that should answer all your questions.

lawl commented 4 years ago

This has been implemented by @chance-nelson and is now merged and shipped in 0.7.0-beta.