Phonemizers
KittenTTS converts normalized English text to IPA before inference.
Built-in CE phonemizer
.builtin is the default. It uses the SDK's C++ engine and downloads en_rules and en_list dictionaries on first setup.
let config = KittenTTSConfig(phonemizer: .builtin)
Override dictionary download URLs by creating EPhonemizer directly:
let phonemizer = EPhonemizer(
rulesURL: URL(string: "https://assets.example.com/en_rules")!,
listURL: URL(string: "https://assets.example.com/en_list")!
)
let config = KittenTTSConfig(phonemizer: .custom(phonemizer))
eSpeak on macOS
brew install espeak-ng
let config = KittenTTSConfig(phonemizer: .espeak)
Process execution is unavailable on iOS, so .espeak throws espeakNotInstalled there.
Custom implementation
struct MyPhonemizer: KittenPhonemizerProtocol {
func phonemize(_ text: String) -> String {
customIPA(text)
}
}
let config = KittenTTSConfig(phonemizer: .custom(MyPhonemizer()))
The returned IPA may only use symbols in the KittenTTS symbol table; unsupported scalars are discarded. Implement downloadIfNeeded(to:progressHandler:) when the custom engine needs its own assets.