Closed themegaxandy closed 10 months ago
That's what I also was looking at a bit for the same reason. And this definitely should work: assuming you got PowerShell 7 installed. To be safe, also remove quotes from variable first.
I'm not too sure how viable a separate TTS action is, though. As this would need to be cross-system, so Microsoft-related solutions won't be enough and I'm not too sure there are similar readily available tools for Linux/Mac.
So this would need to be done through something like https://github.com/rhasspy/piper which is cross-system and supports bunch of languages/voices. I plan to play with it and Run
locally to see how it performs on weekend.
@Destroy666x Now I was able to use the TTS to work through the plugin's "Run" action. I didn't know the arguments were supposed to be separated like that.
However, I am having difficulty capturing the audio coming from the new powershell process. In OBS, I don't use capture all audio from my computer, but rather application audio capture. It does not appear in the dropdown menu list, and even if you manually define the exe through the plugin itself, no audio is captured.
@themegaxandy are you using win-audio-capture plugin? That's still better in terms of separating sound. I'm not sure how to catch PowerShell with that as I haven't messed with that yet. but I'll let you know once I find out. I assume OBS/Switcher spawns a separate process for that or at least I hope.
@Destroy666x Yes, it starts a new process, and appears within the OBS Studio process in the Task Manager. And I'm using OBS's native application audio capture.
If it's new process under OBS then the plugin should help as it shows OBS while the in-built one doesn't. I quickly checked and I don't see a specific PowerShell subprocess though, so might be impossible to separate just TTS.
Unless...
There's also a way to start new processes with e.g. cmd /C
cmd in Windows, that could help, if it works with Switcher. You could try.
I found a way to do it using Piper, the tool @Destroy666x mentioned.
All I did was use the plugin to write the TTS message to a text.txt file. Then I used the Run action to run a speak.bat file. This file contains the following content: piper --model <voice model file here>.onnx --output-raw < text.txt | "C:/Program Files (x86)/VideoLAN/VLC/vlc.exe" --play-and-exit --demux=rawaud --rawaud-channels=1 --rawaud-samplerate=22050 --rawaud-fourcc= s16l -
.
Basically this .bat file will tell Piper to stream the speech synthesis of whatever is in this text.txt file to VLC, in which OBS will be capturing the audio as soon as VLC is opened (the VLC UI has to appear, otherwise OBS will not be able to capture the audio).
It's a bit of a workaround, but it was the way I managed to make it work, as I couldn't make the plugin's Run action work because of the "|" character. I don't really understand how it works, nor why I have to put each argument separately in the plugin. If anyone knows how to make it work, I'd be grateful to know, because then I wouldn't need a text.txt file, nor a speak.bat file.
Is your feature request related to a problem? Please describe. It would be interesting if there was an action to use TTS in this plugin.
Describe the solution you'd like Windows itself has its built-in TTS, which could be used here, so that it would not depend on the internet and a cloud solution. According to an article on another site, it is possible to generate TTS on Windows using these commands:
Using PowerShell.exe:
PowerShell -Command "Add-Type –AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('hello');
Using mshta.exe:
mshta vbscript:Execute("CreateObject(""SAPI.SpVoice"").Speak(""Hello"")(window.close)")
Describe alternatives you've considered I tried using the plugin's "Run" action, but I was unsuccessful in generating the TTS, although I was successful in a normal CMD window.