Expand description
Exact forced alignment against a known reference.
The reference is a sequence of N phone columns and the acoustic model has
scored T frames. Alignment assigns frames to phones by searching a single
chain rather than a lattice of possible transcripts.
§Chain topology
States s_0 … s_N, where s_i means “the first i phones are behind us”.
s_0 is the start, s_N is the only final state, and four transitions
leave each state, every one of them consuming exactly one frame:
| transition | reads | goes to | costs | means |
|---|---|---|---|---|
| hold blank | blank | s_i | 0 | silence, or phone i + 1 has not started |
| hold phone | phone i | s_i | 0 | phone i is still sounding (i ≥ 1) |
| commit | phone i + 1 | s_{i+1} | 0 | phone i + 1 starts in this frame |
| skip | blank | s_{i+1} | skip(i + 1) | phone i + 1 never happens |
A skip makes a phone optional at a caller-supplied cost. Skipping is disabled
by default; see AlignChain::with_skip_costs.
§Exact search
Every transition consumes one frame and advances at most one phone. A path
of T frames can therefore occupy position i at frame t only when
t - (T - N) <= i <= t. band covers exactly those
reachable cells, so align needs no beam or pruning threshold.
The solver reads the original acoustic columns directly. It does not widen the score matrix to distinguish transitions that read the same phone or blank column, and it stores the four transition codes in two bits each.
§Custom topologies
trellis supplies the banded Viterbi and forward-backward
solvers independently of this chain. Implement Trellis for constraints
such as minimum duration or multi-phone skips. AlignChain::against
exposes this module’s trellis when the raw Path or posteriors are needed.
Structs§
- Align
Chain - A reference to align: the phones in order, and what each one costs to give up.
- Alignment
- Which phone each frame sounded.
- Chain
Trellis AlignChainagainst a matrix of scores: the trellisalignsolves.
Functions§
- align
- Aligns
chaintodense: the best path of the chain against the acoustic scores, exactly.