NRSpeechToText
Introduction
NRSpeechToText: This library provides the speech to text functionality with the help iOS speech framework.
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
Xcode 9+ , Swift 4 , iOS 9 and above
Plist Keys & Background Mode
Please make sure you have the below keys in your plist file before using the speech services.
<key>Privacy - Microphone Usage Description</key>
<string>We will use this microphone for testing our demo.</string>
<key>Privacy - Speech Recognition Usage Description</key>
<string>We will speech recognition for testing demo</string>
Installation
NRSpeechToText is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "NRSpeechToText"
Usage
@IBAction func microphoneButtonPressed(_ sender: AnyObject) {
NRSpeechToText.shared.authorizePermission { (authorize) in
if authorize {
if NRSpeechToText.shared.isRunning {
NRSpeechToText.shared.stop()
OperationQueue.main.addOperation {
self.microphoneButton.setTitle("Start Recording", for: .normal)
}
}
else {
OperationQueue.main.addOperation {
self.microphoneButton.setTitle("Stop Recording", for: .normal)
}
self.startRecording()
}
}
}
}
func startRecording() {
NRSpeechToText.shared.startRecording {(result: String?, isFinal: Bool, error: Error?) in
if error == nil {
self.textView.text = result
}
}
}
Contributing
Contributions are always welcome! (:
- Fork it ( http://github.com/naveenrana1309/NRSpeechToText/fork )
- Create your feature branch ('git checkout -b my-new-feature')
- Commit your changes ('git commit -am 'Add some feature')
- Push to the branch ('git push origin my-new-feature')
- Create new Pull Request
Compatibility
Xcode 9+ , Swift 4 , iOS 10 and above
Author
Naveen Rana. See Profile
Email: [email protected].
Check out Facebook Profile for detail.
License
NRSpeechToText is available under the MIT license. See the LICENSE file for more info.