about voice recognition
Posted: Fri Jul 01, 2016 1:08 pm
Hola!
Thanks to this program I've started to learn Python because I'm trying to create my own speech recognition files for my flighsims.
Until now I've used to do something like this:
But this way requires too much work, a function for each voice command. So, searching another way I've found that the lists could be a more effective solution. First I create a list with all the voice commands and later I can use their index as variable to use it with keyboard.setPressed. For example:
and later:
My question is: I have not yet been able to get work the first if (if speech.said(something):) Is not possible use speech.said in this way? Maybe I'm doing something wrong (as I said before I'm learning Python since a two weeks ago).
Thank you for your time.
Regards
Thanks to this program I've started to learn Python because I'm trying to create my own speech recognition files for my flighsims.
Until now I've used to do something like this:
Code: Select all
# ++++ CALL TANKER
if speech.said("tanker"):
tanker_call()
def tanker_call():
keyboard.setPressed(Key.Y)
Code: Select all
comms = ["option01","option02","option03","option04"]
Code: Select all
mic= keyboard.getKeyDown(Key.Home)
if starting:
something="none"
if mic & speech.said(something): #if the user press mic button and say "something"...
commsOption = comms.index(something)
sayMessage(commsOption)
def sayMessage(opt):
keys=[Key.D1,Key.D2,Key.D3,Key.D4,Key.D5,Key.D6,Key.D7,Key.D8,Key.D9,Key.D0]
keyboard.setPressed(keys[opt],True)
Thank you for your time.
Regards