Skip to main content

Crate floravox_ssml

Crate floravox_ssml 

Source
Expand description

§floravox-ssml

Streaming SSML / plain-text parser with byte- and char-exact source span tracking, built on quick-xml.

Every word token emitted by parse carries its exact offsets into the raw input string, so downstream consumers (highlighting, index marks, lipsync) can map audio timing back onto original text — even when the input contains XML entities (&amp;), <sub alias> replacements, or <phoneme> overrides.

use floravox_ssml::{parse, Segment};

let doc = parse("<speak>Hello <mark name=\"m1\"/>world</speak>").unwrap();
assert!(matches!(doc.segments[1], Segment::Mark { ref name, .. } if name == "m1"));

Structs§

ParseError
Error type: parsing is lenient, so failures are near-impossible by design.
Prosody
Effective prosody for a word or segment, as resolved multipliers (1.0 = unchanged). None fields inherit the engine default.
SsmlDocument
A flat, ordered representation of the input after SSML resolution.
WordSpan
A word token with exact source mapping.

Enums§

SayAs
How a word should be spoken, from <say-as interpret-as="...">.
Segment
One element of the flattened document.

Functions§

parse
Parse SSML or plain text into an SsmlDocument.
parse_break_strength
W3C break strengths mapped to default millisecond pauses.
parse_pitch
Parse a pitch value: percentage, semitones ("+3st"), or W3C names.
parse_rate
Parse a rate value: ratio ("0.8"), percentage ("80%"), relative ("+20%" / "-20%"), or W3C names.
parse_time
Parse an SSML time value ("500ms", "2s", "1.5s", bare number = ms).
parse_volume
Parse a volume value: percentage, relative, W3C names, or 0–100 number.