Views
No views yet
Post-processor that fixes bar / downbeat phase drift, beats-per-bar confusion, and doubletime/halftime mistakes in beat-tracker output, without re-running expensive audio models. Readschords[] + beats[] + downbeats[] + bpmfrom a chord JSON and emits a corrected grid.
pip install livechord-bar-arbitrator onnxruntime1from livechord_bar_arbitrator import arbitrate, apply_to_chord_json
2
3chord_data = {
4 "chords": [{"time": 0.0, "end": 4.5, "chord": "Cm7"}, ...],
5 "beats": [0.0, 0.5, 1.0, ...],
6 "downbeats": [0.0, 2.0, 4.0, ...],
7 "bpm": 120.0,
8}
9
10result = arbitrate(chord_data)
11if result["applied"]:
12 chord_data = apply_to_chord_json(chord_data, result)~/.cache/huggingface/hub). To use a local file, pass
arbitrate(chord_data, model_path="path/to/bar_arbitrator_v1.onnx").downbeats[] like 1.4s, 3.3s, 0.7s, ...
when the bar should be 2.8s.gaps == beat_dur. ┌─────────────────────────┐
chord_data──┤ arbitrate(chord_data) │
└──────────┬──────────────┘
│
┌──────────┴──────────┐
│ │
▼ ▼
[ rule-based ] [ ONNX Transformer ] ← Phase 1, optional
(Phase 0) (~750 KB, CPU only)
• │
• ▼
• [ confidence gate ]
• │
└──────────┬───────────────┘
▼
ArbitrationResult dict
(downbeats_before/after, score_before/after,
beats_per_bar, applied, reason)| File | What | Required |
|---|---|---|
bar_arbitrator_v1.onnx | Phase 1 ONNX-exported Transformer (~750 KB) | Optional |
| Source code in livechord-bar-arbitrator on GitHub | Arbitration pipeline | via pip install |
pip install livechord-bar-arbitrator livechord-beat-refiner1from livechord_bar_arbitrator import phase1_refine
2
3result = phase1_refine(chord_data, audio_path="song.flac")1@misc{livechord-bar-arbitrator,
2 title = {livechord-bar-arbitrator: rule-based + Transformer
3 post-processor for bar / downbeat grid arbitration},
4 author = {LiveChord Project},
5 year = {2026},
6 url = {https://huggingface.co/livechord-music/livechord-bar-arbitrator},
7}