Skip to main content

Supported Tags

<phoneme> — Custom Pronunciation

<phoneme alphabet="ipa" ph="kəˈkɔɹo">Kokoro</phoneme>

<sub> — Text Substitution

<sub alias="World Wide Web">WWW</sub>

<say-as> — Content Type Interpretation

<say-as interpret-as="cardinal">123</say-as>

Say-As Types

TypeInputOutput
characters / spell-outABC”A B C”
cardinal / number123”one hundred twenty-three”
ordinal1”first”
digits123”one two three”
date12/25/2024”December twenty-fifth twenty twenty-four”
time2:30”two thirty”
telephone555-1234”five five five one two three four”
fraction3/4”three quarters”

Date Formats

FormatDescriptionExample
mdyMonth-Day-Year (default)12/25/2024
dmyDay-Month-Year25/12/2024
ymdYear-Month-Day2024-01-15
mdMonth-Day12/25
dmDay-Month25/12
yYear only2024
mMonth only12
dDay only25

Usage

import FluidAudioTTS

let ttsManager = TtSManager()
try await ttsManager.initialize()

let text = """
    The price is <say-as interpret-as="cardinal">42</say-as> dollars.
    Call us at <say-as interpret-as="telephone">555-1234</say-as>.
    """
let audio = try await ttsManager.synthesize(text: text, voice: .afHeart)

Coexistence with Markdown

Both syntaxes work together:
let text = """
    <phoneme ph="kəˈkɔɹo">Kokoro</phoneme> and [Misaki](/mɪˈsɑːki/)
    """

Edge Cases

  • No SSML tags: Text passes through unchanged (fast path)
  • Malformed tags: Invalid SSML passes through as literal text
  • Unknown interpret-as: Content returned unchanged