Treble + bass clef rendering

61 views
Skip to first unread message

Hanns Holger Rutz

unread,
Aug 8, 2013, 5:54:26 AM8/8/13
to ab...@googlegroups.com
hi there,

I need to render piano music spanning Treble and bass register. I have read in an old thread that there is a limitation with the ABC parser not producing more than one clef, but that the rendering machine should be able to display multiple clefs.

Since I already use an internal representation of notes and chords, going via the parser is anyway not necessary for me.

However, the API seems pretty restricted with respect to generating a Tune object by hand? For example the Tune class has only private constructor. So my question is: How would I create a Tune with the API (not using the Parser) and populate it with the Clefs and notes/ chords?

Thanks very much!

Best, Hanns Holger

Hanns Holger Rutz

unread,
Aug 8, 2013, 5:59:16 AM8/8/13
to ab...@googlegroups.com
correction—I tried the example from https://groups.google.com/forum/#!topic/abc4j/6p204Ay2OKU now and that compiles, so I was wrong about the private constructor.

so I will try to advance here first...

Hanns Holger Rutz

unread,
Aug 8, 2013, 6:13:16 AM8/8/13
to ab...@googlegroups.com
For instance, this naive approach (in Scala, but no different than equivalent Java code):

import abc.ui.swing.JScoreComponent
import abc.notation._

val scoreView = new JScoreComponent
val tune = new Tune()
val music = tune.getMusic

val keyT = new KeySignature(Note.C, KeySignature.MAJOR)
val keyB = new KeySignature(Note.C, KeySignature.MAJOR)
keyB.setClef(Clef.BASS)
val voiceT = music.getVoice("1")
val voiceB = music.getVoice("2")
voiceT.addElement(keyT)
voiceB.addElement(keyB)
val n1 = new Note(Note.C)
n1.setStrictDuration(Note.QUARTER)
voiceT.addElement(n1)

... will just assemble the three elements sequentially:

Screen shot 2013-08-08 at 12.11.36.png

Hanns Holger Rutz

unread,
Aug 12, 2013, 7:16:11 AM8/12/13
to ab...@googlegroups.com
no one?
> <Screen shot 2013-08-08 at 12.11.36.png>
>
> Do I have to add a multi part definition or something?
>
> Thanks, .hh.
>> --
>> You received this message because you are subscribed to the Google Groups "abc4j" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to abc4j+un...@googlegroups.com.
>> To post to this group, send email to ab...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/abc4j.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>



Reply all
Reply to author
Forward
0 new messages