Archive for the ‘Typesetting’ Category

ScoreRender released

Wednesday, March 14th, 2007

OK, this is my first Wordpress plugin (well, it isn’t strictly my plugin, since this is a heavy modification of FigureRender), so code can be ugly. But anyway, it’s stable enough to be released.

scorerender.abelcheung.org is intended to be the primary site for this plugin, as well as functioning as a demo site.

Like FigureRender, it renders inline sheet music fragments into images. But I have added support for several more music notations, as well as dropping LaTeX fragment support. The reason? I’ve been working with LatexRender author recently to merge improvements back to his plugin, thus leaving ScoreRender for a single purpose. Theorectically it can do a trillion things (like gnuplot, chemistry rendering, chess board rendering, and so on), but then it simply becomes mod_tex, an Apache module for rendering LaTeX fragment and everything in the world, but limited to Wordpress usage. Not worth the duplication of effort.

Anyway, for those insane enough to try my plugin, please enjoy and report any bug encountered! Please use the primary site for reporting bug, or better yet, use the TRAC system kindly established by wp-plugins.org.

Scorerender svn repository ready

Friday, March 2nd, 2007

With help from Matt, a public subversion repository is set up now (or here for browsing). For now I would concentrate on making LatexRender better, but that needs a substantial amount of work, especially when Steve wants an independent page to turn on or off rendering for each individual comment.

I’d like to make sure things work under Win32 environment as well, but this definitely needs another machine (or a reinstall of my Windows XP, it’s not bootable for almost a year). MusiXTeX support is also planned. Not sure if using transparent PNG as default image is a good thing, since I decidedly ignore IE6’s incapibility, but… well, time to switch to IE7, or even better, Firefox.

But MusiXTeX is analogue to machine code to me. Can’t haste, especially when I have course to teach next Tuesday.

pros and cons of ABC notation

Sunday, February 25th, 2007

Basically, existing implementations of ABC music notation are almost usable. Indeed there are still some critical problems that prevent it from being production ready, but it’s already much better than GUIDO notation — well, to put it more accurately, it is the rendering that matters. One picture is better than a thousand words:

(more…)

Adding Guido support to my plugin

Wednesday, February 21st, 2007

Now GUIDO music notation is also supported in my (still) unreleased Wordpress plugin (subversion repository available though). It is basically a modified version of Chris Lamb’s FigureRender plugin, dropping latex support and adding support for other music notations; sadly it seems Chris has no time to continue working on it. Dropping latex support is due to my discussion with Steve Mayer about merging improved latex configuration back to his LatexRender plugin.

BTW, I start to recognize supporting GUIDO notation is not such a great thing. Before looking more deeply into GUIDO specification and putting it under practical rendering, everything looks wonderful to me — a web service called NoteServer, an open source implementation of parser library under SourceForge, plugin available for Sibelius and Finale… everything points to the conclusion that it is a greatly supported notation format.

But I didn’t notice other clues: this project is in articulo mortis. Not really dead (there is still a little CVS activity), but slow to a crawl. No news and no release since early 2004. So-called advanced notation spec never materialized. The source code doesn’t even compile on my Linux box (probably a bit better on Windows and OS X?). Last but not least, it doesn’t really live up to its word. See a real testing below.

The fragments below show how GUIDO and Mup renders the first 2 bars from Prokofiev 8th Sonata 2nd movement. First it’s GUIDO:

Now it’s mup’s turn. THIS is what people really should see.

No specific tuning for both of them, except adjusting font size for Mup (GUIDO doesn’t even allow that). No cross-stave barline, ugly slur by default (I don’t want to do any trial-and-error with bezier curve, not to mention NoteServer doesn’t conform to its own spec now), doesn’t support dynamics in between staves, doesn’t support more than one string on the same beat (notice GUIDO has eaten the dolce string). GUIDO is good for research interest, but in no way can it match publication quality.

Feb 22 edit: the GUIDO source fragment is available in comment.

Adding mup support for figurerender

Wednesday, May 31st, 2006

I have always been hoping to bring mup support to figurerender plugin for Wordpress, and this is what I get after several hours of work:

And the source:


[mup]
score
topmargin = 0
bottommargin = 0
leftmargin = 0
rightmargin = 0
pagewidth = 4
pageheight = 2
scale = 0.5
time = 4/4n
staffs = 2
key = 2#
beamstyle = 4,4,4,4
barstyle = 1-2
brace = 1-2


staff 1
label = ""
staff 2
label = ""


music
1: 4a+d6f6a6; d+f+a+d6; f+a+d6f6; g+a+e6g6;
2: 4ad+f+; ad+f+a+;; ad+e+g+;
octave above 1: 2 "8" til 1m+1.5;
bar


1: a+d6f6a6; r; g+a+c6e6a6; r;
2: ad+f+a+; r; a-cega; r;
boldital (16) between 1&2: 0.5 "sff"; 2.8 "sff";
bar


