Errors compiling

20 views
Skip to first unread message

Suhel

unread,
Jan 9, 2011, 3:09:53 PM1/9/11
to abc4j
Dear Group,
I would like to use your JScoreComponent code and perhaps also the
object oriented music representation code as a foundation for learning
and I would also like to adapt it to create a very simple score
editor. I couldn't find better code in Java for music scores, so I
decided to use yours, license permitting. I'm still a student and this
is for a project, and unfortunately I don't have much time so I need
to make an assessment of the feasibility of this deed first.. The real
first problem I'm encountering is that the source, as it is, has many
errors and won't compile. Is it possible therefore to get the source
of a stable, compilable, error-free release?
Thank you in advance,
Suhel Jaber

Suhel

unread,
Jan 9, 2011, 7:01:20 PM1/9/11
to abc4j
I stand corrected. Warnings aside, it does compile. What doesn't
compile are the examples from the wiki.
Are there newer examples around? What I'm interested in is the object
oriented representation and its graphical representation.
Thanks,
SJ

Gary

unread,
Jan 9, 2011, 8:02:34 PM1/9/11
to abc4j
Hi Suhel

Please post your error messages so we can see what's wrong.

What version of the source are you using?

I'm using the subversion read-only checkout of the code (See
http://code.google.com/p/abc4j/source/checkout) and had some minor
problems compiling.
However, the only changes required were to the build.xml file.
I didn't see any Java compilation errors at all except for some
warnings about the source file character encoding (fixed by an option
in build.xml).

Gary
P.S.
The license is "Lesser GPL" which I believe means that you can use the
abc4j library unchanged for your application without having to
distribute the application source code. However, if you make changes
to the library you must distribute the library source code.

Gary

unread,
Jan 9, 2011, 8:53:42 PM1/9/11
to abc4j
(Ignore my message asking for your output - you've solved that one).

The API is slightly different to that on the Wiki.

String tuneAsString = "X:0\nT:A simple scale exercise\nK:D
\nCDEFGABcdefggfedcBAGFEDC\n";
Tune tune = new TuneParser().parse(tuneAsString);
JScoreComponent scoreUI = new JScoreComponent();
scoreUI.setTune(tune);

In my test app I put the abc string into a JTextArea and update the
JScoreComponent whenever the text changes. It's very nice and quite
fast (on my 2GHz laptop).
The proper way to do it is to use abc.ui.swing.TuneEditorPane which
has colorising etc.

To get you started on the internals of abc4j for your project.
You could start at abc.notation.Tune to understand the object oriented
representation. Tune.transpose walks the object structure which
represents the notes etc. of a Tune.

abc.ui.swing.JTune.compute is responsible for creating graphical
objects which represent of abc.notation.Tune.

Drawing the graphics starts with abc.ui.swing.JScoreComponent as the
"top level" graphics object.
JScoreComponent paints itself by calling JScoreComponent.render which
calls JTune.render which in turn calls render on its children ... a
classic recursive update
You could try setting a debugger break point on JNote.render to see
this all in action.

When you are building your editor you will probably need to know how
the graphical display relates to the object model, to handle mouse
clicks etc. JScoreComponent.getScoreElementAt(Point location) might
be useful. See abcynth.PlayerApp for an example.

Hope that helps a bit.

Вася Пупкин

unread,
Jan 23, 2011, 6:08:46 PM1/23/11
to abc4j
Dear group.
Thank you for the tool. I use it as Swing component to display a score
and I want to add some notes about compilation, wiki and parser. The
last two items are off-topic... Nevertheless:
About that compilation warnings. They are caused (at least 15-20 of
them) by source file encoding since source code contains some native
French symbols. Using UTF-8 will solve this problem.
Another note is about wiki. Your library is much more powerful than
you describe it. For example, "Music model" with MultiNote may be used
to create polyphonic scores but this was not clear until I had
downloaded and investigated the source code.
And the last. Some symbols (e.g. øØ°) are impossible to input without
installing additional keyboard layouts (or input them as esc-
sequences). I think it's better to replace them with Latin letters.

BR,
Andrei Kuznetsov

PS: Thank you for your wonderful tool.
Reply all
Reply to author
Forward
0 new messages