Extension:AbcMusic

Overview
You can typeset music with this extension, using the ABC notation.

Use the tags ... to enclose ABC text.

Use the tags ... to enclose a URL to an ABC file.

See the Wikipedia article on ABC notation for links to tutorials and song collections.

Example: Inline ABC


Source:

X:1 T: Twinkle Twinkle Little Star M: 2/4 L: 1/4 K: C w: Twin- kle twin- kle lit- tle star, "F" F F | "C" E E | "G7" D D | "C" C2 | w: how I won- der what you are.
 * "C" C C | "C" G G | "F" A A | "C" G2 |

Example: Links to External ABC Files


Source:

http://ecf-guest.mit.edu/~jc/music/abc/Russia/Hopak.abc

This is a link to a file in John Chamber's online ABC music collection.

Implementation Notes
This implementation uses LilyPond as the underlying rendering engine. LilyPond comes packaged with a script, abc2ly, that converts ABC notation to LilyPond. The extension calls abc2ly then LilyPond.

The script abc2ly is a very nice piece of code, but it is not being actively developed, and it is lagging behind the current ABC standard. (Programmers, go forth and develop!)

abc2ly does not handle multiple songs in a single file, so this extension splits a multi-song file into separate parts, and makes repeated calls to abc2ly then LilyPond. This is suboptimal, in terms of process overhead.

This extension will inherit any other limitations of abc2ly.

Further Work
1. Make the generated MIDI file available. Just follow the coding pattern used in Extension:LilyPond for exposing the midi file.

2. Include an enhanced script abc2ly as part of this extension.

3. Tag to include a directory of .abc files on the web.

4. Tag to crawl and render a tree of .abc files on the web.

Acknowledgement
This code was originally derived from Extension:LilyPond.

Installation
Make sure you have LilyPond installed.

Then copy AbcMusic.php into the extensions/ directory.