Problem with textual formats for music

I was setting up a lot of stuff for my blog, and the one thing I want to have is the ability to input musical notation. From here, I had four problems regarding musical notation input, from the most wanted to the least:

  1. I want to input notation as text easily.
  2. I want the notation to be rendered into the browser and integrated into the blog without a tedious setup.
  3. I want the notation to be produced beautifully.
  4. I want the format to be usable by others.
  5. I want the format to be extensible and portable with other notation software.

At the time of writing, the format I only knew  was LilyPond and there wasn't a JavaScript library available for rendering from LilyPond. I have not considered other formats that are readily available. So I was left to search on alternatives and found ABCjs. So that gets my first item off the list, however looking at the format, I found it with a need for improvement, but I will get to that later.

Seeing that Ghost does not support adding your own embeds, I decided to hack the default theme and create a custom script to render the text format into notation. With a bit of reading into the documentation on how to lay out the rendered notation, I managed to make the rendering work (this is done on-the-fly; I shall replace this following figure with an image as soon as I have found and integrated another solution):

X: 1
T: Sva Nok le, Nado
O: Makedonija
R: slow pravo
M: 4/4
L: 1/8
K: F
[| "C"[c3e3] [df] [ce][Bd] [Bd][Ac] | "F"[Ac][G2B2] [Ac] [GB][FA] [FA][FC] \
| [FA][GB] [GB][Ac] "C7"[GB][Ac] [GB][FA] | "F"[FA][GB] [FA][CG] [FA][GB] [Ac][Bd] |
| "C"[dB][ce] [ce][df] [ce][Bd] [Bd][Ac] | "C7"[Ac][B2G2] [Ac] "F"[GB][FA] [F2A2] \
| [FA][GB] [GB][Ac] "C7"[GB][Ac] [GB][FA] | "F"[F8A8] |]
[| "F"([F3A3] [GC]) [F2A2] ([FA][GB]) | ([A3c3] [GB]) ([GB][FA][F2A2]) \
| ([FA][GB]) [A2c2] "C7"([GB][Ac]) ([GB][FA]) | "F"([F3A3] [CG] [FA][GB] [A2c2]) |
| "F"[F2A2] ([FA][CG]) [F2A2] ([FA][GB]) | ([A3c3] [GB]) ([GB][FA] [F2A2]) \
| ([FA][GB]) [A2c2] "C7"([GB][Ac]) ([GB][FA]) | "F"[F8A8] |]
[| "C"[c4e4] ([ce][Bd]) ([Bd][Ac]) | "F"([A3c3] [GB]) ([GB][FA] [F2A2]) \
| ([FA][GB]) [A2c2] "C7"([GB][Ac]) ([GB][FA]) | "F"([F3A3] [CG] [FA][GB] [A2c2]) |
| "C"[c4e4] ([ce][Bd]) ([Bd][Ac]) | "C7"([Ac][B2G2]) [Ac] "F"([GB][FA]) [F2A2] \
| ([FA][GB]) [A2c2] "C7"([GB][Ac]) ([GB][FA]) | "F"[F8A8] |]

So it definitely crosses the second item off our list.

Is it beautiful? To my standards, it's sort of mediocre (observe the slurs), but at least it's a working solution and it isn't that bad--third item off our list.

Now to the fourth item, take a look at the text source (which I copied from some other Web site offering ABC notation tutorials):

X: 1
T: Sva Nok le, Nado
O: Makedonija
R: slow pravo
M: 4/4
L: 1/8
K: F
[| "C"[c3e3] [df] [ce][Bd] [Bd][Ac] | "F"[Ac][G2B2] [Ac] [GB][FA] [FA][FC] \
| [FA][GB] [GB][Ac] "C7"[GB][Ac] [GB][FA] | "F"[FA][GB] [FA][CG] [FA][GB] [Ac][Bd] |
| "C"[dB][ce] [ce][df] [ce][Bd] [Bd][Ac] | "C7"[Ac][B2G2] [Ac] "F"[GB][FA] [F2A2] \
| [FA][GB] [GB][Ac] "C7"[GB][Ac] [GB][FA] | "F"[F8A8] |]
[| "F"([F3A3] [GC]) [F2A2] ([FA][GB]) | ([A3c3] [GB]) ([GB][FA][F2A2]) \
| ([FA][GB]) [A2c2] "C7"([GB][Ac]) ([GB][FA]) | "F"([F3A3] [CG] [FA][GB] [A2c2]) |
| "F"[F2A2] ([FA][CG]) [F2A2] ([FA][GB]) | ([A3c3] [GB]) ([GB][FA] [F2A2]) \
| ([FA][GB]) [A2c2] "C7"([GB][Ac]) ([GB][FA]) | "F"[F8A8] |]
[| "C"[c4e4] ([ce][Bd]) ([Bd][Ac]) | "F"([A3c3] [GB]) ([GB][FA] [F2A2]) \
| ([FA][GB]) [A2c2] "C7"([GB][Ac]) ([GB][FA]) | "F"([F3A3] [CG] [FA][GB] [A2c2]) |
| "C"[c4e4] ([ce][Bd]) ([Bd][Ac]) | "C7"([Ac][B2G2]) [Ac] "F"([GB][FA]) [F2A2] \
| ([FA][GB]) [A2c2] "C7"([GB][Ac]) ([GB][FA]) | "F"[F8A8] |]

If you notice, the format is compact, but cryptic. However, this is expected as most rich content has to be typified in a way that it can be easily transferrable. If you're curious, try viewing RTF, for example, as plain text and see how clever it was formatted to be able to see the richness of the content. You can say the same goes with TeX to some sort, although materials written in TeX is often rendered to PDF so the source gets lost.

So it seems that the ABC format is somewhat used in some circles, but I don't think it's extensible enough, so we can't get into our last item. It's OK, we're doing good so far with three out of five items on our list.

Going back to my observation earlier, there's something beyond the format that I want to criticize and it's the way musicians interpret scores.

Excerpt from Beethoven's Piano Concerto No. 3

Notice the key signatures in the B clarinets, the horns (labeled 2 Corni in Es, translated as 2 Horns in E♭), the trombones, and the timpani. Then compare it with all the other instruments. Even though the piece is in E♭ (this is called concert pitch), each instrument has a transposed version of the key of the piece, to their own key (which is called written pitch). If you notice how LilyPond and ABC treats each note, each format assumes that the scores always get written in concert pitch. I find it biased to the instruments that use concert pitch anyway.

Now, what if one needs to transpose the piece they had written in LilyPond or ABC? With the pitch of the notes specified in the original key, one would need to rewrite all the notes from the start!

For now, I'm happy with ABC, however, I would need to prepare a lot of relevant content for me to maximize this feature.

Stay tuned (no pun intended).