-
Notifications
You must be signed in to change notification settings - Fork 39
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
Text to Speech #154
Comments
I was trying to use FFI to call NVDA and have it read the text shown in game. After throwing ideas back and forth with @Splendide-Imaginarius I eventually managed to find a working solution: $tts = Win32API.new("nvdaControllerClient64.dll", "nvdaController_speakText", "p", "v")
def tts(text)
$tts.call(text.encode('utf-16le'))
end Adjustments might be needed to use on platforms other than windows since the encoding would likely need to be different than (You can consider this code snippet licensed under WTFPL.) |
I recently made an improvement to this. There is a library called Tolk which is like an abstraction layer which can support multiple readers. I ended up using this fork which is more actively maintained. With this we're able to support more screen readers than just NVDA. Win32API.new("libTolk.dll", "Tolk_Load", "", "v").call()
$tts = Win32API.new("libTolk.dll", "Tolk_Output", "p", "v")
def tts(text)
$tts.call(text.encode('utf-16le'))
end There is also an alternative library called UniversalSpeech. I didn't try it but it should work pretty much identically, just with different API. |
It might be interesting to support TTS in mkxp-z. Not sure what the implementation would look like, but Ren'Py has TTS, so maybe we could crib ideas from them.
(h/t @enumag and @Eblo)
The text was updated successfully, but these errors were encountered: