loadSSPhonemes (URL)
Loads speech-synthesis phoneme mappings from a file URL.
Declaration
public func loadSSPhonemes(from url: URL) -> STResultOverview
Loads pronunciation overrides from a UTF-8 file. Each mapping associates a written word with its IPA (International Phonetic Alphabet) transcription. IPA is a standardized way to represent speech sounds independently of conventional spelling. Lines beginning with # can be used as comments; only IPA notation is supported for phoneme mappings.
Example mapping file
# IPA pronunciation mappings
John: dʒɒn
hello: həˈloʊ
world: wɜːrld
File-based pronunciation mappings
Provide a URL to a UTF-8 mapping file. Consult the documented file format and selected synthesis engine requirements.
Parameters
- url — URL The URL identifying the resource or location for this operation.
Usage example
let url = Bundle.main.url(forResource: "SSPhonemes", withExtension: "txt")!
_ = conversation.loadSSPhonemes(from: url)
Result handling
This loading method executes synchronously. .success indicates that the requested resource data was loaded successfully. Handle other STResult values as loading failures.
Resource location
Before loading a resource file, you may configure the default local directory with STConversationRunner.setResourceLocation using .speechSynthesis from STResourceCategory.
By default, the language-specific directory is en-US. The loader first searches that language-specific directory under the configured resource location. If the resource is not found there, it searches the parent resource directory as a fallback. You can select another language-specific directory using STConversationRunner.setLanguageFolder.