Integration of Renpy & Pyspeech?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
mncdeleon
Newbie
Posts: 8
Joined: Thu Jun 21, 2012 8:37 pm
Contact:

Integration of Renpy & Pyspeech?

#1 Post by mncdeleon »

Hey there ^^, umm I'm new to Renpy & Python in General so yeah ...
does anyone know if it's possible to use pyspeech in renpy?
& how do you code it? ._.

We're kind of developing a reading game for dyslexic children & we took an interest in renpy
cause it seemed to be the easiest engine to work on.
The idea is, the child should read/repeat the words in the screen or what the character in the screen has said..

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Integration of Renpy & Pyspeech?

#2 Post by PyTom »

Do you want speech synthesis, or speech recognition. The latter is much harder - probably too hard for practical use.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
mncdeleon
Newbie
Posts: 8
Joined: Thu Jun 21, 2012 8:37 pm
Contact:

Re: Integration of Renpy & Pyspeech?

#3 Post by mncdeleon »

PyTom wrote:Do you want speech synthesis, or speech recognition. The latter is much harder - probably too hard for practical use.
speech recognition, apparently :|
so we'd know how fast the reader could read
or if he could read it correctly.

do you have an idea how should this be done? :cry:

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Integration of Renpy & Pyspeech?

#4 Post by PyTom »

I think the hard part is getting speech recognition that is reliable enough for your purposes. My cell phone is only about 75% accurate - I have to say that if I'm a child having problems with speech, then being told a correct utterance was wrong 25% of the time would be incredibly frustrating.

If you can figure out how to get sufficiently accurate speech recognition in a python program, or a command-line program - and I can't help you with that - I can help you hook that up to Ren'Py.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
mncdeleon
Newbie
Posts: 8
Joined: Thu Jun 21, 2012 8:37 pm
Contact:

Re: Integration of Renpy & Pyspeech?

#5 Post by mncdeleon »

PyTom wrote:I think the hard part is getting speech recognition that is reliable enough for your purposes. My cell phone is only about 75% accurate - I have to say that if I'm a child having problems with speech, then being told a correct utterance was wrong 25% of the time would be incredibly frustrating.

If you can figure out how to get sufficiently accurate speech recognition in a python program, or a command-line program - and I can't help you with that - I can help you hook that up to Ren'Py.

thanks for the concern :)
currently we we're able to install pyspeech (link :http://code.google.com/p/pyspeech/)
we were also able to test it out in the command line on windows, do you think pyspeech
will be reliable enough or could you suggest anything that would work well with ren'py?

so how can we hook pyspeech to renpy?

User avatar
aicilef37
Newbie
Posts: 9
Joined: Mon Jul 02, 2012 12:49 am
Contact:

Re: Integration of Renpy & Pyspeech?

#6 Post by aicilef37 »

i have also heard about pyspeech.. i think it's the easiest voice recognition to learn to link to ren'py since they are both related to python. i think it doesn't matter if it's not accurate in translating voices.. i just want to be able to talk to my character.. so how do i do this?

is it possible to just import my code? what part do i import it in? or is there something else i should install? i heard you can't insert pygame in renpy without renpygame :( thank you very much.

tigerninjaman
Newbie
Posts: 3
Joined: Mon May 13, 2024 7:32 am
Contact:

Re: Integration of Renpy & Pyspeech?

#7 Post by tigerninjaman »

Hi, apologies for resurrecting a decade-old thread, but this pops up when searching for renpy and ASR/TTS. Would there be a way, now that speech recognition programs in python are fairly good, to integrate something like python's SpeechRecognition into ren'py?

giorgi1111
Regular
Posts: 48
Joined: Sat May 04, 2024 10:40 pm
Contact:

Re: Integration of Renpy & Pyspeech?

#8 Post by giorgi1111 »

As i understood you need something like this https://github.com/mmirthula02/AI-Perso ... ing-Python but integrated in renpy. Im using pymysql in renpy but i dont think you can use all python modules straight in renpy

tigerninjaman
Newbie
Posts: 3
Joined: Mon May 13, 2024 7:32 am
Contact:

Re: Integration of Renpy & Pyspeech?

#9 Post by tigerninjaman »

Perhaps something like that, giorgi - my thinking is basically to hijack `renpy.input` to ask the user to speak instead of type, then use ASR to generate a string based on the audio. Then the generated character response string would also be sent to TTS to generate audio.
It looks like RenPyUtil might be useful ( https://github.com/ZYKsslm/RenPyUtil ) but I can't quite figure out how to integrate it, and I'm not great at reading simplified Chinese.

tigerninjaman
Newbie
Posts: 3
Joined: Mon May 13, 2024 7:32 am
Contact:

Re: Integration of Renpy & Pyspeech?

#10 Post by tigerninjaman »

Would it work to sidestep renpy.input and have it entirely in python? Something like the below. Another way I saw was to run a local server and use python's socket to send stuff and receive responses outside of the script.

Code: Select all

define y = Character("you")
init python:
	import speech_recognition as sr
	rec = sr.Recognizer()
	with sr.Microphone() as source:
	    print("Say something!")
	    audio = rec.listen(source)
	spoken_input = rec.recognize_sphinx(audio) # or google, or other ASR program
label start:
	y "you say:"
    python:
    	with sr.Microphone() as source:
	    print("Say something!")
	    audio = rec.listen(source)
	   	spoken_input = rec.recognize_sphinx(audio)
    if(len(spoken_input) > 0):
        $ renpy.block_rollback()
        y "[spoken_input]"
        jump generate_response
    # Otherwise, do it again
    else:
    	jump <somewhere>

giorgi1111
Regular
Posts: 48
Joined: Sat May 04, 2024 10:40 pm
Contact:

Re: Integration of Renpy & Pyspeech?

#11 Post by giorgi1111 »

As i said im using pymysql.as i remmeber i put it in renpy803/lib and in rpy straight import pymysql .i see in some projects in project folder they have game and pythonpackages and putting there. Using import pythonpackages.pymysql but as i searched only pure python works. I tryed some python codes to straight used in my apps.but some part worked some part not worked. I tryed to convert py into rpy but it does not worked too.especialy if code have requirment of other modules.

giorgi1111
Regular
Posts: 48
Joined: Sat May 04, 2024 10:40 pm
Contact:

Re: Integration of Renpy & Pyspeech?

#12 Post by giorgi1111 »

You can try that code in your project.i tryed some codes 900 times.for example when using result = fetchall. I need to defined default result =() default oneresult = [] and to get data from that it needed [oneresult[name]] not basic python oneresult("name") and its problem too if key is like some allready defined variable :)

Post Reply

Who is online

Users browsing this forum: bilmem, SypherZent