Export Score to image without JScoreComponent

105 views
Skip to first unread message

alexand...@gmail.com

unread,
Feb 7, 2013, 12:49:10 PM2/7/13
to ab...@googlegroups.com
Hi,

I would like to use abc4j in my application to transform music into beautifully rendered images. But since it's an android application, the JScoreComponent can't be used. So the code:

        Tune tune = new TuneParser().parse(tuneAsString);  
        TuneParser parser = new TuneParser();
        JScoreComponent jscore = new JScoreComponent();
        jscore.setJustification(true);
        jscore.setTune(tune);
        jscore.writeScoreTo(new File("D:/path2UrPngFile/myScore.png"));

doesn't work because you don't have access to the javax.swing.JComponent on android.

Is there a way to create images without the JScoreComponent, or with any other method that doesn't cause a dependency on javax.swing?
I saw some posts regarding android in this group, but I don't know what the current state is.

Many thanks
Alex 

Gary Phillips

unread,
Feb 8, 2013, 7:44:52 AM2/8/13
to ab...@googlegroups.com
Hi Alex

I have a working Android port of JScoreComponent with some missing
features (and a few which I added for my own use) which is based on an
earlier version of abc4j. It relies on a graphics compatibility
library (code.google.com/p/awt-android-compat).
JScoreComponent.writeTo() isn't supported but would be quite easy to
add I think.
I'm happy to send you a tar file of the source if that's any help.

Performance of abc4j on Android was quite poor even after a fair
degree of optimisation. My application had an interactive text editor
(modify text of abc and its score is updated) which was just about
bearable to use on small melodies (it worked by reparsing and
redrawing the entire score whenever the text changed). Having said
that, my target hardware was a G1 which is possibly the slowest
Android phone in existence!

The port is based on abc4j's hand-made abc parser which has now been
replaced by the parboiled parser. Sergey Yershov started an Android
port based on the current version of abc4j (which adopted the
Parboiled parser) but reported it was very slow and ultimately not
suitable for the application he had in mind. I was already working on
my port and didn't want to reintegrate to try the latest codebase
(bleeding-edge at that time) so I haven't tried the more recent trunk
of abc4j.

There is another Java codebase for ABC. Its object model is quite
rudimentary compared to abc4j and the parser is less forgiving but it
does seem much faster. Depending on your application it might be
preferable to port abcj to Android.
http://abcj.ganderband.com

Regards
Gary
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

alexand...@gmail.com

unread,
Feb 14, 2013, 11:54:28 AM2/14/13
to ab...@googlegroups.com, gary.p...@rolmo.com
Hi Gary,

thanks for the quick response and the detailed information. If you could send me the working Android Port, it would help me a lot! Is it possible to send a private message here? If not, send it to alexander.pacha(at)tum.de.

Performance is not really an issue for my application, since the notes are only parsed once, to create an image that is displayed to the user.

What do you mean with JScoreComponent.writeTo() is not supported? This is the main functionallity I would use, unless you tell me another way to display the parsed notes.

Best regards
Alex

utpal kumar Jha

unread,
Mar 6, 2014, 4:17:57 AM3/6/14
to ab...@googlegroups.com, gary.p...@rolmo.com, alexand...@gmail.com
hellooo alll even i am facing the same problem of rendering musical scores on android if could send me that tar file of source i would greatly appreciate it  :) :)
Reply all
Reply to author
Forward
0 new messages