Much googling tells me TTS is a very under-developed space for lua and Love and the best I could find was this command line app that can run locally:
https://github.com/espeak-ng/espeak-ng/ ... s/index.md
I've never thought about how I might have my game in Love2d doing the regular game loop thing and then occasionally executing a command line outside the program.
Let's assume the command line is visually hidden and non-interrupting. Would launching a command line program with command and parameters from Love2d be possible?
I'm expecting a less than stellar gaming experience but might be a fun experiment.
Text to speech
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Text to speech
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/pad-and-pencil-gridiron
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/pad-and-pencil-gridiron
- BrotSagtMist
- Party member
- Posts: 665
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Text to speech
Congrats to your 666th post.
What do you ask here? Having löve run another program constantly in the background?
That would be io.popen inside a thread, not too hard.
In that case it doesnt matter what language it is in anyway.
What do you ask here? Having löve run another program constantly in the background?
That would be io.popen inside a thread, not too hard.
In that case it doesnt matter what language it is in anyway.
obey
- BrotSagtMist
- Party member
- Posts: 665
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Text to speech
I tried with popen to no luck. This works tho, kinda funny.
Edit: I missed the buffer for popen:
Code: Select all
local op=print
local channel=love.thread.newChannel()
local tcode=[[
channel = ...
repeat
text=os.execute("espeak '"..channel:demand().."'")
until false
]]
Lthread = love.thread.newThread( tcode )
Lthread:start(channel)
print=function(...) channel:push(table.concat({...})," ") op(...) end
Tx=""
function love.textinput(t)
Tx=Tx..t
end
function love.keypressed(_,k)
if k=="return" then
print(Tx)
Tx=""
end
end
Code: Select all
local tcode=[[
channel = ...
handle=io.popen("espeak","w")
handle:setvbuf ("no")
repeat
handle:write(channel:demand().."\n")
until false
]]
obey
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Text to speech
If you don't care much about quality (that is, humanlike sounding output), then technically you could implement a "simple" (relatively, that is) tts like SAM; source code has been available for some time, just needs some porting to lua; there's already a js version available, besides the C source.
Also, löve supports queueable sources, so you can technically generate sound realtime as well; that includes speech.
Also, löve supports queueable sources, so you can technically generate sound realtime as well; that includes speech.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Text to speech
Thanks. I have since found what seems to be the real solution (for Windows) and that is to use the speech API:
https://github.com/fiendish/MS_Speech_API_Lua
I've yet to test it.
I'd lose OS portability but was almost certain to happen anyway - unless I used zorgs' approach.
https://github.com/fiendish/MS_Speech_API_Lua
I've yet to test it.
I'd lose OS portability but was almost certain to happen anyway - unless I used zorgs' approach.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/pad-and-pencil-gridiron
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/pad-and-pencil-gridiron
Re: Text to speech
Hey! I've used that from C++. It works well. there are additional voices you can use, some are paid. It was a while ago, but I think I had access to some at&t voices at the time.togFox wrote: ↑Tue May 02, 2023 2:31 am Thanks. I have since found what seems to be the real solution (for Windows) and that is to use the speech API:
https://github.com/fiendish/MS_Speech_API_Lua
I've yet to test it.
I'd lose OS portability but was almost certain to happen anyway - unless I used zorgs' approach.
If I remember right, the MS API package also came with a 'say' command. spawning it from a thread to say a single line of text also worked well.
Re: Text to speech
Great. I'm hoping that lua module, and its dependency, will be a no-fuss way of getting some entry- level TTS.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/pad-and-pencil-gridiron
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/pad-and-pencil-gridiron
Who is online
Users browsing this forum: Bing [Bot] and 1 guest