Guitar Tablature support

32 views
Skip to first unread message

Denzo

unread,
Apr 1, 2011, 6:42:08 AM4/1/11
to abc4j
Hi all,

I'm interested in using abc4j for printing guitar tablature in java.
I spend some time looking at your code and I think it could be quite
simple as extension.
It could be also possible to extend abc to support guitar tab position
using specific marker that contains <string>,<fret> information and
modifying parser accordingly and add a introduction tag (ie TU:) to
specify guitar tuning.
From rendering point of view we can get it extending JNote (to contain
also string and fret information) and JStaffLine (to render tab below
music staff and adding tuning information). When we render a JNote we
can also render related tab info (same x pos but on different y pos)
My problem now is that I have no documentation to work effectively on
these 2 classes: how to extend JStaffLine height, how to define tab
dimension and so on (I loose my mind in a great number of classes with
few comments).
If someone can help me I'll be glad to add this new feature and
release on you trunk.
I'm also interested in supporting this development if you consider
this as mandatory.

Hope to have an answer from abc4j developers.

Ale

iubito

unread,
Apr 3, 2011, 6:21:56 AM4/3/11
to abc4j
Hi !
Be patient, i'll write a longer message with thoughts about how to
achieve this, and tips to help you.
I'm very busy thoses days
Sylvain

iubito

unread,
Apr 7, 2011, 1:32:37 PM4/7/11
to abc4j
Hi !
I've just commited into the SVN a first version of tablature,
fingerings are generated randomly, I'll let you improve this if you
have idea on how to achieve it.
I focused on rendering.

You attach a tablature to a voice (for now, there is only one voice in
graphic/midi output, but there are in music model) :
myMusic.getVoice("1").setTablature(abc.notation.Tablature.GUITAR);
"1" is the default name of the first voice.
I didn't find anything in ABC standard that tells the software to
render a tablature. We can imagine %% meta command, but as I said, I
focused on graphical rendering.

A Tablature object is made of notes, number of fret, and we may add
some settings, see comments in .computeFingerings()
I made some example : mandolin, bouzouki, charango and banjo are good
ones with strings not in ascending/descending order!

JTune.compute() calls the tablature string & fingerings computation
A JTablature is attached to a JStaffLine in JTune.initNewStaffLine()
in this method you have currentStaffLine.getBottomY() which give the Y
bottom position of the current staff line (not the one being
initialised), which take into account the tablature space and height,
and add the STAFF_LINE_SPACING template attribute.

About template attribute, a Tune object can be built from ABC parsing,
but also directly by programming, and using template. ABC parsing
should take into account %% meta command about fonts, spacings... but
this is not yet done... and not the priority

How to render things on tablature, 2 ways :
1) JTablature.renderNote - which is the most important : for the given
note, read the string/finger stored in a map by
Tablature.computeFingerings(), and render the number at the right
position. Called by JNote.render() :
getStaffLine().getTablature().renderNote()
2) JBar.render draws barlines on staff and also tablature. Another
class should do the same, JTimeSignature? JDecoration, JRepeatBar ( |
1, :|2...)

Mechanisms could be easily extended to other kind of tablature (why
note?), lyrics...

Enjoy!

iubito

unread,
Apr 7, 2011, 1:35:21 PM4/7/11
to abc4j
erratum:
myTune.getVoice("1").setTablature(abc.notation.Tablature.GUITAR);

not myMusic! (it may work but this is not the right way...)
Reply all
Reply to author
Forward
Message has been deleted
0 new messages