> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/argmaxinc/WhisperKit/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> On-device text-to-speech with Qwen3 TTS models on Apple silicon

TTSKit is an on-device text-to-speech framework built on Core ML. It runs [Qwen3 TTS](https://github.com/QwenLM/Qwen3-TTS) models entirely on Apple silicon with real-time streaming playback, no server required.

## Quick Start

```swift theme={null}
import TTSKit

Task {
    let tts = try await TTSKit()
    let result = try await tts.generate(text: "Hello from TTSKit!")
    print("Generated \(result.audioDuration)s of audio at \(result.sampleRate)Hz")
}
```

`TTSKit()` automatically downloads the default 0.6B model on first run, loads the tokenizer and six CoreML models concurrently, and is ready to generate.

## Requirements

* macOS 15.0 or later
* iOS 18.0 or later
* Xcode 16.0 or later

## Features

<CardGroup cols={2}>
  <Card title="Real-Time Streaming" icon="waveform-lines">
    Generate and play audio frame-by-frame with adaptive buffering
  </Card>

  <Card title="Multiple Voices" icon="microphone">
    9 built-in voices across 10 languages
  </Card>

  <Card title="Concurrent Generation" icon="gauge-high">
    Automatic text chunking with parallel generation
  </Card>

  <Card title="Style Control" icon="sliders">
    Natural-language prosody instructions (1.7B model)
  </Card>
</CardGroup>

## Model Variants

TTSKit ships two model sizes:

| Model    | Size     | Platforms  | Features                           |
| -------- | -------- | ---------- | ---------------------------------- |
| **0.6B** | \~1 GB   | macOS, iOS | Fast, runs on all devices          |
| **1.7B** | \~2.2 GB | macOS only | Higher quality, style instructions |

```swift theme={null}
// Fast, runs on all platforms
let tts = try await TTSKit(TTSKitConfig(model: .qwen3TTS_0_6b))

// Higher quality, macOS only
let tts = try await TTSKit(TTSKitConfig(model: .qwen3TTS_1_7b))
```

Models are hosted on [HuggingFace](https://huggingface.co/argmaxinc/ttskit-coreml) and cached locally after the first download.

## Architecture

TTSKit follows the same component-based architecture as WhisperKit. The pipeline consists of six model components:

```swift theme={null}
public class TTSKit {
    // Model components (protocol-typed, swappable)
    public var textProjector: any TextProjecting
    public var codeEmbedder: any CodeEmbedding
    public var multiCodeEmbedder: any MultiCodeEmbedding
    public var codeDecoder: any CodeDecoding
    public var multiCodeDecoder: any MultiCodeDecoding
    public var speechDecoder: any SpeechDecoding
    public var tokenizer: (any Tokenizer)?
}
```

Each component can be swapped at runtime:

```swift theme={null}
let config = TTSKitConfig(load: false)
let tts = try await TTSKit(config)
tts.codeDecoder = MyOptimizedCodeDecoder()
try await tts.loadModels()
```

## Model Lifecycle

TTSKit provides fine-grained control over model loading:

```swift theme={null}
// Auto-load on init (default)
let tts = try await TTSKit()

// Manual control
let config = TTSKitConfig(load: false)
let tts = try await TTSKit(config)

// Prewarm: compile models sequentially to cap peak memory
try await tts.prewarmModels()

// Load: load all models concurrently
try await tts.loadModels()

// Unload to free memory
await tts.unloadModels()
```

The `modelState` property tracks the current lifecycle state:

```swift theme={null}
public enum ModelState {
    case unloaded
    case downloading
    case downloaded
    case loading
    case loaded
    case prewarming
    case prewarmed
    case unloading
}
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Generate Speech" icon="waveform" href="/ttskit/generation">
    Learn about generation options and chunking
  </Card>

  <Card title="Playback" icon="play" href="/ttskit/playback">
    Stream audio with real-time playback strategies
  </Card>

  <Card title="Voices & Languages" icon="globe" href="/ttskit/voices-and-languages">
    Explore available voices and language support
  </Card>

  <Card title="Configuration" icon="gear" href="/ttskit/configuration">
    Configure compute units and model variants
  </Card>
</CardGroup>
