
EspeakNG-Swift
github.com/blaizzy/espeakng-swift- Category
- Developer Tools
- Rank
- No. 1912Tools index
Previous survey · No. 1821 ·
- Pricing
- Open Source
- Type
- TOOL
- Builder
- blaizzy
- GitHub
- 9 stars
- Date
About
Swift bindings for espeak-ng — embed open-source text-to-speech directly in iOS and macOS apps without cloud round-trips.
What it does
It turns text into phoneme strings for speech pipelines. A Swift engine selects a language dialect, discovers the matching bundled voice, converts UTF-8 text, then applies pronunciation-oriented post-processing. Applications can also map their own voice types to supported dialects.
Why it's ranked here
The package offers a focused, typed bridge around a bundled native engine, with explicit errors and configurable resource lookup. Its narrow phonemization API is easy to understand. However, limited tests, unavailable simulator execution, and English-focused output rewriting make adoption depend on careful device testing.
What's good
The package bundles native binaries for both supported Apple platforms and exposes them through Swift Package Manager. Typed dialect cases and a voice-mapping protocol keep application voice choices explicit. Initialization checks every declared dialect against available native voices, surfacing incomplete bundled data early.
Tradeoffs
The Swift layer exposes phonemization, not audio synthesis or playback. Simulator builds deliberately fail engine initialization and conversion. Post-processing is explicitly optimized for English, despite the broader dialect list. Initialization also rejects the engine when any declared nonempty dialect is absent, which can make partial voice bundles unusable.
How to use it well
Use it in Apple-native speech systems that need phonemes before a separate synthesis model, especially when application voices must map predictably to dialects. Test on physical devices and validate output language by language. Choose another layer for waveform generation, playback, or simulator-based speech execution.
Technical notes+
Package.swift targets Swift tools 5.9, declares macOS 14 and iOS 17, exposes the ESpeakNGSwift target as the ESpeakNG library product, and links Frameworks/ESpeakNG.xcframework as a binary target. Sources/ESpeakNG/ESpeakNGEngine.swift locates an espeak-ng-data bundle by bundle identifier, calls espeak_Initialize with AUDIO_OUTPUT_PLAYBACK, enumerates native voices, and uses espeak_TextToPhonemes in UTF-8 mode before replacement-based post-processing. Its simulator branches throw errors. Sources/ESpeakNG/VoiceMapping.swift defines ESpeakNGVoiceMapping. Tests/ESpeakNGTests/ESpeakNGTests.swift only checks the raw values for the two English dialect cases.
Observed
- License
- The bundled eSpeak NG library is GPL-3.0; NOTICE says applications using the package must comply with its GPL-3.0 requirements.
- Primary language
- Swift wrapper code, with bundled native eSpeak NG binaries and C headers.
- Packaging
- Swift Package Manager library product with a local binary XCFramework target.
- Interface
- Swift library API for language selection, voice mapping, and text phonemization.
- Platform support
- iOS 17 or newer and macOS 14 or newer; the XCFramework contains iOS arm64 plus macOS arm64 and x86_64 slices.
- Tests
- One XCTest source is shown, covering only the raw values of the US and British English dialect cases.
Read from README.md, Package.swift, Sources/ESpeakNG/VoiceMapping.swift, Sources/ESpeakNG/ESpeakNGEngine.swift, Tests/ESpeakNGTests/ESpeakNGTests.swift, NOTICE, Frameworks/ESpeakNG.xcframework/Info.plist, Frameworks/ESpeakNG.xcframework/ios-arm64/ESpeakNG.framework/ESpeakNG.h, Frameworks/ESpeakNG.xcframework/ios-arm64/ESpeakNG.framework/Headers/ESpeakNG.h, Frameworks/ESpeakNG.xcframework/ios-arm64/ESpeakNG.framework/Headers/espeak_ng.h.
What it can do
Convert text to speech
Text string → Audio speech
Embed text-to-speech functionality in iOS apps
iOS app project and text content → iOS app with integrated speech synthesis
Embed text-to-speech functionality in macOS apps
macOS app project and text content → macOS app with integrated speech synthesis
Synthesize speech offline
Text content → Audio speech without internet connection
Provide Swift API for espeak-ng engine
Swift code and text input → Speech synthesis through native Swift interface
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.