tutts-alphatab
v0.1.0
Published
Pure TabData to alphaTex adapter for tutts.
Maintainers
Readme
tutts-alphatab
Pure adapter from tutts's renderer-neutral
TabData to alphaTex, the
text format consumed by alphaTab. Zero runtime
dependencies; core is a peer dependency.
Install
pnpm add tutts tutts-alphatabUsage
import { generateTab, Tuning } from "tutts";
import { toAlphaTex } from "tutts-alphatab";
const tab = generateTab({
notes: [
{ midi: 64, startBeats: 0, durationBeats: 1 },
{ midi: 60, startBeats: 1, durationBeats: 1 },
],
tuning: Tuning.standardGuitar(),
});
const { tex, voiceCount, warnings } = toAlphaTex(tab.data, { title: "Demo", tempo: 120 });
// feed `tex` to alphaTab: new alphaTab.importer.AlphaTexImporter()...Options
| Option | Default | Meaning |
|--------|---------|---------|
| title / subtitle | unset | \title / \subtitle metadata. |
| tempo | unset | \tempo metadata (BPM). |
| maxVoices | data.tuning.length | Voice cap. String count is the structural ceiling, so lossless polyphony is guaranteed for well-formed tab. |
| tuningLabel | unset | Label for the \tuning (...) clause. |
What it does
- String numbering. Core string
0(thinnest/highest) maps to alphaTex string1. The thin-to-thick tuning list is emitted as-is: alphaTex's convention, like core's, puts the highest string first, so\tuningreads(E4 B3 G3 D3 A2 E2)for standard guitar. - Full polyphony. Overlapping notes and differing chord durations split into alphaTex
\voiceblocks via interval-graph coloring. - Rhythm.
durationBeatsdecomposes into note values with dots, rests, and ties (including across barlines). Triplets, quintuplets, and septuplets emit as{tu N}; sextuplets render as two triplet groups.
warnings is non-empty whenever the output is not an exact notation of the input: duration or tuplet approximations, voice overflow beyond maxVoices (the displaced chord is truncated, or removed when it shares an onset), and notes extending past the final barline (clipped).
License
MIT
