Music · Sheet Music to Guitar Tab Converter

How the Sheet Music to Guitar Tab Converter works

Open a MusicXML file and get six-line guitar tab, with every fret re-checked against the pitch read from the file, every note that does not fit listed by measure, and every note that is not converted counted.

Back to the tool

How this is calculated

Tablature is a different way of writing the same pitches. The tool reads each note's pitch from the MusicXML file, finds the strings and frets that produce exactly that pitch, and picks one:

pitch of a tab number = open string + capo + fret (one fret = one semitone) open strings, low to high = E2 A2 D3 G3 B3 E4

What is checked after every conversion, and what is not

Two checks run each time, and the two lines under the tab report them.

  • Every printed number. The sum above is worked out again for each fret the tool printed and compared with the sounding pitch the tool read for that note. If any differs, the tab is withheld.
  • Every note in the file. The file is read a second time by a much simpler routine that shares no code with the first. It only counts the notes that have a pitch and looks at their staff, whether they are cue notes and whether they are chord notes. The counts must add up, and the written pitches of the converted notes must be the same in both readings, in the same order:
pitched notes in the part (second count of the file) = placed + not playable + on other staves + cue notes

If they do not add up, the tool says "Note count does not reconcile" instead of "Every note placed". When notes were left out on purpose (other staves, cue notes) the verdict says how many rather than reporting a clean pass. Those notes are counted; they are not listed one by one.

Not double-checked: the transposition is applied by the main reading only, and note timing is used for spacing and ties but is not re-derived by the second count. The second count is a plain scan of the text. Unusual but legal XML, such as a closing tag spelled inside an attribute value or a part nested inside another element, can make it disagree with a correct tab; the tool then reports that the count does not reconcile.

An XML entity can stand for whole notes, and neither reading expands one. So a file is refused with a message if its document type declaration declares an entity, whether or not the file goes on to use it, and if it uses any entity reference other than the five standard ones (& < > " ') and numbered characters such as é, wherever in the file it stands. That includes a named character like é, which the MusicXML document type would allow; write the letter itself.

Notes that do not fit

The lowest note in standard tuning is the open low E string (E2). The highest is whatever fret you allow on the high e string: fret 15 by default, up to 24. A note below or above that range is marked with an asterisk above the staff and listed with its measure number. It is never moved to a nearby note. The same goes for two notes that sound together but exist only on the same string, a chord that would need a stretch of more than 4 frets, a chord of more than six notes, and quarter-tones.

Which octave

Guitar music is written one octave above where it sounds. MusicXML files record that in one of two ways, and the tool takes each file at its word.

  • Some files store the written pitch and add a <transpose> element with an octave change of −1. The guitar staff in the MusicXML specification's own tablature example is written this way. The tool applies it:
sounding pitch = stored pitch + <chromatic> + 12 × <octave-change>
  • Other files store the sounding pitch and show the octave with an octave clef and no <transpose>. A guitar part exported by MuseScore 3 that we examined is written this way. The tool uses the stored pitch as it is and does not lower it a second time; it mentions the octave clef under the tab.

A piano or vocal part has neither marking, so its notes are placed at the pitch written. That can come out an octave higher on the neck than a guitarist reading the same staff would play it. The octave setting moves the whole piece by exactly twelve semitones either way, and the tab says when it has done so. On Auto, the piece stays where the file puts it if every note fits; otherwise the tool counts the unplayable notes at each of the three octaves and keeps the lowest count, telling you the numbers.

Tied notes

A note marked as the end of a tie is left unprinted only when its string is still sounding that note. All of this must hold: a note of the same pitch that starts a tie, and is not a grace note, ends at exactly the moment this one begins; that note was placed; the tied note belongs on the same string and fret; and nothing else is struck on that string from then until the tied note begins, including in the tied note's own column. "Until" follows playing order, not the clock, so a grace note or another chord note that shares the moment still counts.

In every other case the note is struck and printed, and the tool says why, with measure numbers, under the tab and in the copied or downloaded text. The reasons are kept apart: the string was needed for another note; the fingering placed the note on a different string; the note it is tied from could not be placed; it is tied from a grace note, which is never held; or the tie mark connects to nothing, as with a tie that is never finished in the file, one separated from its end by a rest, or one that another note has already ended. A struck tie sounds the right pitch at the right moment; it adds one attack that the score does not have. The check that runs after every conversion walks the finished tab string by string in playing order and fails if a hidden note's string is sounding anything else.

Choosing between correct positions

Most pitches can be played in several places. The choice among them is a judgement about comfort, not a fact from a source, and it never changes a pitch. The tool looks for the fingering with the least hand movement over the whole piece, with a mild preference for low frets and open strings:

cost = sum over every struck note or chord of 1 × frets the hand slides since the previous one + 0.2 × the fret numbers in it, added up + 1000 × chord notes that cannot be fingered a note or chord fits hand position h when every fretted note is on frets h to h + 3; open strings fit any position; each string carries one note at a time

The minimum is found exactly, by dynamic programming over the hand position at each step. It does not know about slides, bends, hammer-ons, which finger to use, or whether a long note in one voice can keep ringing while another voice moves. Treat the fingering as a starting point.

What is read from the file

  • Partwise MusicXML (score-partwise), uncompressed or compressed (.mxl).
  • Pitch: step, alteration and octave, including double sharps and double flats.
  • Transposition: chromatic and octave-change.
  • Rhythm: divisions and durations, used to space the columns in proportion to time. Both must be whole numbers (see below).
  • Chords, several voices in one measure (backup and forward), rests and grace notes.
  • Ties, as described above.
  • Notes the file marks as not printed (print-object="no") are converted like any other note. The specification says of that attribute only that it "specifies whether or not to print an object"; unlike a cue note, nothing makes such a note silent. The tool says how many of the notes it read carry the mark, under the tab and in the copied or downloaded text, since the printed score may not show them.

What is skipped, and said so

  • Timewise files (score-timewise) are refused with a message.
  • A part whose top staff has a tablature or percussion clef anywhere in it is skipped as a whole.
  • A part the tool cannot read reliably (an unreadable pitch or duration, a transposition with no value) is skipped with the reason. The other parts of the file stay available.
  • Only notes on the top staff are converted. Notes marked for any other staff, as in a piano part, are counted and reported in the verdict and under the tab, whether or not the part declares more than one staff.
  • A part with a fractional duration (<duration>0.5</duration>) is skipped with that reason. The format allows decimals but prefers whole numbers, "to avoid roundoff errors" in the specification's words, and this tool decides which notes start together and whether a tie meets its end by adding durations up, which is exact only for whole numbers. Exporting the score again normally gives whole numbers.
  • A part is also skipped, with the reason, when a note is marked as a chord tone but no note comes before it in its measure, when a chord mixes a grace note with an ordinary note, or when its durations add up to more than 9,007,199,254,740,991 units.
  • Cue notes and unpitched notes are skipped and counted.
  • A forward or backup of zero length, which some programs write, is read as no movement.
  • Repeats and endings are not written out: each measure appears once, in written order.
  • Alternate tunings, bass, ukulele, playback and Guitar Pro export are not offered.
  • Limits: a file over 20 MB, a compressed file that unpacks to more than 32 MB, or a part with more than 100,000 notes is refused with a message.

What the page address keeps

The address keeps your settings (capo, highest fret, octave, measures per line), so a bookmark brings them back. It never contains the file. That is why there is no "copy link to this result" button here: a link cannot rebuild a tab without the file, which stays on your device.

What this calculator is tested against

This tool cannot be published unless it reproduces every example below. 10 are copied from a published source. 24 were worked by hand from the cited rule.

ExampleExpectedBasis
The six open strings: E2, A2, D3, G3, B3, E4fret 0 on strings 6, 5, 4, 3, 2 and 1Published MusicXML 4.0 tutorial, Tablature
String 3, fret 5C4 (middle C)Published MusicXML 4.0 tutorial, Tablature
String 3, fret 7D4Published MusicXML 4.0 tutorial, Tablature
String 3, fret 8E-flat 4Published MusicXML 4.0 tutorial, Tablature
String 4, fret 5G3Published MusicXML 4.0 example "<technical> (Tablature)"
Guitar staff written C5 D5 E♭5 D5 C5 with <octave-change> −1sounds C4 D4 E♭4 D4 C4, the pitches on the tab staff below itPublished MusicXML 4.0 example "Tutorial: Tablature"
<divisions> 32 with <duration> 128A4 lasting a whole note (4 quarter notes)Published MusicXML 4.0 example "<divisions> and <duration>"
<duration> 1 with <divisions> 2an eighth note (half a quarter note)Published MusicXML 4.0 reference, <divisions> element
Three notes, the second and third marked <chord/>all three start togetherPublished MusicXML 4.0 tutorial, The MIDI-Compatible Part of MusicXML
A whole note, then <backup> 16, <forward> 8 and a G3 + B3 chord (4 divisions per quarter)G3 and B3 land on beat 3 (8 divisions in)Published MusicXML 4.0 tutorial, The MIDI-Compatible Part of MusicXML
C major scale, C3 to C4, quarter notesA string 3; D string 0 2 3; G string 0 2; B string 0 1By hand Standard tuning E2 A2 D3 G3 B3 E4 (MusicXML 4.0 tutorial, Tablature); one fret = one semitone
Chromatic run, every semitone from E2 to E4 (25 notes)frets 0 to 4 on each string in turn (0 to 3 on the G string), ending on the open high eBy hand Standard tuning E2 A2 D3 G3 B3 E4 (MusicXML 4.0 tutorial, Tablature); one fret = one semitone
E-flat major scale, E♭3 to E♭4, written with flatsD string 1 3; G string 0 1 3; B string 1 3 4By hand Standard tuning E2 A2 D3 G3 B3 E4 (MusicXML 4.0 tutorial, Tablature); one fret = one semitone
Awkward spellings: C♭4, F♭4, E♯4, B♯3, F double-sharp 4played as B3, E4, F4, C4, G4: B string 0, e string 0, e string 1, B string 1, e string 3By hand MusicXML 4.0 reference, <alter>: semitones, −1 for flat, 1 for sharp
C major triad C4 + E4 + G4 struck togetherthree different strings: G string 5, B string 5, e string 3By hand Standard tuning E2 A2 D3 G3 B3 E4 (MusicXML 4.0 tutorial, Tablature); one fret = one semitone
Six-note E major chord: E2 B2 E3 G♯3 B3 E4the open E chord: 0 2 2 1 0 0 from the low E string upBy hand Standard tuning E2 A2 D3 G3 B3 E4 (MusicXML 4.0 tutorial, Tablature); one fret = one semitone
D2, E2, G5, G♯5 with the highest fret set to 15D2 reported as below the guitar, G♯5 as above fret 15; E2 and G5 placedBy hand Standard tuning E2 A2 D3 G3 B3 E4 (MusicXML 4.0 tutorial, Tablature); one fret = one semitone
E2 and F2 written to sound at the same momentboth exist only on the low E string, so F2 is reported instead of being movedBy hand Standard tuning E2 A2 D3 G3 B3 E4 (MusicXML 4.0 tutorial, Tablature); one fret = one semitone
Guitar part written C4 E4 G4 C5 with <octave-change> −1sounds C3 E3 G3 C4: A string 3, D string 2, G string 0, B string 1By hand MusicXML 4.0 reference, <transpose> and <octave-change>
Two voices in one measure, the second written after a <backup>low E under the first melody note, B2 (A string 2) on beat 4By hand MusicXML 4.0 reference, <backup> and <forward>
E4 tied across a bar linestruck once in measure 1 and held; measure 2 shows only the G4By hand MusicXML 4.0 reference, <tie>
A tie whose end does not follow it directly: F4 (tie start), G4, then F4 (tie stop) in the next measurethe second C4 is held; the F4 in measure 3 is struck again, because the first F4 had already stoppedBy hand MusicXML 4.0 reference, <tie>; case from the OSMD test file test_Braille_TiesSimple
Ties that are never finished: five whole-note C5s, ties started in measures 1, 3 and 4, ended in 3 and 5struck in measures 1 to 4; only measure 5, which directly continues measure 4, is heldBy hand MusicXML 4.0 reference, <tie>; case from the LilyPond test-suite file 33i-Ties-NotEnded
Two grace notes marked for staff 2 in a part that never declares a second staff4 notes in the file: 2 placed, 2 reported as on another staff and not convertedBy hand MusicXML 4.0 reference, <staff>; case from the LilyPond test-suite file 24e-GraceNote-StaffChange
Grace C4 tied into the main C4, with a grace D4 between themall three printed on the B string: 1 3 1By hand MusicXML 4.0 reference, <grace> and <tie>
Grace E4 tied into the main E4, with a grace F4 between themall three printed on the high e string: 0 1 0By hand MusicXML 4.0 reference, <grace> and <tie>
Grace C4 tied into the chord C4 + B3the chord’s C4 is printed (B string 1) beside B3 (G string 4), not hiddenBy hand MusicXML 4.0 reference, <grace> and <tie>
Grace E4 tied into the chord E4 + F4E4 printed again on the open e string, with F4 on the B string, fret 6By hand MusicXML 4.0 reference, <grace> and <tie>
Grace chord C4 + E4 tied into the chord C4 + D4 + E4all five notes printed; the three-note chord is G string 5, B string 3, e string 0By hand MusicXML 4.0 reference, <grace> and <tie>
Grace G3 tied into the main G3 while a second voice plays A3 at the same momentG3 printed again (D string 5) together with A3 (G string 2)By hand MusicXML 4.0 reference, <grace> and <tie>
A5 B5 C6 with the octave set to auto (highest fret 15)none fit as written, all fit one octave down: e string 5 7 8, and the tool says soBy hand Standard tuning E2 A2 D3 G3 B3 E4 (MusicXML 4.0 tutorial, Tablature); one fret = one semitone
D4 E4 F♯4 with a capo on fret 2counted from the capo: B string 1, B string 3, e string openBy hand MusicXML 4.0 reference, <capo>: raises the open strings by that many half-steps
A rest between two notestwo beats of empty staff between the notes; the rest is not counted as a noteBy hand MusicXML 4.0 reference, <rest>
A timewise file (the specification’s <score-timewise> example)refused with a message, not half-readBy hand MusicXML 4.0 reference, <score-timewise>

Sources