Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Lua Voice Recognition

edited November 2014 in Questions Posts: 41

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?

Comments

  • IgnatzIgnatz Mod
    Posts: 5,396

    try google

  • I tried, didn't find a straightforward answer. I'll keep looking.

  • IgnatzIgnatz Mod
    Posts: 5,396

    unlikely, then

  • Posts: 688

    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.

  • Posts: 2,820

    @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!

  • Posts: 1,976

    Either way, Codea doesn't have microphone access...

  • Posts: 2,820

    @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.

  • Posts: 2,042

    @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?

  • Posts: 2,820

    @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!

  • edited May 24 Posts: 15

    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.

  • dave1707dave1707 Mod
    Posts: 7,879

    @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.

  • dave1707dave1707 Mod
    Posts: 7,879

    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
    
  • Posts: 15

    @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.

  • Posts: 15

    @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)
    Thank you.

  • dave1707dave1707 Mod
    Posts: 7,879

    @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.

  • AnatolyAnatoly Mod
    Posts: 873
    the first thing we’d need is sound input api.

    then some sort of ai may do it
Sign In or Register to comment.