OSSSpeech
public class OSSSpeech : NSObject
Speech is the primary interface. To use, set the voice and then call .speak(string: "your string")
-
Delegate allows for the recieving of spoken events.
Declaration
Swift
public weak var delegate: OSSSpeechDelegate?
-
An object that allows overriding the default AVVoice options.
Declaration
Swift
public var voice: OSSVoice?
-
The object used to enable translation of strings to synthsized voice.
Declaration
Swift
public var utterance: OSSUtterance?
-
A singleton object to ensure conformity accross the application it is used in.
Declaration
Swift
public class var shared: OSSSpeech { get }
-
Pass in a string to speak. This will set the speechString on the utterance.
Declaration
Swift
public func speakText(text: String)
Parameters
text
An String object.
-
Pass in an attributed string to speak. This will set the attributed string on the utterance.
Declaration
Swift
public func speakAttributedText(attributedText: NSAttributedString)
Parameters
attributedText
An NSAttributedString object.
-
Record and recognise speech
This method will check to see if user is authorised to record. If they are, the recording will proceed.
Upon checking the authorisation and being registered successful, a check to determine if a recording session is active will be made and any active session will be cancelled.
Declaration
Swift
public func recordVoice()
-
End recording of speech session if one exists.
Declaration
Swift
public func endVoiceRecording()
-
Docs available by Google searching for SFSpeechRecognitionTaskDelegate
Declaration
Swift
public func speechRecognitionTask(_ task: SFSpeechRecognitionTask, didFinishSuccessfully successfully: Bool)
-
Docs available by Google searching for SFSpeechRecognitionTaskDelegate
Declaration
Swift
public func speechRecognitionTask(_ task: SFSpeechRecognitionTask, didHypothesizeTranscription transcription: SFTranscription)
-
Docs available by Google searching for SFSpeechRecognitionTaskDelegate
Declaration
Swift
public func speechRecognitionTask(_ task: SFSpeechRecognitionTask, didFinishRecognition recognitionResult: SFSpeechRecognitionResult)
-
Docs available by Google searching for SFSpeechRecognizerDelegate
Declaration
Swift
public func speechRecognizer(_ speechRecognizer: SFSpeechRecognizer, availabilityDidChange available: Bool)
-
Method outputs a debug statement containing necessary information to resolve issues.
Only works with debug/dev builds.
Declaration
Swift
public func debugLog(object: Any, functionName: String = #function, fileName: String = #file, lineNumber: Int = #line, message: String)
Parameters
object
Any object type
functionName
Automatically populated by the application
fileName
Automatically populated by the application
lineNumber
Automatically populated by the application
message
The message you wish to output.