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:
http://trillian.mit.edu/~jc/cgi/abc/tuneget?...
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:
- F=(format)
- is any of
TXT,
ABC,
PS,
EPS,
GIF,
PNG,
MIDI
- F1=(value)
- says which "find" button was pushed.
F0, F1 and F2 are currently defined.
The value isn't used, but should be non-null.
Omitting this param picks a default,
and is equivalent to pressing Return in the entry widget.
- X=(index)
- is the index number of the tune you want.
Use 0 (zero) to get the entire file.
- U=(URL)
- is the URL to read from.
- N=(name)
- is what you want to call the result.
This is used by 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.
For example, suppose you want to extract tune number 17 from
the ABC file at http://foo.bar.edu/~joe/abctunes/jigs.abc,
and return it in GIF format.
The hyperlink you want might look like this:
<a href="http://trillian.mit.edu/~jc/cgi/abc/tuneget?F=GIF&X=17&U=http://foo.bar.edu/~joe/abctunes/jigs.abc&N=SamsReel.gif">
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:
http://trillian.mit.edu/~jc/cgi/abc/tuneget?F=MIDI&X=0&U=http://localhost/some/dir/foo.abc
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:
- TXT
-
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.
- ABC
-
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.
- PS
-
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.
- EPS
-
Encapsulated PostScript 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.
- GIF
-
The Graphical Interchange Format
is the original graphical format used on the Web,
but there are growing legal problems with its use.
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.
- PNG
-
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 faster.
The quality of PNG and GIF are the same, not nearly as good as PS,
with stair-step problems on diagonals and curves.
- MIDI
-
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.