LyricAligner (LyricAlignerForAlignment)

Self-contained neural lyric-to-note aligner that aligns singing lyric tokens (Mandarin Chinese characters and English words) onto transcribed vocal melody notes, handling same-pitch re-articulation splits, breathy/unpitched syllable recovery, melisma continuations, and unrecognized singing spans via exact monotonic Viterbi decoding.

Model Specifications

Property Value
Architecture VocalNoteRefiner (100 Hz 1D-ResConv + BiGRU) + AcousticNoteLyricMatcher (3-layer Dual-Stream Pre-LN Transformer, d_model=256, nhead=8, Bidirectional Cross-Attention, Pair-Aware Contextual NULL/SKIP Heads + Exact Monotonic Viterbi DP with Coarse Time Prior & Candidate Rollback Gate)
Parameters 6.77M (FP32, 25.84 MiB safetensors)
Frame Resolution 100 Hz (10 ms hop) acoustic curves + 58-token Mandarin / English-approx phoneme vocabulary (with singing G2P overrides 谁 -> sh+ei, 哦 -> ou and 18-dim consonant/final contrast pair features)
Supported Inputs Optional 10 ms phoneme log-posteriors, boundary probabilities, 10 ms DSP / y16 audio, RMVPE F0 track, and beat grid (supports zero-acoustic fallback)

Evaluation

Evaluated across three held-out singing benchmarks (GTSinger-CN, Opencpop, and M4Singer, unseen song splits) under both clean vocals and accompaniment-bleed degraded conditions (with realistic note merges, breathy note drops, unrecognized vocal spans, extra tokens, and boundary jitter):

Dataset Condition Note-Char Acc Char F1 (Β±50 ms) Char F1 (Β±80 ms) Slur F1 Same-Pitch Split F1 (Β±50 ms) Breathy Recovery F1
GTSinger-CN Clean 98.00% 93.12% 96.53% 83.39% 61.73% 47.84%
GTSinger-CN Degraded 97.75% 92.73% 96.21% 82.89% 59.84% 48.10%
GTSinger-CN Vowel-Onset + Degraded 96.71% 91.74% 95.64% 81.19% 64.40% 47.92%
Opencpop Clean 98.93% 95.29% 98.32% 59.51% 31.72% 47.62%
Opencpop Degraded 98.98% 95.47% 98.71% 59.51% 36.98% 47.62%
Opencpop Vowel-Onset + Degraded 99.32% 94.43% 98.65% 55.32% 38.59% 50.48%
M4Singer Clean 98.19% 93.63% 97.41% 86.29% 67.99% 50.88%
M4Singer Degraded 97.65% 92.74% 96.56% 85.20% 65.36% 50.31%
M4Singer Vowel-Onset + Degraded 96.24% 91.39% 95.25% 81.67% 63.90% 41.90%

Chorus Echo & Trailing Ad-lib Rejection (Pure Model, No Time Prior)

Dataset Stress Condition Note-Char Acc Char F1 (Β±80 ms) NULL F1
GTSinger-CN Short Chorus Echo + Degraded 96.78% 95.92% 80.33%
GTSinger-CN Trailing Ad-lib + Degraded 96.83% 96.26% 92.99%
Opencpop Short Chorus Echo + Degraded 98.55% 98.23% 95.24%
Opencpop Trailing Ad-lib + Degraded 98.14% 98.34% 97.06%
M4Singer Short Chorus Echo + Degraded 97.03% 96.32% 85.12%
M4Singer Trailing Ad-lib + Degraded 96.72% 96.15% 93.81%

Usage

Requires transformers, torch, numpy, and pypinyin:

import numpy as np
from transformers import AutoModel

model = AutoModel.from_pretrained("wellCh4n/lyric-aligner", trust_remote_code=True)
model.eval()

notes = [
    {"start": 0.10, "end": 0.48, "midi": 60},
    {"start": 0.48, "end": 0.92, "midi": 62},
    {"start": 0.92, "end": 1.35, "midi": 64},
]
chars = [{"char": "ζ™΄"}, {"char": "倩"}]

placed_notes, counts = model.align_notes(
    notes=notes,
    chars=chars,
    ph_logp=ph_logp,       # optional np.ndarray [58, T] 10 ms phoneme log-posteriors
    edge=edge,             # optional np.ndarray [T] 10 ms boundary probabilities
    dsp=dsp,               # optional np.ndarray [5, T] 10 ms DSP curves
    track=track,           # optional dict with "y16" (16 kHz audio) and/or "times"/"f0"/"periodicity"
    beat_times=beat_times, # optional np.ndarray of beat timestamps in seconds
    use_refiner=True,
)
print(counts)
print([(n["start"], n["end"], n.get("k"), n.get("char")) for n in placed_notes])

API & Configuration Parameters

model.align_notes(notes, chars, ph_logp=None, edge=None, dsp=None, track=None, beat_times=None, use_refiner=True, skip_bias=0.0, time_prior_weight=None, time_prior_tol=None)

  • notes (Sequence[dict]): Vocal melody note dicts with "start", "end" (seconds), and "midi".
  • chars (Sequence[dict | str]): Ordered lyric tokens ("char" string or dict with "char" and optional "start", "vowel", "end", "conf").
  • ph_logp (np.ndarray | None): Optional 10 ms phoneme log-posteriors of shape [58, T].
  • edge (np.ndarray | None): Optional 10 ms phoneme boundary probability curve of shape [T].
  • dsp (np.ndarray | None): Optional 10 ms 5-channel DSP features (rms_db_norm, d_rms, flux_norm, hf_ratio, zcr_norm). If None and track["y16"] is provided, computed automatically.
  • track (dict | None): Optional vocal track dict ("y16" 16 kHz waveform; "times", "f0", "periodicity" for breathy-note F0 estimation).
  • beat_times (np.ndarray | None): Optional monotonic beat timestamps in seconds.
  • use_refiner (bool): Whether to run VocalNoteRefiner split/breathy candidate proposals before monotonic DP matching.
  • skip_bias (float): Additive bias applied to per-token skip logits s_skip during monotonic DP (negative values discourage skipping known-accurate user lyrics).
  • time_prior_weight (float | None): Optional override for the coarse interval-distance time prior slope (defaults to config.time_prior_weight; 0.0 disables).
  • time_prior_tol (float | None): Optional override for the zero-penalty deadzone around each token's [start, end] interval (defaults to config.time_prior_tol).
  • Returns (placed_notes, counts):
    • placed_notes: Sorted note dicts with "k" (int | None, assigned token index), "char" placed on the first note of each token k, and "unpitched": True / "pitch_f" on recovered breathy notes.
    • counts: Summary dict {"placed": int, "cut": int, "unpitched": int, "delta_ms": float}.

Key LyricAlignerHFConfig Proposal & Decoding Parameters

  • split_cand_thr: 0.45 β€” minimum VocalNoteRefiner peak probability to propose a same-pitch note split candidate (subject to rollback gating).
  • breathy_cand_thr: 0.60 β€” minimum frame probability to propose a missing breathy/unpitched candidate span.
  • min_split_note_dur: 0.28 β€” minimum note duration (seconds) eligible for internal split proposals.
  • min_split_margin: 0.12 β€” minimum spacing (seconds) from note boundaries and between split peaks.
  • min_breathy_dur: 0.05 β€” minimum duration (seconds) for a breathy candidate span.
  • min_breathy_gap: 0.02 β€” minimum separation (seconds) from existing pitched notes.
  • time_prior_weight: 1.5 β€” soft logit penalty per second beyond time_prior_tol from a token's optional [start, end] interval.
  • time_prior_tol: 1.0 β€” deadzone (seconds) within which the time prior applies zero penalty so local acoustic matching is untouched.
  • time_prior_min_dur: 0.025 β€” minimum token interval duration (seconds) required to apply the time prior (skips collapsed/fallback tokens).
Downloads last month
116
Safetensors
Model size
6.77M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support