Duet Arranger: chorus and switch models
Two small models used by Duet Arranger, which splits a solo song into a two-singer duet for KTV subtitles. A dynamic-programming search balances the singers and applies the rules.
- Web app: https://hikari-tsai.github.io/duet-arranger/ ยท https://huggingface.co/spaces/aaatmy/duet-arranger
- Files:
chorus.onnx: P(both singers sing this line), inputXfloat32[n_lines, 23].switch.onnx: P(the singer changes between line i-1 and line i), inputXfloat32[n_lines - 1, 70]. NaN marks missing timing.config.json: feature order, the average switch rate, characters per second for lyrics without timing, and cross-validation results.
- Shared design: both are scikit-learn
HistGradientBoostingClassifiermodels converted with skl2onnx (opset 15,ai.onnx.mlTreeEnsembleClassifier). The outputprobabilities[:, 1]is the probability.
Features are computed from the lyrics and the line timing; no audio is needed. Use features() and
boundaryFeatures() in web/arranger.js,
or the Python version in python/.
Training data and evaluation
- Training data: 350 real duet songs, mostly Mandarin with some Japanese. Line labels (A / B / AB) come from an automatic audio pipeline: vocal separation, speaker clustering, chorus detection and LLM revision. About 84% of these labels are correct on hand-checked songs. 30% of the songs are also included with their timing removed.
- Evaluation: 5-fold cross-validation on 22 duets whose lines were checked by hand. Test songs are never in the training data.
| Model | lyrics + timing | lyrics only |
|---|---|---|
| chorus AUC | 0.804 | 0.801 |
| switch AUC | 0.692 | 0.652 |
| switch AUC of the fixed rules it replaces | 0.607 | 0.500 |
No lyrics, audio or training data are distributed with these models.
All experiments, in Traditional Chinese: audio labelling pipeline, lyrics-only models (human vs automatic labels), active learning, switch model, arranger evaluation and stress test. See EXPERIMENTS.md; the numbers are in results/.
Usage (Python)
python/ in this repo (and in GitHub) is the full arranger: features, the balanced
dynamic-programming search with automatic adjustment, and subtitle readers and writers.
pip install numpy onnxruntime huggingface_hub
python python/arrange.py run song.lrc -o song.duet.ass # .lrc .srt .ass .txt .json
Usage (onnxruntime-web)
const base = "https://huggingface.co/aaatmy/duet-arranger/resolve/main/";
const chorus = await ort.InferenceSession.create(base + "chorus.onnx");
const pAB = (await chorus.run({ X: new ort.Tensor("float32", X, [n, 23]) })).probabilities.data; // [i * 2 + 1]
const sw = await ort.InferenceSession.create(base + "switch.onnx");
const pSwitch = (await sw.run({ X: new ort.Tensor("float32", Xs, [n - 1, 70]) })).probabilities.data;
- Downloads last month
- 126