Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoactivate #8

Closed
majedbawarshi opened this issue Feb 15, 2022 · 8 comments
Closed

Autoactivate #8

majedbawarshi opened this issue Feb 15, 2022 · 8 comments

Comments

@majedbawarshi
Copy link

majedbawarshi commented Feb 15, 2022

Would you please guide me on how can I run the plugin automatically when the OS is up?
I have tried to run the plugin on the OS bootup using systemd service but that didn't work.. I kept getting PulseAudio warnings..

@majedbawarshi
Copy link
Author

@Edesem I would appreciate your help if you guide me on how have you autoactivated the plugin using the .xinitrc.

@Edesem
Copy link

Edesem commented Feb 15, 2022

#5 (comment)

@majedbawarshi
Copy link
Author

majedbawarshi commented Feb 21, 2022

After lots of research, I found this on how to run the plugin as a service without any error in the PulseAudio..
https://github.com/lawl/NoiseTorch/wiki/Start-automatically-with-Systemd
Please check it out... Can I do something similar using this plugin? I keep getting either permission errors or PulseAudio errors... I am really suffering...

@majedbawarshi
Copy link
Author

The previous link is for a similar plugin that runs the LADSPA rnn model..

@Edesem
Copy link

Edesem commented Feb 22, 2022

Can I do something similar using this plugin?

My answer would be... probably???
I'm only knowledgable on arch linux related stuff. I have never used ubuntu so I don't know exactly how the entire thing works, and my knowledge on systemd despite using it, is also zero.

You should probably just use noise torch though and do what they said as it it would essentially be doing the same thing.
Here is the redpill, Noisetorch, Cadmus and Rnnoise-cli are literally the same thing and should get you the same results. Why? Because they are all based on this plugin, and that plugin is based on the Rnnoise library. I have Rnnoise-cli run automatically, so I literally never touch it or feel the need to touch it. Unless you think you would want to tinker with it a lot (although what you can do is quite limited) then you may as well use the Noisetorch as the functionality should be the exactly same and the results would be the same as well. Unless you are hyper dedicated to CLI and minimalism which I doubt as you are using Ubuntu (not an insult just an observation btw) then follow the thread you linked and you should be good :)

@majedbawarshi
Copy link
Author

majedbawarshi commented Feb 22, 2022

The reason why I am using this plugin is that I can tweak it the way I want easily because it is python based. The second reason is that I want to access the plugin simultaneously using the CLI directly. Regarding the thing you mentioned about using Ubuntu, I am using it as a development environment. the production environment is totally GUI and gnome-free.
Please provide your help if you know anything regarding the issue. else just ignore it.

@Edesem
Copy link

Edesem commented Feb 22, 2022

Ahh fair enough. My knowledge has ended here but wish you the best of luck to sorting out your issue

@majedbawarshi
Copy link
Author

I have resolved the issue successfully the other day.

I will post the solution to help those who might face the same issue.

The key solution to the problem is that the package systemd (rnnoise-cli) belongs to the OS user, not to the core system services. Meaning that the service MUST be in the ~/.config/systemd/user/ instead of /etc/systemd/system/. The reason for that is PulseAudio service would not be running yet when the system initializes and run the /etc/systemd/system/ services. Therefore you wouldn't see your virtual mic if you place your service there.

Here is how your service must look like:

[Unit]
Description=rnnoise-cli activating service
After=pulseaudio.service

[Service]
Type=simple
RemainAfterExit=yes
ExecStart=%h/.local/bin/rnnoise activate
ExecStop=%h/.local/bin/rnnoise deactivate --force-unload-all
ExecReload=/usr/bin/kill $MAINPID
Restart=on-failure
RestartSec=6

[Install]
WantedBy=default.target

You may save the previous configuration inside ~/.config/systemd/user/rnnoise-cli.service.
Next you should restart the user services deamon by running systemctl --user daemon-reload to load your service to the user service.
In order to run the service you should run systemctl --user start rnnoise-cli && systemctl --user enable rnnoise-cli.

Now your service will start every time you boot your system up. You can restart your service by systemctl --user restart rnnoise-cli or getting your service status by running systemctl --user restart rnnoise-cli.

Important note: you must add your mic name in the package config files as mentioned in the README.md file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants