Installation
Requirements
| Tool or platform | Minimum |
|---|---|
| iOS | 16.0 |
| macOS | 14.0 |
| Swift | 5.9 |
| Xcode | 15 |
Xcode
Choose File → Add Package Dependencies, then enter:
https://github.com/KittenML/KittenTTS-swift
Add the KittenTTS library product to the app target.
Package.swift
dependencies: [
.package(
url: "https://github.com/KittenML/KittenTTS-swift",
from: "0.1.0"
),
],
targets: [
.target(
name: "YourApp",
dependencies: [
.product(name: "KittenTTS", package: "KittenTTS-swift")
]
),
]
The package brings ONNX Runtime through Microsoft's Swift Package Manager package and compiles the CE phonemizer bridge as C++17.
First initialization
let tts = try await KittenTTS { progress in
print("Download: \(Int(progress * 100))%")
}
Initialization downloads phonemizer dictionaries, the ONNX model, and voices.npz if they are not cached. It then creates the inference engine off the calling actor.
Use KittenTTS.isModelCached() to choose whether the UI should present a download step.