Jump to content

tab.c: a program that spits out tablature templates

Recommended Posts

I don't know if anyone else will find this useful, but if you have linux (or maybe OSX) and you want a program that can generate a wide range of useful tab templates for various stringed instruments, I've been working on this on and off for the past 5 years. It's what I personally use for all my tabs. I just added some functionality to shift standard tunings by a set amount of half-steps up or down, which is handy for bands like Godflesh.

There's no Windows binary. I work in Windows most of the time, but I program in linux. If someone wants to compile this under Windows, have at it.

Here's the source: https://neutronstar.org/tmp/tab.c
(compile with gcc -o tab tab.c -lm)

Here are a couple of template examples:

legion@neutronstar:~> ./tab -p 2 -t 2

e |-----------------|-----------------|-----------------|-----------------|
B |-----------------|-----------------|-----------------|-----------------|
G |-----------------|-----------------|-----------------|-----------------|
D |-----------------|-----------------|-----------------|-----------------|
A |-----------------|-----------------|-----------------|-----------------|
E |-----------------|-----------------|-----------------|-----------------|
  | e e e e e e e e | e e e e e e e e | e e e e e e e e | e e e e e e e e |
  |                 |                 |                 |                 |
  |                 |                 |                 |                 |
e |-----------------|-----------------|-----------------|-----------------|
B |-----------------|-----------------|-----------------|-----------------|
G |-----------------|-----------------|-----------------|-----------------|
D |-----------------|-----------------|-----------------|-----------------|
A |-----------------|-----------------|-----------------|-----------------|
E |-----------------|-----------------|-----------------|-----------------|
    e e e e e e e e   e e e e e e e e   e e e e e e e e   e e e e e e e e

legion@neutronstar:~> ./tab -s 4 -f -T -1

    Q Q Q Q   Q Q Q Q   Q Q Q Q   Q Q Q Q   Q Q Q Q   Q Q Q Q   Q Q Q Q

legion@neutronstar:~> ./tab -s 7 -T BEADGBE -w 2 -t 2 -c 100

e |-------------------------------------------------|-------------------------------------------------|
B |-------------------------------------------------|-------------------------------------------------|
G |-------------------------------------------------|-------------------------------------------------|
D |-------------------------------------------------|-------------------------------------------------|
A |-------------------------------------------------|-------------------------------------------------|
E |-------------------------------------------------|-------------------------------------------------|
B |-------------------------------------------------|-------------------------------------------------|
    e     e     e     e     e     e     e     e       e     e     e     e     e     e     e     e

legion@neutronstar:~> ./tab -b 7 -n 8 -T DbAbDbGbBbEb

    e e e e e e e   e e e e e e e   e e e e e e e   e e e e e e e

And here's a copy of the usage instructions so you can get an idea of what it can do:

./tab [-p #] [-b #] [-n #] [-s #] [-c #] [-w #] [[-f] -T TUNING] [-1 | -2 | -3 | -4]

        -p #            number of simultaneous parts (default = 1)
        -b #            beats per measure (default = 4)
        -n #            note division (default = 4)
        -s #            number of strings (default = 6)
        -c #            number of columns per line (default = 77)
        -w #            wide format for solos (default = 0, increase to add more space)
        -f              Accidentals will be shown as flats instead of sharps (only used
                        with the -T option, and it must appear BEFORE -T or it won't work)
        -T TUNING       Give string tuning from low to high (default=EADGBe)
                        NOTE: Supports [A-Ha-h#] (Hi, Germans!). "b" means flat and will break
                        shit if you try to use it as a note value (use "B").
                        If you want to drop or raise all strings a set amount from the default EADGBe
                        tuning, enter +n or -n here (where n is the number of half-steps) instead of
                        note values and the program will do the needful. This really only works for
                        guitars in standard tuning but it also works for basses in standard tuning
                        due to the programming. This displays sharps by default when they occur; to
                        show flats instead (e.g., "A#" will become "Bb"), use -f before -T.
        -t #            override timing marks. For instance, -b 2 -n 2 will divide
                        measures into two halves. Adding -t 2 will divide those "H" timing
                        marks into quarters, -t 4 into eighths, etc. while keeping the correct
                        time signature.
        -h              HALP

        -1, -2, -3, and -4 are common presets.

With the exception of -f, switches can be in any order. If you use the same switch twice with different
values, the last one wins (but if you use presets, the first one wins)


./tab -p 2 -b 7 -n 8 -s 4 -w 1 for 2 simultaneous parts, 7/8 time, 4 strings,
wide format

./tab -b 6 -n 4 -p 3 -t 2 -c 70 for 6/4 time divided into eighths, 3 parts, 70
columns to cut it down to two measures

./tab -T EbAbDbGbBbeb OR ./tab -f -T -1 for 6 strings tuned a half-step down

./tab -4 to rock out with your banjo out

Undocumented features: there are some exciting quirks in the behavior of regular
switches with preset switches. See how many you can find! Because I'm too lazy
to fix it.


This program only supports 1 to 9 simultaneous parts, 1 to 32 beats per
measure, 2 to 8 strings, and width of 0 to 35.

Note divisions must be 1 (whole), 2 (half), 4 (quarter), 8 (eighth),
16 (sixteenth), or 32 (thirty-second).

"-t" timing mark overrides have the same constraints as note divisions. These
marks divide the given note value into finer divisions (i.e., -t 4 divides
quarter notes into 4 sixteenth notes). Implementing this was way easier than I
expected. If you tried to divide finer than 32nd notes, hi!

All simultaneous parts must use the same tuning.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.


×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...