staff 2
clef = bass


music
1: d+f+a+d6; r; <<staff clef=bass>>[with >]gac+f+; 8a;;
2: dfad+; r; a1a-; 8a1;;
octave above 1: 0 "8" til 1.5;
boldital (16) between 1&2: 0.5 "sff";
bar


1: [with >]dfd+; r; 2;
2: [with >]d1d-; r; 2;
endbar
[/mup]

Cool uh? This is the last few bars from the last movement of Rachmaninoff’s 3rd Piano Concerto. The basic function is there, but some more bugs must be ironed out before make it public (either as patch or independent plugin):

  • The option about showing music or latex source in ALT text must be turned off. If the source contains double quote, the HTML tags can be very confused, causing the rendering broken.
  • I really want to make it work with PHP 4.x. Currently I’m using some hack on my own server, but…
  • Making it less prone to security problems (temp file creation etc)

My TODO list

Saturday, December 3rd, 2005

I just discovered my TODO list is too long:

  1. Improve CJK support in Ubuntu
  2. Organize GNOME and Ubuntu translation teams
  3. Update Hong Kong locale data in glibc (or better, belocs for Debian/Ubuntu; I also know glibc maintainers are frustrating to deal with)
  4. Creating word list for Taiwan to Hong Kong translation
  5. Study natural language processing and Chinese grammar, and research how to perform a low-error-rate translation between simplified and traditional Chinese (!)
  6. Continue my typesetting of Prokofiev’s 2nd Piano Concerto
  7. Create LiveCD for OSFarm and write article
  8. Company related work
  9. Learn how to do Debian packaging

Each of these is enough for keep me busy for months. Now I can just wish I have the health to strive through all of these…

Lilypond is NOT the solution

Wednesday, November 30th, 2005

Finally, I really made up my mind. In the end I can only use mup despite its limitations. Typesetting music in lilypond is like writing program — although lilypond is more flexible, it takes a tremendous effort even to typeset a single passage, not to mention multi-stave music. I’ll try to summarize the pros and cons for using lilypond and mup on orchestral work:

  1. In lilypond, the accidental of each note is automatically handled; what you type is what it would sound like in c major, and lilypond would automatically add/subtract sharp or flat sign for each note according to current major/minor. In contrast, mup purely takes care of the visual appearance; you would typeset according to how it appears in score. If there is a sharp on the sheet, you add a sharp. Lilypond has an advantage here, as it allows changing accidental style readily (20th century music, cautionary accidental etc).
  2. Mup input is entered in a per-bar basis; this is the same for multi-stave work. Enter all the staves and voices for one bar, group them together, then enter the 2nd bar. In contrast, lilypond handles it in a per-voice way — yes, even polyphonic passage in single staff is entered voice by voice. No, I didn’t mean you are forced to do so; what I mean is you would find it even more clumsy and time wasting to enter it bar by bar in lilypond.
    I find mup’s treatment much more convenient, as it is way more easy to debug non-fatal errors when something goes wrong. With lilypond, especially when using relative octave mode, changing one note may affect the whole score’s layout and note positioning (all notes may increase or decrease 1 whole octave, sometimes even 2). That’s very hard to trace. But lilypond’s treatmeat isn’t always that bad — treating the whole passage of a voice as a unit allows cross-bar beaming easily, and that’s why I want to try out lilypond in the first place; just that I realized lilypond style isn’t my cup of tea.
  3. As a result of per-voice handling, lilypond allows a per-stave setting for virtually every attribute, like time signature, key signature and so on. This is a big plus. As of Mup 5.1 there is still no such thing as per-stave time signature yet, one has to do some hack to get it done, and it’s really painful to get it work in multi-stave scores (think about changing time signature for every stave but one).
  4. Vertical collision detection between staves — basically lilypond has no such thing, while mup handles it almost perfectly. Bad for me.
  5. Another sore point — dynamics (e.g. sfz) between staves. Again, mup handles it readily. Well, there is a ‘hack’ documented in lilypond user guide that does this. But guess what? Dynamics is treated as an empty stave containing only spaces and dynamics themselves, in between 2 staves. Weird huh? This shows the flexibility of lilypond, as well as the sutpidity. Besides it is really hard to merge the hack into the score, it’s complex. For orchestral work this is Pain In The Ass ™.

So based on the last 2 points I decided I can’t use lilypond at all, since it may take me many years (literally) to typeset a whole concerto. It takes me 3 days to figure out how to adjust the vertical position of a dynamics mark. I’m not really willing to work like a programmer in order to typeset something.

This is not to say lilypond is bad though. Its flexibility and the scheme support allows it to do quite a lot of unusual layout, which is not possible with mup (unless you know PostScript internals). However, it really was using too much time for me to learn, and time is what I am lacking of.