AudioTranscriber
class AudioTranscriber: NSObjectPerforms automatic speech recognition (ASR) on streaming mono PCM float audio samples.
-
Creates a new instance of
MPPAudioTranscriberfrom an absolute path to a model asset bundle stored locally on the device and the defaultMPPAudioTranscriberOptions.Declaration
Swift
convenience init(modelPath: String) throwsParameters
modelPathAn absolute path to a model file stored locally on the device.
Return Value
A new instance of
MPPAudioTranscriberwith the given model path.nilif there is an error in initializing the audio transcriber. -
Creates a new instance of
MPPAudioTranscriberfrom the givenMPPAudioTranscriberOptions.Declaration
Swift
init(options: AudioTranscriberOptions) throwsParameters
optionsThe options of type
MPPAudioTranscriberOptionsto use for configuring theMPPAudioTranscriber.Return Value
A new instance of
MPPAudioTranscriberwith the given options.nilif there is an error in initializing the audio transcriber. -
Releases underlying inference engine and processor resources.
Declaration
Swift
func close() throws -
Flushes any remaining buffered audio and finalizes the current stream.
Declaration
Swift
func finishStream() throws -> AudioTranscriberResultReturn Value
An
MPPAudioTranscriberResultcontaining any final emitted segments, ornilon error. -
Prewarms the underlying inference engine to reduce first-chunk latency.
Declaration
Swift
func prewarm() throws -
Transcribes a contiguous buffer of mono PCM float audio samples in
[-1.0, 1.0].Declaration
Swift
func transcribe(samples: UnsafePointer<Float>?, count length: UInt, endOfStream: Bool) throws -> AudioTranscriberResultParameters
samplesPointer to a contiguous array of mono PCM float audio samples.
lengthNumber of float samples in
samples.endOfStreamWhether this chunk marks the end of the audio stream.
Return Value
An
MPPAudioTranscriberResultcontaining any emitted segments, ornilon error. -
Transcribes an array of mono PCM float audio samples in
[-1.0, 1.0].Declaration
Swift
func transcribe(samples: [NSNumber], endOfStream: Bool) throws -> AudioTranscriberResultParameters
samplesArray of
NSNumberfloat values representing mono PCM audio samples.endOfStreamWhether this chunk marks the end of the audio stream.
Return Value
An
MPPAudioTranscriberResultcontaining any emitted segments, ornilon error.