Guitar tablature data format
Asked Answered
U

6

9

I'm writing a quick front end to display guitar tablature. The front end is in Flash but I want to store the tab in some human-readable format. Anyone know of something that already exists? Any suggestions on how to go about it? One idea I got from reading some stackoverflow posts was to use a strict ASCII tab format like so:

e||-1------3--------------0--|----2-------0---
B||--1-----3------------1----|----3-------0---
G||---2----0----------0------|----2-------1---
D||----3---0--------2--------|----0-------2---
A||----3---2------3----------|------------2---
E||----1---3----3------------|------------0---

It has advantages. I can gain a lot of info from the structure (how many strings, their tunings, the relative placement of notes) but it is a bit verbose. I'm guessing the '-'s will compress away pretty well when sent over the wire.

If anyone knows of an existing data-format for describing guitar tab I'll take a look as well.

edit:

I should note that this format is 90% for me and may not ever been seen by anyone other than myself. I want an easy way to write tab files that will be displayed eventually as graphics in a Flash front-end and I don't want to have to write an editor front end.

Uncertain answered 10/7, 2010 at 17:4 Comment(1)
I'd go with the plain text format you example in your question. It was very common back in the day, works on any computer without any additional software required, and prints easily.Prolongate
S
5

Check out the ASCII tab format.

guitar tab format description

Snappish answered 10/7, 2010 at 17:26 Comment(1)
This is close to what I'm thinking. Thanks. Not sure I'll support any and all tabs since I'll be writing the tabs in question by hand myself but I can try and get the most common slurs and effects in.Uncertain
L
2

ASCII export would be a great feature, but using ASCII as internal data format is not a good idea. For example, note durations would be extremely hard to express (hou would you store 32nds or even 16ths?, not to mention triplets...), so parsing those files would be extremely difficult. Moreover, users would be tempted to load ASCII files created outside your app, which will be likely to fail.

To sum up, i'd recommend to either try to reuse existing format or invent your own if that's not feasible. You may try to use XML for that.

EDIT: Beside DGuitar, i know of TuxGuitar and KGuitar, which support Guitar Pro files. You can look into their sources or ask their authors about file formats. I think there is also open source PowerTab-to-ASCII converter.

Literal answered 10/7, 2010 at 17:18 Comment(0)
M
1

These are not human readable:

Most common formats are Guitar Pro (proprietary) and PowerTab (freeware). DGuitar and TuxGuitar are open source viewers for Guitar Pro format. I'm sure that they have documentation for the format somewhere (at least in the code).

Advantage for using a common format would be the easiness of making tabs with those programs.

The Guitar Pro 4 format is described here http://dguitar.sourceforge.net/GP4format.html

Mineralogy answered 10/7, 2010 at 17:10 Comment(1)
Thanks, I've come across both of those before but I don't like the idea of getting stuck into a proprietary binary format. Guitar Pro exports to ASCII so maybe I can check how that looks and import something similar. I am not trying to make anything even slightly near as complex as either program.Uncertain
S
1

See Supported file formats in TuxGuitar.

TuxGuitar is open-source multiplatform software for reading, writing and playing the guitar tabs.

It supports the mentioned Guitar Pro and PowerTab format, and it also has its own TuxGuitar (.tg) format.

Snappish answered 10/7, 2010 at 17:21 Comment(0)
I
1

If you need the backend data structure to remain in human readable form I would probably stick it in a CDATA inside of XML. That could be inserted into a relational database with song/artist/title information and become searchable. Another option is to save it as zipped text files and insert links to those files in a database with the main artist info still searchable by sql.

Incest answered 10/7, 2010 at 17:31 Comment(0)
S
0

I wrote a quick utility for displaying tab. For personal use. You can happily take the internal format I used.

I use a very simple string based format. There are three important structures.

Column, a vertical column in the output tab - all notes played simultaneously. Bar, a collection of Columns Motif, a collection of Bars

A Column looks like ':#|:#|*:#' where each * is a string number and each # is a fret number. If you are playing a chord you separate each string:fret with a '|'

A Bar looks like '[,,-,*]' where each * is a Column. A - indicates an empty column where no notes are played.

A Motif looks is just many Bars running back to back. For instance

"[1:5,-,3:7,-,3:5,-,3:7,-,-,3:5,3:7,-,1:8,-,1:5]"

    e||---------------|---------------||
    B||---------------|---------------||
    G||---------------|---------------||
    D||--7-5-7--57----|--7-5-7--57----||
    A||---------------|---------------||
    E||5-----------8-5|5-----------8-5||


"[-,-,1:3|2:2|3:0|4:0|5:3|6:3,-,-][-,-,3:0|4:2|5:3|6:2,-,-]"

   e||--3--|--2--||
   B||--3--|--3--||
   G||--0--|--2--||
   D||--0--|--0--||
   A||--2--|-----||
   E||--3--|-----||
Synergy answered 20/1, 2016 at 20:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.