MediaPipeTasksAudio Framework Reference

TtsStream

public final class TtsStream : @unchecked Sendable

Bidirectional / pull-based streaming synthesis handle supporting incremental LLM text pushing (pushText + finishInput) alongside readNext() and cancel() (also available as TTSStream).

  • Appends an incremental text fragment into the sentence chunker.

    Declaration

    Swift

    public func pushText(_ textDelta: String) throws
  • Marks the end of incremental text input, flushing any trailing partial sentence.

    Declaration

    Swift

    public func finishInput() throws
  • Pulls the next synthesized TtsAudioChunk synchronously, or returns nil at end-of-stream.

    Declaration

    Swift

    public func readNext() throws -> TtsAudioChunk?
  • Lock-free cancellation for this stream.

    Declaration

    Swift

    public func cancel()
  • Cancels any in-flight synthesis and marks this stream as closed.

    Declaration

    Swift

    public func close()