MonotonicAlignment
Helpers & Utilities · AiDotNet.TextToSpeech
Monotonic text-to-speech alignment over a token-by-frame score matrix: every frame belongs to one token, the first frame to the first token and the last to the last, and the token index stays or advances by one from frame to frame.
How It Works
This is the alignment space of AlignTTS (Zeng et al. 2020, §3.1: the forward variable
αt,s = (αt−1,s + αt−1,s−1) · p(yt | zs)) and of Glow-TTS’s
monotonic alignment search (Kim et al. 2020). MaximumPath is the Viterbi path (the same recursion
with a max), from which durations are read; LogLikelihood sums over all paths (the Baum-Welch-style
alignment loss), computed in log space with engine operations so gradients reach the scores.
Methods
| Method | Summary |
|---|---|
Tensor<T> LogLikelihood(Tensor<T> logLikelihood) |
log Σ over all monotonic alignments of Πt p(yt | zalign(t)), from logLikelihood ([tokens, frames]), as a scalar tensor on the gradient tape. |
int[] MaximumPath(Tensor<T> scores) |
The most likely monotonic alignment of scores ([tokens, frames] log-likelihoods), returned as the number of frames assigned to each token — the Viterbi recursion of MaximumPath run frame by frame with engine operations in T. |
int[] MaximumPath(double[] scores) |
The most likely monotonic alignment of scores ([tokens, frames] log-likelihoods), returned as the number of frames assigned to each token — the Viterbi recursion of MaximumPath run frame by frame with engine operations in T. |