Best practices for accidentals in online music writing, and introducing jQuery Accidentals

In an ideal world, you see five musical symbols here:

flat natural sharp double-flat double-sharp

But, depending on the device you are using to read this, you may notice one of these problems:

  • None of the symbols show up properly: they are either missing or replaced with squares, diamonds, question marks, or some other “placeholder” symbol.
  • The flat, natural, and sharp appear properly, but the double-sharp and double-flat are missing or placeholders.
  • The symbols don’t quite match each other—they appear as though they come from different fonts.

And for the blogger or other online writer, there is an additional problem: these characters aren’t easily typed from a keyboard. Using them means copy-and-pasting or remembering obscure numeric codes. And then you hope that your readers’ devices can display them.

So, for most situations, some kind of text substitution is made. Two styles are fairly common:

  • Spelling out the symbols in words, such as “A-flat.”
  • Using a “close-enough” character, such as “A#” (pound sign, number sign, or hash) or “Bb” (lower-case B).

Using words is my preferred method, since using “#” and “b” is semantically incorrect, garbles the meaning for non-visual browsing devices (such as screen readers for the blind), isn’t compatible with all fonts (such as those that don’t have a clearly-differentiated upper- and lowercase B), and can be ambiguous:

  • “Today I did my patented Ab Workout. It’s basically all the major and minor scales starting from Ab.”
  • “Today I did my patented Ab Workout. It’s basically a bunch of sit-ups.”

Thus, I recommend this usage: “A-flat,” “B-natural,” “C-sharp,” “D-double-sharp,” “E-double-flat.” Note the hyphens (with no spaces), and the lower-case accidental names (even for titles: Sonata in D-flat).

This solves the major issues of typing and reading the accidentals in an onscreen situation, but leaves us with a rather inelegant and typographically boring representation of the true musical symbols. This would be intolerable for print media, and, as screen text steadily replaces print text, a better solution is required. Here are some possible scenarios (warning—a little technical):

Read more