Skip to main content

Module voice

Module voice 

Source
Expand description

Voice clips: a manifest that lists every clip by dialogue line id, and a cast that says which voice says each speaker’s lines. A game ships its clips beside it, so nothing here reads a file: the game reads the text and these functions parse and validate it.

A clip records the words it says (spoken). When the line says something else today (a name in the names table changed), the clip is stale and is left out of the Playable set. A line whose words change with something the player picks (a hero’s pronouns, say) has one clip per ClipVariant the game names.

The cast is written for the tool that makes the voices: each entry names the voice (what a clip’s voice records: a reference clip’s name for a generated voice, an actor’s for a recorded one) and the settings only that tool knows, of the tool’s own type S (() for none, written settings: ()). A key is a speaker, or a speaker followed by a variant’s suffix for that variant’s clips:

(voices: {
    ">": (voice: "narrator", settings: (reader: Kokoro)),
    "hero": (voice: "hero_deep", settings: (reader: Kokoro)),
    "hero.light": (voice: "hero_light", settings: (reader: Piper)),
})

A voice tool plans its work with plan: which clips to make, record again or remove, and each voice’s recording script.

Modules§

plan
What a voice tool has to do for one language, as a pure function of the dialogue, the scenes to voice, the cast and the manifest’s clips: the clips to make or make again (and why), the recorded clips a person must record again, the clips to remove and the lines nobody is cast to say. The tool reads and writes its files; plan only says what to do.

Structs§

Cast
Which voice says each speaker’s lines, with the settings of the tool that makes them (S).
CastVoice
One voice of the Cast.
Playable
The clips that may be played: those that say what their line says today.
VoiceClip
One clip of the manifest.
VoiceManifest
The validated voice manifest of one language.

Enums§

MadeBy
Who or what made a clip (the credits say which voices are generated).

Traits§

ClipVariant
Which recording of a line a clip is: the game’s type, with its default for a line’s only clip.

Functions§

cast_from_source
Parses and validates cast source, attributing errors to file at each entry’s line: no voice is empty, every key is a speaker that is NARRATION_SPEAKER or one that can_speak, or such a speaker followed by the suffix of one of V’s variants. A key that is a speaker is the speaker’s, whatever it ends with. Settings S rejects are a parse error.
clip_file
A clip’s file, relative to its language’s folder: <scene id>/<line id>.ogg, with the variant’s suffix before .ogg.
from_source
Parses and validates manifest source, attributing errors to file: every clip’s line exists in dialogue, no line has the same variant twice, a line has either its only clip or every split one, and spoken and voice aren’t empty. Reports every problem found.
line_texts
The text of every dialogue line, by line id.