Small Swift package for text-to-speech with Hugging Face models running through mlx-audio-swift.
TTSMLX is intentionally TTS-only. Upstream mlx-audio also supports STT, STS, quantization utilities, and server paths, but those surfaces are not wrapped by this package yet.
- Simple actor-based API
- Streaming playback API for long-form speech
- Narration toolkit: segments with exact boundaries,
[pause]markers, duration fitting, levels and silences of each take, per-segment streaming - One voice, feature and control surface across every model:
TTSModelDescriptor.features, annotatedTTSVoices,TTSSynthesisOptions.instruction/emotion/speedand canonicalTTSEventTagmarkers, translated per loader - Natural prosody: punctuation-aware chunking, model-tuned sampling, breath-like pauses and click-free seams between chunks (
TTSChunkJoin) - Built-in catalog of supported MLX TTS models
- Hugging Face model search
- Lazy model download and cache management
- Voice and language selection when the model supports them
- Reference-audio voice cloning hooks
- Content-addressable
TTSAudioCache+ backgroundTTSPrefetchQueuewith thermal/Low-Power-Mode gating TTSPlaybackControllerwith pitch-preserving speed control (0.5×–2.0×),currentTime/duration/seek(to:), and atimePulseasync stream for scrubber UIs- Per-chunk and per-word timing diagnostics for highlight overlays (
TTSDiagnostic.chunkTimings,TTSChunkInfo.wordTimings(forDuration:)) - Typed
synthesizer.events()AsyncStream<TTSDiagnostic>for SwiftUI consumers TTSPreparedNarrationbundles — ship pre-generated audio + word timings with the app, play back instantly without MLX or model download (useful for onboarding voiceovers)- Device-aware model selection (
TTSModelDescriptor.isSupported(on:),TTSMLX.recommendedModel(for:)) - Typed errors (
.deviceUnsupported,.outOfMemory,.modelLoadFailed,.generationFailed,.networkUnavailable) and a stage-awareTTSError.wrap(...)
See Docs/0.5-migration.md for the consumer-app upgrade briefing for the 0.5 additions.
Every model with a descriptor in TTSMLX.modelCatalog, where it is gated to
run, and whether this repository has measured it there. The gate is the
catalog's minimumDeviceClass plus peakMemoryMB: iPhone means any
iPhone, iPad or Mac with enough memory, Mac means Mac only. Validated
entries are in TTSMLX.supportedModels and eligible for
recommendedModel(for:); implemented entries synthesize end to end but an
app has to pick them explicitly. Full detail, including where each model was
measured, is in Docs/compatibility.md; numbers are in
Docs/benchmarks.md; the licence tier of every entry is
in the catalog (TTSModelDescriptor.license).
| Model | Stage | Runs on | Languages | Voices and controls | Licence |
|---|---|---|---|---|---|
Marvis-AI/marvis-tts-250m-v0.2-MLX-8bit |
validated | iPhone | en | default voice, streaming | Apache-2.0 |
mlx-community/pocket-tts |
validated | iPhone | en | 8 presets (two non-commercial), streaming | CC-BY-4.0 |
mlx-community/Soprano-80M-bf16 |
validated | iPhone | en | one voice, streaming | Apache-2.0 |
mlx-community/VyvoTTS-EN-Beta-4bit |
validated | iPhone | en | one voice | unknown |
mlx-community/orpheus-3b-0.1-ft-bf16 |
validated | Mac | en | 8 presets, event tags | Apache-2.0 |
mlx-community/Qwen3-TTS-12Hz-0.6B-Base-8bit |
validated | iPhone by gate; measured: Mac only (iOS killed it at paragraph length on an iPhone 17) | 15 | default voice, cloning | Apache-2.0 |
mlx-community/MOSS-TTS-Nano-100M |
validated | iPhone | 19 | 7 presets, cloning, streaming | Apache-2.0 |
mlx-community/Qwen3-TTS-12Hz-0.6B-Base-4bit |
implemented | iPhone by gate; measured: Mac only (same 3.4 GB codec peak, killed on an iPhone 17) | 15 | as 8-bit, smaller | Apache-2.0 |
mlx-community/Qwen3-TTS-12Hz-1.7B-Base-4bit |
implemented | iPhone (6 GB+) | 15 | as 0.6B, better prosody | Apache-2.0 |
mlx-community/Qwen3-TTS-12Hz-1.7B-CustomVoice-4bit |
implemented | iPhone (6 GB+) | 15 | 9 presets, instruction | Apache-2.0 |
mlx-community/Qwen3-TTS-12Hz-0.6B-CustomVoice-4bit |
implemented | iPhone | 15 | 9 presets, instruction | Apache-2.0 |
mlx-community/Soprano-80M-4bit |
implemented | iPhone | en | one voice, streaming | Apache-2.0 |
mlx-community/Soprano-1.1-80M-bf16 |
implemented | iPhone | en | one voice, streaming | Apache-2.0 |
mlx-community/Kokoro-82M-bf16 |
implemented | iPhone | 8 | 54 presets, speed | Apache-2.0 |
gradium/phonon-31m-en |
implemented | iPhone | en | one voice | Apache-2.0 |
mlx-community/MeloTTS-English-MLX |
implemented | iPhone | en | 5 accents, speed | MIT |
mlx-community/chatterbox-turbo-4bit |
implemented | iPhone | en | default voice, cloning, event tags | MIT |
mlx-community/chatterbox-4bit |
implemented | iPhone | 7 listed (23 upstream) | cloning, expressiveness, event tags | MIT |
mlx-community/Ming-3.0-tts-0.5B-bf16 |
implemented | iPhone | 7 | 8 presets, instruction, emotion, speed, voice design, cloning | MIT |
mlx-community/VibeVoice-Realtime-0.5B-8bit |
implemented | iPhone by gate; measured: Mac for live playback (1x realtime with stalls on an iPhone 17) | en (+9 experimental) | 25 presets, streaming | MIT |
mlx-community/OmniVoice |
implemented | Mac | 6 | voice design, instruction, cloning | CC-BY-NC (non-commercial) |
mlx-community/Voxtral-4B-TTS-2603-mlx-4bit |
implemented | iPhone | 9 | 20 presets | CC-BY-NC-4.0 (non-commercial) |
mlx-community/VoxCPM2-4bit |
implemented | Mac | 30 | voice design (free text or TTSVoiceDesign), cloning, controllable cloning, high-fidelity continuation, streaming, seed, 48 kHz (guide) |
Apache-2.0 |
mlx-community/VoxCPM1.5-4bit |
implemented | Mac | en, zh | cloning (clip + transcript), 44.1 kHz | Apache-2.0 |
Which models an app may ship commercially: TTSMLX.models(maximumTier: .attributionRequired).
The leaderboard-wide view, including models the runtime routes to but
TTSMLX has not synthesized with, is Docs/model-support.md;
the research behind the Priority A candidates (licences, streaming
semantics, existing ports) is Docs/model-research.md.
Quick picking guide:
- Fast English on a phone:
Kokoro(fastest, 54 voices) orPocket TTS(smallest, streams per 80 ms frame). - Multilingual on a phone:
MOSS-TTS-Nano(19 languages, streams). Qwen3-TTS 0.6B is a Mac model: both quantisations peak above 3 GB in the codec decode and iOS kills them on an iPhone 17. - Conversational on a Mac:
VibeVoice Realtime(audio while it generates) orMOSS-TTS-Nano. - Expressive on a Mac:
Chatterbox(cloning, emotion),Ming(instruction, emotion, voice design). - Long-form narration:
Kokoro,Pocket TTS,Qwen3-TTSthroughsynthesizeLongorprepareNarration. - The measured basis for these picks is in Docs/benchmarks.md.
Current upstream note:
- As of
0.10.0,TTSMLXruns on upstreamBlaizzy/mlx-audio-swiftv0.1.8 through the thin forkfil-technology/mlx-audio-swift @ 0.1.8-tts.5(38 TTS families; the fork only addsTTSModelRegistry, MOSS-TTS-Nano bundled voices and the regular-Chatterbox text-pipeline fixes), and onfil-technology/mlx-swift @ 0.33.100(upstream 0.33.0 whosemlxC++ submodule points atmlx @ v0.33.0-tts-bg-safe.1, the iOS background-safe Metal patch).mlx-swift-lmis no longer a dependency. SeeDocs/mlx-swift-bg-safe-fork.mdandDocs/model-support.md. - The catalog lists a model with a descriptor (selectable by apps) only once TTSMLX has synthesized with it end to end; the 0.1.8 runtime routes to 38 families, and the ones not yet validated here (Higgs v3, OmniVoice, Voxtral, LongCat, Dia, ...) are listed discovery-only with the reason in their
runtimeNotes.Docs/model-support.mdhas the full tts-bench leaderboard matrix. Kitten TTSstays discovery-only: the runtime's loader needsvoices.safetensors, and the mlx-community checkpoint shipsvoices.npz.MOSS-TTS-Nanoruns on upstream's port plus the fork's bundled voices; reference-audio cloning now works through upstream's codec encoder.- Upstream additions outside the TTS wrapper scope, such as
Cohere Transcribe ASR,Qwen2-Audio-7B-Instruct,Moshi STS, and Distil-Whisper documentation updates, are not exposed throughTTSMLXyet.
Docs/benchmarks.md holds the numbers this repository measured itself, per
device and build: cold and warm load, first audio, realtime factor, playback
stalls, MLX peak and resident memory, CPU and thermal state, for three fixed
fixtures (a sentence, a news paragraph, a 275-word narration) on both the
narration path (synthesizeLong) and the model's own streaming path
(synthesizeStream). Docs/model-research.md is the audited catalog behind
them: licences, streaming semantics, existing ports and what each candidate
would cost to integrate.
The harness is part of the framework (TTSBenchmarkRunner), so an app can
run it on its own devices:
let report = try await TTSBenchmarkRunner.run(
.init(modelID: "mlx-community/Kokoro-82M-bf16", trials: 3))
print(report.textLines().joined(separator: "\n"))
try report.write(into: reportsDirectory) // JSONFrom the repo, Tools/bench.sh mac [models…] runs it on this Mac through
the test target and DEVICE=<name> Tools/bench.sh device [models…] on a
connected iPhone through the demo app, then Tools/bench.sh pull copies the
reports back; python3 Tools/render-benchmarks.py rewrites
Docs/benchmarks.md from Benchmarks/results/*.json.
On the phone the demo app shows a status screen for the whole run (elapsed
time, what it is doing now, finished models, the scrolling log) and keeps the
screen awake until the run ends: a locked phone backgrounds the app and iOS
refuses Metal compute, which cancels generation. The same keep-awake applies
while the demo tabs synthesize. The log also streams to the Mac console
(devicectl … --console) and is written to Documents/benchmarks/benchmark.log
in the app container. A trial cancelled by the app going inactive is retried
twice and noted in the report instead of failing the model.
TTSMLX exposes a public support catalog so app code can distinguish between validated, implemented, and planned models:
let validated = TTSMLX.validatedModels
let planned = TTSMLX.plannedModels
for entry in TTSMLX.modelCatalog {
print(entry.displayName, entry.supportStage.rawValue, entry.modelURL?.absoluteString ?? "n/a")
}Nothing in this catalog is downloaded automatically.
Models are downloaded only when you explicitly call ensureDownloaded(...), or when you synthesize using a specific selected model.
Where models live: on iOS, iPadOS, tvOS, watchOS and visionOS the store downloads into Library/Application Support/huggingface/hub (excluded from backup) rather than Library/Caches, which the system purges without notice; installs from earlier versions are moved there on first use. On macOS the runtime's own cache (~/.cache/huggingface/hub, or HF_HOME / HF_HUB_CACHE) is used. TTSModelStore(cacheRoots:) overrides both.
Hear every catalogued model before you pick one: Docs/model-previews.md lists languages, voices, features and a short clip per voice (the same sentence on every model, plus the benchmark paragraph on the measured ones, several recorded on an iPhone 17), and the playable page has inline players.
import TTSMLX
let synthesizer = TTSSpeechSynthesizer()
let result = try await synthesizer.synthesize(
"Hello from TTSMLX",
using: TTSMLX.supportedModels[0],
options: .init(
language: .english,
outputURL: URL.documentsDirectory.appending(path: "hello.wav")
)
)
print(result.url)Add TTSMLX to your Swift package dependencies:
.package(url: "https://github.com/fil-technology/TTSMLX.git", from: "0.8.0")Then depend on the TTSMLX product in your target.
TTSMLX builds against two forked dependencies, pinned exact in
Package.swift. Both carry patches that are not in any upstream tagged
release, so resolving upstream instead of the fork either fails to compile or
silently ships without a crash fix. When you add or bump TTSMLX, let it drive
these — don't pin older versions of them yourself.
| Dependency | Required | Why the fork |
|---|---|---|
mlx-audio-swift |
fil-technology/mlx-audio-swift 0.1.8-tts.6 |
Upstream v0.1.8 plus TTSModelRegistry (queryable loader table and companion repositories, which TTSMLX calls directly) and MOSS-TTS-Nano bundled voices / codebook dial / per-chunk decoding; since 0.1.8-tts.4 the regular-Chatterbox fixes (multilingual config detection, reference-faithful text pipeline with [SPACE] and language tags); since 0.1.8-tts.5 it names fil-technology/mlx-swift directly (no consumer mirror) and exposes Chatterbox prepared conditioning. 0.1.8-tts.6 adds VoxCPM2 prompt modes (reference / continuation), per-call CFG, steps and seed, and per-patch streaming. |
mlx-swift |
fil-technology/mlx-swift 0.33.100 |
Upstream 0.33.0 with the MLX C++ submodule repointed at fil-technology/mlx, which ignores the iOS background-clamp error on in-flight Metal command buffers (Metal-in-background crash fix). The .100 patch number is reserved so the tag can never collide with an upstream release. |
Since 0.15.0 no SwiftPM mirror is needed: the mlx-audio-swift fork names the background-safe fil-technology/mlx-swift itself, so a consumer's graph never mentions ml-explore/mlx-swift. CI resolves a mirror-less throwaway consumer (Tools/verify-consumer-resolution.sh) to prove it on every push. If you added .swiftpm/configuration/mirrors.json for an earlier version you can keep it; Tools/verify-mlx-fork.sh still checks a resolved checkout.
Common failure: TTSModelRegistry is undefined. TTSModelRegistry lives in
mlx-audio-swift (module MLXAudioTTS), not in TTSMLX's own source. A build
error that it's undefined means your resolution is compiling TTSMLX against
upstream Blaizzy/mlx-audio-swift or an old fork tag — usually a stale
Package.resolved that wasn't re-resolved after bumping TTSMLX. Fix it by
moving the fork up:
swift package update mlx-audio-swift # or: rm Package.resolved && swift package resolveIn Xcode: File ▸ Packages ▸ Reset Package Caches, then Update to Latest
Package Versions. Confirm your Package.resolved then shows
fil-technology/mlx-audio-swift at 0.1.8-tts.6 and mlx-swift at
0.33.100 from fil-technology/mlx-swift.
A Package.resolved written while the old mirror was in effect records
ml-explore/mlx-swift at a revision that only exists in
fil-technology/mlx-swift. Without the mirror, SwiftPM clones upstream and
cannot find it. Delete the app's Package.resolved (for an Xcode project,
<project>.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved)
and its SourcePackages checkouts under DerivedData, then resolve again:
nothing in the graph names upstream any more, so the fresh file records the
fork.
Every catalog entry says what its weights allow, so an app never has to look it up:
entry.license.name // "CC-BY-NC-4.0"
entry.license.tier // .nonCommercial
entry.license.note // who to credit, which clause bites
TTSMLX.supportedModels // validated, commercial use allowed
TTSMLX.models(maximumTier: .attributionRequired) // adds CC-BY models (credit them)
TTSMLX.models(maximumTier: .nonCommercial) // adds Voxtral and OmniVoice: personal, non-monetised use onlyNon-commercial means exactly that: a monetised, sponsored or product-promoting video is commercial use. Research-only weights (Higgs Audio v3) never get a descriptor because their licence forbids publishing the output.
Every descriptor answers the same questions, whichever loader is behind it:
let model = TTSMLX.modelCatalog.first { $0.id == "mlx-community/Ming-3.0-tts-0.5B-bf16" }!.descriptor!
model.sortedFeatures // [.streaming, .builtInVoices, .voiceCloning, .multilingual, .eventTags, .instruction, .emotion, .speed, .voiceDesign]
model.capabilities.sampleRate // 44_100
model.supportedEventTags // [.laugh, .sigh, .cough, .breath, .hesitation]
for voice in model.suggestedVoices {
voice.name // "George"
voice.language // .english
voice.gender // .male
voice.summary // "British. Audiobooks and formal announcements"
}The options are uniform too. Set what you want; the synthesizer translates it into the loaded model's own knobs (Ming's structured instruction, Qwen3 CustomVoice's "speaker, instruction" voice string, Chatterbox's exaggeration scalar, Kokoro's rate factor) and reports anything the model cannot honour through TTSDiagnostic.controlsIgnored rather than failing:
let text = "That's the news. \(TTSEventTag.laugh) Back to you." // "[laugh]" → "[Laughter]" on Ming, "<laugh>" on Orpheus, dropped elsewhere
let options = TTSSynthesisOptions(
voice: "UK_George",
instruction: nil, // free-form delivery, e.g. "warm, unhurried storytelling voice"
emotion: .happy, // TTSEmotion
speed: .slow // TTSSpeed
)
let audio = try await synthesizer.synthesize(text, using: model, options: options)model.features.contains(.emotion) tells you up front whether a knob will be used. Docs/model-previews.md lists the features, voices and languages of every entry with a clip per voice.
For narration work (video voice-over, guided audio, line-by-line scripts):
let synthesizer = TTSSpeechSynthesizer(runtimeCacheLimitMB: 512, releasesRuntimeBuffersAfterEachRequest: true)
// Several lines as one take, with exact boundaries
let take = try await synthesizer.synthesizeSegments(
["Breathe in slowly. [pause 0.8s] And hold.", "Now let it go."],
using: model, options: .init(voice: "UK_George", seed: 42))
take.segments // [TTSSegment(index, text, start, duration)]
take.analysis // peak, RMS dBFS, leading/trailing silence
take.pcmBuffer // play it, or take.write(to: url)
// Or one line, fitted into a fixed slot
let cue = try await synthesizer.synthesizeAudio("And release.", using: model, options: .init(targetDuration: 2.8))
// Or segment by segment as they finish
for try await piece in synthesizer.synthesizeSegmentsStream(lines, using: model) { place(piece.audio, at: piece.segment.start) }Reuse a reference voice across lines with let voice = try await synthesizer.prepareVoice(from: clipURL, using: model) and options.preparedVoice = voice: Chatterbox computes its speaker conditioning once and skips it on every later call. [pause 0.8s] markers work with every model. rate and targetDuration are native on Kokoro and a pitch-preserving time-stretch elsewhere. expressiveness and voiceGuidance drive Chatterbox's exaggeration and CFG weight. seed seeds MLX's random state before each take, so the same options reproduce the same audio on every model. Word timings remain estimates (TTSChunkInfo.wordTimings): no runtime model exposes an alignment, which is why segment boundaries, which are exact, are the unit to build on.
For longer passages, use synthesizeStream(...) to receive AVAudioPCMBuffer chunks as they are generated instead of waiting for a final file:
import AVFoundation
import TTSMLX
let synthesizer = TTSSpeechSynthesizer()
let stream = try await synthesizer.synthesizeStream(
"Read this out progressively.",
using: TTSMLX.supportedModels[0],
options: .init(streamingInterval: 1.0)
)
for try await chunk in stream {
print("chunk sample rate:", chunk.sampleRate)
print("frames:", chunk.buffer.frameLength)
}Use synthesize(...) when you want a finished WAV file.
Use synthesizeStream(...) when you want lower-latency playback and chunk-by-chunk delivery.
The current wrapper treats streaming as a buffer-delivery API: it does not surface a persisted file artifact for streamed runs, even if future upstream runtimes save one internally.
Three things decide whether a voice reads "robotic" before the model is even involved, and the framework now gets all three right by default:
- Punctuation reaches the model.
TTSTextChunkerkeeps the terminal.!?…,;:on every chunk (it used to cut just before it), so questions rise, sentences fall and commas breathe. Marks inside numbers, times and URLs (3.14,10:30,1,000,www.x.com) are not boundaries. - The model's own sampling settings are respected.
TTSGenerationProfileno longer overrides temperature / top-p; every model ships values its authors tuned (Orpheus and VyvoTTS at 0.6 / 0.8 with a repetition penalty)..highQualityonly guarantees a token budget of at least 2048, and the profile still drives MOSS-TTS-Nano's codebook count. ExplicitTTSSynthesisOptions.temperature/topPare still honoured. - Chunks are joined like speech, not spliced. Each chunk gets an 8 ms
raised-cosine fade at both edges (no clicks at seams) and is followed by a
pause sized to the break it ended on: 250 ms after a sentence, 450 ms after a
paragraph, 120 ms after a clause. Pauses are yielded as their own
TTSAudioBufferChunkwithisPadding == true, written into narration bundles and played back, but excluded from word-timing math.
// Defaults: .natural. Tune or disable per request.
var options = TTSSynthesisOptions()
options.chunkJoin = TTSChunkJoin(sentencePause: 0.35, paragraphPause: 0.6)
options.chunkJoin = .none // pre-0.9 behaviour: raw buffers, no pauseEvery TTSChunkInfo now carries a boundary (.paragraph, .sentence,
.clause, .open) you can use for your own pacing. Existing narration
bundles keep playing; regenerate them to pick up the new chunk texts and
pauses (cache keys include the chunk text, so they miss once).
What is not fixed by this: 4-bit model variants flatten timbre (prefer the 8-bit / bf16 entries where the device allows), and 80–100M models stay small.
For a reader-style UI (chapter text + playback + word highlighting), the canonical setup is:
let cache = try TTSAudioCache(directoryURL: documentsDir.appending(path: "Bundles"))
let playback = TTSPlaybackController()
let synthesizer = TTSSpeechSynthesizer()
// Once, after the model finishes downloading (e.g. end of onboarding):
try await synthesizer.warmUp(model) // keeps weights resident — first Play is instant
// Each chapter:
try await synthesizer.speakStreaming(
chapterText,
using: model,
options: .init(voice: .alba, language: .english),
cache: cache,
playback: playback,
onWord: { word in highlight.current = word.characterRange },
onPlaybackEnd: { /* next chapter, etc */ }
)speakStreaming wires up streamAndCacheNarration + play(stream:synthesizer:onWord:) for you, so highlights are driven by actual playback time (not generation events) and cached chunks replay instantly on subsequent calls. Voice switching uses per-voice sub-bundles inside the same cache.narrationBundle(...) URL — switch to voice B mid-chapter and back, and voice A's cached chunks survive intact.
iOS does not allow MLX/Metal GPU compute in the background. Audio playback is allowed; GPU compute is not. This is enforced by the OS regardless of background-task assertions, BGProcessingTask, audio entitlements, etc. The framework auto-cancels in-flight generation on willResignActive / willDeactivate / didEnterBackground (emitting TTSDiagnostic.cancelledByBackground) so the app doesn't crash with kIOGPUCommandBufferCallbackErrorBackgroundExecutionNotPermitted.
Two implications:
- Live streaming + background lock: audio plays from whatever was already scheduled into AVAudioEngine when the app backgrounded — typically seconds, not minutes. When that runs out, silence until the user foregrounds and the app calls
speakStreaming(...)again to resume. Cached chunks replay instantly; generation picks up where it left off. - Indefinite background playback: use
prepareNarration(...)to fully pre-bake a chapter to disk while the app is in foreground, then play the resultingTTSPreparedNarrationviaTTSPlaybackController.play(narration:onWord:). That path is MLX-free at playback time and survives any number of background/foreground cycles. Typical baking time: ~5–10× audio duration on iPhone (a 30-minute chapter bakes in 2–5 minutes). The right UX is a "Download for offline" button per chapter.
// Drop cached weights when the OS warns about memory pressure:
NotificationCenter.default.addObserver(
forName: UIApplication.didReceiveMemoryWarningNotification,
object: nil, queue: .main
) { [weak synthesizer] _ in
Task { await synthesizer?.handleMemoryWarning() }
}
// Opt in to background generation only if you own a `beginBackgroundTask`
// assertion AND understand that Metal compute will still be rejected by iOS:
synthesizer.allowsBackgroundGeneration = trueThe framework's willResignActive observer is registered automatically on init; you don't need to call cancelAllInFlight() from your own scene-lifecycle hooks unless you have additional cleanup beyond the framework's. Voice switching also evicts the cached model instance to ensure the new voice starts with clean state — a roughly 300 ms reload cost in exchange for not carrying voice-A's residual state into voice B.
A small SwiftUI demo app is included at DemoApp.
Open it with:
cd DemoApp
./open-xcodelet store = TTSModelStore()
let models = try await store.searchModels(query: "mlx tts")
let installed = try await store.installedModels()
if let model = models.first {
_ = try await store.ensureDownloaded(model)
}
// Downloads happen one model at a time and only for the descriptor you pass in.You can ask the framework for model metadata sourced from Hugging Face tags and config.json:
let store = TTSModelStore()
let metadata = try await store.fetchMetadata(for: "mlx-community/Qwen3-TTS-12Hz-0.6B-Base-8bit")
print(metadata.languageIdentifiers)
print(metadata.modelType ?? "unknown")
print(metadata.sampleRate ?? 0)
print(metadata.storageSizeBytes ?? 0)storageSizeBytes is the remote repository size reported by the Hugging Face model API.
let pocketTTS = TTSMLX.supportedModels.first { $0.id == "mlx-community/pocket-tts" }!
let audio = try await TTSSpeechSynthesizer().synthesize(
"A different voice",
using: pocketTTS,
options: .init(voice: .alba)
)TTSMLX uses Semantic Versioning.
- Use tagged releases like
v0.1.0,v0.2.0, andv1.0.0. - Consume stable versions from Swift Package Manager tags.
- Use GitHub Releases for release notes and downloadable source snapshots.
For this project, GitHub Releases are the right default distribution mechanism. GitHub Packages is not required for normal Swift package consumption, because SwiftPM already resolves packages directly from git tags.