JC's ABC Conversion Tools
The ABC extraction and conversion scripts used by the
tune finder can easily
be invoked via hyperlinks from your own web page,
to read an arbitrary URL, extract a tune, and optionally
convert it to PostScript, PNG, GIF or MIDI.
What you need is a hyperlink that starts with:
The ... is a list of parameters that list the URL and
say what you want done with it.
The parameters must be separated by ampersands (&),
and should include:
- is any of
- is the index number of the tune you want.
Use 0 (zero) to get the entire file.
- is an optional "canonicalized title" of the tune.
This is formed by removing all characters except letters,
and capitalizing the result.
It's best to leave off initial articles.
It is used to find the tune if the file has been renumbered.
- is the URL to read from.
- is what you want to call the result.
This is used by many browsers if you ask it to save the file.
It's not used otherwise, so you may omit it without problems.
If you use it, it must be last, or it won't work.
For example, suppose you want to extract tune number 17, Sam's Reel,
from the ABC file at http://foo.bar.edu/~joe/abctunes/jigs.abc,
and return it in PNG format.
The hyperlink you want might look like this:
For another example, suppose you have an ABC file on your own machine
which is running a web server, and you'd like to convert it to MIDI.
Here is a URL that you could type into your browser's URL entry widget
that will do the job:
If your browser is configured to play MIDI files, this should cause the tune
to come out of your speakers. This is best done with a real MIDI tool, so
you can adjust things like speed and tone, since my conversion program has
no way to control this.
A few comments on the delivered formats:
This returns the tune as MIME type text/plain.
This is useful if you can't get your browser to correctly handle the proper
ABC MIME type, text/vnd.abc.
It's also useful if you just want the ABC in an editable form.
This returns the file as as the official ABC MIME type, text/vnd.abc.
This is really just plain text, but it's a distinct type that
identifies the text as music notation, so you can configure a browser to
recognize it and invoke an ABC plugin.
Many web servers aren't configured to send ABC files as the correct type;
you can use this to get the correct type despite the web server.
PostScript is now accepted by almost all laser and bubble-jet printers,
and produces the highest-quality copy.
Curves and diagonal lines are drawn to the resolution of your printer,
and won't have the stair-step effects of the GIF and PNG formats.
- Portable Document Format
is the newer "improved PostScript" with a lot of capabilities not in
the original PS format. But it is often larger and slower to download
than PS, at least for music pages.
is a form of PostScript that is useful for
embedding inside other documents. A lot of word processors will
accept EPS and incorporate it into the document as part of the text,
or, in the case of ABC, as an image or illustration.
The Graphical Interchange Format
is the original graphical format used on the Web,
but there are growing legal problems with its use,
because it's a patented format owned by a corporation.
It is slowly being supplanted by PNG.
GIF and PNG have the same quality.
For text and music, they are usually better quality than JPEG,
but not as good as PS.
The Portable Network Graphic
is a public standard that can't be owned by a corporation,
so it is slowly replacing the GIF format.
PNG files are typically 20-30% smaller than GIF files,
so they download somewhat faster.
The quality of PNG and GIF are the same, not nearly as good as PS,
with stair-step problems on diagonals and curves.
The Musical Instrument Digital Interface format
is what the electronic music crowd uses to interface their instruments to
their computers. Our MIDI is rather minimal, with no choice of voice.
It will come out sounding like an electronic instrument, but is useful for
learning tunes. You will need real MIDI software to do anything more with it.