I am getting a error while running a pttsx3 code as root. So the code should save a file and say the words inputted. Here is the code:
import pyttsx3
engine = pyttsx3.init()
s1 = input("Words: ")
engine.say(s1)
engine.save_to_file(s1 ,'try.mp3')
engine.runAndWait()
And here is the error:
ALSA lib pcm_dmix.c:1035:(snd_pcm_dmix_open) unable to open slave
aplay: main:831: audio open error: Device or resource busy
Running this code without root works, but I need to run it as root because I am adding it to another code that needs root. Note: I tried using gtts but I need a male voice to beatbox.