Creates an audio input converter.
- Parameters:
- analyzerFormat: The audio format to convert the audio samples to. The audio format should be one supported by the speech analyzer's modules.
- configurationHandler: A closure called to customize the instances of `AVAudioConverter` that this converter creates as needed. The closure takes the following parameter:
- term audioConverter: A newly-created instance of `AVAudioConverter`.
method · iOS 27.0+
flush
TypeScript
flush(): Array<AnalyzerInput>
Swift declaration
final func flush() throws -> [AnalyzerInput]
Completes pending audio conversions.
- Returns: An array of `AnalyzerInput` objects containing completed pending audio conversions.
final func convert(_ buffer: AVAudioBuffer, at audioTime: AVAudioTime?) throws -> [AnalyzerInput]
Converts an audio buffer.
This method does not necessarily convert the entire audio buffer. Some audio data may be held over and integrated into the conversion of a later audio buffer for correctness or efficiency.
Call ``flush()`` to convert any remaining held-over audio and add it to the analyzer's input sequence before finishing the sequence.
- Parameters:
- buffer: An audio buffer to convert. Do not reuse or modify this buffer; it may be retained across calls.
- audioTime: The time-code of the start of the audio buffer. If `nil`, the audio buffer is assumed to start immediately after the previous buffer (or at time-code zero if there is no previous buffer).
- Returns: An array of `AnalyzerInput` objects containing converted audio corresponding to some or all of the audio buffer.
Returns an audio input converter compatible with the given modules.
- Parameter modules: The speech modules that will analyze the audio.
- Returns: An instance of this class.