Group: http://groups.google.com/group/abc4j/topics
- Guitar Tablature support [2 Updates]
Topic: Guitar Tablature supportiubito <iub...@gmail.com> Apr 07 10:32AM -0700 ^
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 <iub...@gmail.com> Apr 07 10:35AM -0700 ^
--
erratum:
myTune.getVoice("1").setTablature(abc.notation.Tablature.GUITAR);
not myMusic! (it may work but this is not the right way...)
You received this message because you are subscribed to the Google Groups "abc4j" group.
To post to this group, send email to ab...@googlegroups.com.
To unsubscribe from this group, send email to abc4j+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/abc4j?hl=en.
Alessandro De Sanctis <adesa...@gmail.com> Apr 08 10:11AM +0200 ^
Hi Iubito,
thank you for your effort.
I'm not against automatic mapping from note to tab, but usually tab is given
and is not needed to be calculated (that usually is less efficient).
So it could be useful to have an extension of Note class (TabbedNote) with 2
more fields that are used only to render tab (if I know the note usually I
know string and fret). In this way I describe staff and staff in the same
moment adding TabbedNote to a Tune.
Again keep in mind that guitar can be tuned in different ways (as other
stringed instruments) so it could be useful to use a Tuning class to manage
it.
I can provide an efficient mapping routine ( but as previously said this has
to be used only for a joke), a tuning class with most used tuning for
guitar.
It can be useful to extend abc to support tab, also in a not standard way,
waiting for a proposal from standard for example with "|string,fret" or
similar to be added to note definition.
Could you please post a complete example ( a java class) that renders 1 note
and one chord with tab?
Ale
2011/4/8 <abc4j+...@googlegroups.com>
iubito <iub...@gmail.com> Apr 08 06:59AM -0700 ^
Hi Ale,
the tuning is given by the Note array in Tablature constructor
abc.notation.Tablature.GUITAR is a Tablature object with 6 notes
EADGBE
computeFingering does its job, but we can imagine to force fingering
but what happen if you tell F# is 5th fret on low A string (you can
force what you want!) ? F# is 2nd fret on low E string.
- Throw an exception?
- change note height to D?
We can imagine the following scenario :
- we have a EADGBE tablature
- we say put a note at f fret on s string : it returns a Note object
- you add duration to this note
- you insert the note into the music/voice
easier than extending note object.
The code which draws the strings and the numbers is all in
JTablature : .render and .renderNote(aNote)
--