AudioChunk
struct AudioChunk: Sendable, EquatableIncremental mono PCM audio chunk emitted by TextToSpeech.synthesizeStream(_:options:).
-
Declaration
Swift
init(samples: [Float], sampleRateHz: Int = 24000, chunkIndex: Int = 0, isFinal: Bool = false, wordTimestamps: [WordTimestamp] = []) -
Zero-based monotonic index of this chunk within the stream.
Declaration
Swift
var chunkIndex: Int -
Duration of this chunk in seconds.
Declaration
Swift
var durationSeconds: Float { get } -
True if this is the final chunk of the synthesis stream.
Declaration
Swift
var isFinal: Bool -
Audio sample rate in Hz (e.g. 24000 for Kokoro-82M).
Declaration
Swift
var sampleRateHz: Int -
Normalized 32-bit floating-point mono PCM samples in
[-1.0, 1.0].Declaration
Swift
var samples: [Float] -
Word-level timing alignments for this chunk.
Declaration
Swift
var wordTimestamps: [WordTimestamp]