Hey all, this question really isn’t for Codea but just Lua in General. Is there a way to add voice recognition in a lua project? Is there some sort of specific library or something?
I tried, didn’t find a straightforward answer. I’ll keep looking.
You’d need some kind of objective-C library that would be able to take in a block of sound data, process it and return the contents as a string.
You’d then need to link this library in as an addon or by editing the exported xcode project - it would be impossible to handle this kind of number crunching via a scripting language like Lua.
There may be some kind of online service that you could upload data to and then get a response back, but you’d still need access to the microphone to capture the data and a socket library to allow the kind of uploads you’d need. Neither of which exist in the Codea libs at the moment.
@TechDojo nailed what I was going to say right on the head. There aren’t many free services out there to synthesize speech, however, which is very disappointing. That being said, back in the iOS 8 b1 there was hidden code that hinted at a 3rd party Siri API which may bring the functionality you want to iOS.
It’s not really for something I would put in Codea or on the AppStore. It’s just a Lua program I wanted to make, but since Lua doesn’t apparently have a voice recognition module or library addon then I guess I will have to use another language. Thanks for the replies guys!
Either way, Codea doesn’t have microphone access…
@Perscirious - The language doesn’t matter. No language has it built in, and it wouldn’t make sense for it to be, since the language is only the brains, not the mechanics. It’s a matter of the library you find. I’ve done some researching before for a speech recognition library that’s free before, and there’s not much out there.
@Zoyt what about the one built into iOS?
@Zoyt , you mentioned that there were no free speech recognition libraries. So does that mean that there are some possibly paid speech recognition libraries?
@JakAttak - That’s only speech synthesis. It doesn’t actually recognize the text you speak.
@Perscirious - I just took about 30 seconds to research it a bit more, since it’s been a while since I researched it last. One of the most used (and I think paid) solutions is the speech recognition library by Nuance, yet there’s something called OpenEars which I just ran across that is a free library that’s pretty widely used also.
Hope that helps!
So is it possible to do it because i am sort of new and don’t understand it completely on this. So i need to know if its possible because I’m making a personal assistant and it will make it easier with voice recognition and please post example code.
@joaquin I think it’s possible even though I’ve never tried it. It would be a matter of saving the amplitude and frequency of a phrase, Hey Codea in a table and comparing that with whoever is saying it.
Here’s an example using mic.amplitude and mic.frequency. This works pretty good if you have a metronome that output a solid tone at different frequencies.
displayMode(FULLSCREEN) function setup() mic.start() fill(255) backingMode(RETAINED) x,xh=0,0 ah,fh=600,0 stroke(255) strokeWidth(2) end function draw() amp=mic.amplitude a=amp*1000+600 freq=mic.frequency f=freq/3 stroke(255) line(xh,ah,x,a) stroke(255,0,0) line(xh,fh,x,f) xh=x ah=a fh=f if x>WIDTH then x=0 xh=0 background(0) end text("amplitude",100,550) text("frequency",100,150) x=x+1 end
@dave1707 Thanks for everything I really thought no one will answer me because this a very old conversation but someone did and I like you’re idea it actually might work.
@dave1707 hello again I’ve been using your code up above for a while now and it’s working fine but sometimes there are random noises that registers as my voice(for some reason)and messes everything up. Could you please make a new version of it.(not making one because I don’t know any other way of making it)
@joaquin I don’t know what to fix. The random noises could be anything around you. Try running the program without making any noise and see what registers.
the first thing we’d need is sound input api.
then some sort of ai may do it