PocketTTS/PocketTtsManager.swift

PhoneClaw · Packages/FluidAudio/Sources/FluidAudio/TTS/PocketTTS/PocketTtsManager.swift · swift · Apache-2.0
voice

Actor managing PocketTTS synthesis with model loading and audio generation for text-to-speech.

// Source: https://github.com/kellyvv/PhoneClaw | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import Foundation
import OSLog

/// Manages text-to-speech synthesis using PocketTTS CoreML models.
///
/// PocketTTS uses a flow-matching language model architecture that generates
/// audio autoregressively at 24kHz. Each generation step produces an 80ms
/// audio frame (1920 samples).
///
/// Example usage:
/// ```swift
/// let manager = PocketTtsManager()
/// try await manager.initialize()
/// let audioData = try await manager.synthesize(text: "Hello, world!")
/// ```
public actor PocketTtsManager {

    private let logger = AppLogger(category: "PocketTtsManager")
    private let mo

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key