NarrationAlignment

data class NarrationAlignment(val piece: String, val duration: Double, val words: List<NarrationAlignment.Word>, val recording: String? = null)(source)

Word-timing metadata supplied for a recorded narration.

Unlike an estimated timeline, an alignment preserves the producer's supplied start and end for every listed word. Decoding refuses times that cannot describe one recording read in order: a negative start, an end before its start, or a word that starts before the word listed ahead of it. It also refuses a missing field and a value of another type than the field's, but reads past a field it does not know, so that a field the server adds later does not stop a build already installed. Values created in code are not checked.

The representation is shared by the tool that measures a recording and the client that presents it.

Constructors

Link copied to clipboard
constructor(piece: String, duration: Double, words: List<NarrationAlignment.Word>, recording: String? = null)

Types

Link copied to clipboard
sealed class AlignmentError : Exception

A supplied alignment no longer describes the requested passage.

Link copied to clipboard
object Companion
Link copied to clipboard
object Serializer : KSerializer<NarrationAlignment>

Writes an alignment as JSON, and reads one only from JSON, refusing a missing field, a value of another type than the field declares and times that are out of order or bounds, and reading past a field it does not know.

Link copied to clipboard
sealed class TimingError : Exception

Supplied word times that cannot describe one recording read in order.

Link copied to clipboard
data class Word(val line: Int, val text: String, val start: Double, val end: Double)

One word and its supplied interval in the recording, not validated against its bounds.

Properties

Link copied to clipboard

Duration of the recording in seconds.

Link copied to clipboard

Identifier of the aligned piece, as the work names it.

Link copied to clipboard

An application-defined identifier for the recording these timings describe.

Link copied to clipboard

Supplied word intervals in passage order.

Functions

Link copied to clipboard
fun timings(passage: Passage, tokenizer: WordTokenizer): List<WordTiming>

Associates the supplied times with the words of a passage.