NarrationTimeline

Builds and queries word-level timelines for recorded speech.

estimate is fallback scaffolding for a recording without measured alignment. Prefer NarrationAlignment whenever measured word timings are available.

Properties

Link copied to clipboard
val leadIn: Double = 0.35

Silence reserved before the first estimated word.

Link copied to clipboard
val linePause: Double = 0.35

Time reserved for a breath at each line break in an estimated timeline.

Functions

Link copied to clipboard
fun estimate(passage: Passage, duration: Double, tokenizer: WordTokenizer, weighting: SpeechWeighting): List<WordTiming>

Estimates word timings by speech weight, reserving a pause at each line break.

Link copied to clipboard
fun heldThroughSilence(timings: List<WordTiming>, samples: FloatArray, sampleRate: Double): List<WordTiming>

Extends each supplied word interval through its release and the silence that follows.

Link copied to clipboard
fun heldToTheNextWord(timings: List<WordTiming>, duration: Double, limit: Double = 0.4): List<WordTiming>

Extends each word toward the next word, without passing it or exceeding limit.

Link copied to clipboard
fun index(at: Double, timings: List<WordTiming>): Int?

Returns the index of the word sounding at at.

Link copied to clipboard

Returns the part of the recording occupied by one line.

Returns the part of the recording occupied by a consecutive run of lines.

Link copied to clipboard
fun settledBetweenLines(timings: List<WordTiming>, samples: FloatArray, sampleRate: Double, reach: Double = 0.25): List<WordTiming>

Moves a line boundary out of speech and into the first resting silence in reach.

Link copied to clipboard
fun word(at: Double, ofLines: IntRange, timings: List<WordTiming>): SpokenWord?

Returns the word sounding at at when it belongs to ofLines.

Link copied to clipboard
fun wordAtFraction(fraction: Double, ofLine: Int, timings: List<WordTiming>): SpokenWord?

Returns the word at a fractional position through one line.

fun wordAtFraction(fraction: Double, ofLines: IntRange, timings: List<WordTiming>): SpokenWord?

Returns the word at a fractional position through a consecutive run of lines.