Simple Voice Recognition Swift? [closed]
Asked Answered
G

3

6

In my app when the user says a certain word or words the app will answer by reading out a sentence which is set in app. What is the simplest way of doing this?

I'm using the latest version of Xcode (Its for my WWDC 2015 scholarship app)

Greg answered 10/4, 2015 at 20:59 Comment(0)
T
5

you can use

OpenEars SDK http://www.politepix.com/openears/

or

AT&T Watson http://developer.att.com/apis/speech

Tati answered 29/4, 2015 at 13:51 Comment(0)
B
9

As of iOS 10 you can use Speech.framework:

import Speech

let recognizer = SFSpeechRecognizer()
let request = SFSpeechURLRecognitionRequest(url: audioFileURL)
recognizer?.recognitionTask(with: request, resultHandler: { (result, error) in
     print (result?.bestTranscription.formattedString)
})
Baler answered 22/6, 2016 at 20:42 Comment(3)
what is this audioFileURLNorseman
The URL of the audio file you want to be recognized. You can also use an audio buffer if you want real time recognitionBaler
But Speech framework has limitation of one minute recording. And how to achieve for long audio file. Like recording from time to time in the audio file.Obligato
T
5

you can use

OpenEars SDK http://www.politepix.com/openears/

or

AT&T Watson http://developer.att.com/apis/speech

Tati answered 29/4, 2015 at 13:51 Comment(0)
S
3

You'll want to use SpeechKit. Ray has a nice tutorial here:

http://www.raywenderlich.com/60870/building-ios-app-like-siri

The SDK is developed by Nuance (the dragon people):

http://nuancemobiledeveloper.com/public/index.php

Sauer answered 10/4, 2015 at 21:5 Comment(6)
My app is coded in Swift, a lot of people including me had a lot of trouble trying to get speechKit to work on swift. Would you perhaps know any other tutorials in swift? Thanks a lot!Greg
@Greg You can always use Objective-C and Swift together in the same application. Simply write the parts interfacing with SpeechKit in Objective-C then interface with that using a bridging header. I don't know of any other good tutorials that I'd recommend but I'll keep lookingSauer
I´m struggling to make my Swift app use Speechkit. Initializing works fine but I cant figure out how to implement override callback methods from SpeechKit (didFinishWithErrors, didFinishWithResults, etc) into the .swift code. Just adding those methods to a protocol won´t do, you can add methods there, but it does not make any sense.Priorate
Well I have used SpeechKit in my Swift app working perfectly.Tunisia
@Tunisia can you please post your Swift based implementation (either here or in a new new SO post, please?)Moitoso
@Moitoso there is a simple example here that works in Swift 2.Manvel

© 2022 - 2024 — McMap. All rights reserved.