abc2svg
abc2svg
Not logged in

abc2svg is a set of Javascript files which permits to edit, display, print and play music that is written in the ABC music notation.

The abc2svg core is based on abcm2ps but it may run in any system without recompilation.

The specific features of both abcm2ps and abc2svg are described (with abc2svg!) in this page.

Web usage

The abc2svg scripts may be loaded in any web browser when they are pointed to by <script src= tags in XHTML or HTML files.

These scripts may reside either in the local file system or in a HTTP/web server. Especially, they are available in my site http://moinejf.free.fr/js/ and are updated when a new release is out.

There are:

When looking at a ABC file in a web browser, you may also use a bookmarklet as this one for rendering all tunes, or this one for rendering the tunes one by one.

Notes:

Then, you may edit and save both files.
There may be only one included file.

nodeJS usage

Installed via npm, the abc2svg package comes with the command line (batch) programs abc2svg and abc2odt.

These ones may be used as abcm2ps to generate XHTML or ODT files.

abc2svg writes to standard output:
        abc2svg mytunes.abc > Out.xhtml

abc2odt output is abc.odt or the file specified by the command line argument -o:
        abc2odt my_file.abc -o my_file.odt

Build

If you want to build the abc2svg scripts in your machine, you must first get the files from chisel, either as a tarball or a Zip archive (click Timeline and then in the top commit), or by cloning the repository in some directory:

fossil clone https://chiselapp.com/user/moinejf/repository/abc2svg abc2svg.fossil
fossil open abc2svg.fossil

Then, building is done using the tool ninja or samurai.
You may do it:

        NOMIN=1 samu -v

        samu -v

If you also want to change or add music glyphs, you may edit the source file font/abc2svg.sfd. In this case, you will need both base64 and fontforge, and run

        samu -v font.js

If you cannot or don't want to install ninja or samurai, you may build the abc2svg files by ./build which is a shell script.

Batch

After building the abc2svg scripts, you will be able to generate music sheets from the command line as you did with abcm2ps, thanks to the following shell scripts (the result goes to stdout):

backend scripts

By default, the batch scripts generate (XHTML+SVG) files.
This output may be modified by backend scripts. These ones must appear just after the command.
There are:

PDF generation

abctopdf is a shell script which converts ABC to PDF using one of the previous shell scripts and, either a chrome/chromium compatible web browser, or the program weasyprint or the program rsvg-convert.

With rsvg-convert, the used music font must be installed and defined by %%musicfont <fontname>.

Note also that, with weasyprint or rsvg-convert, the paper size is forced to A4. Instructions for changing this size may be found in the script source.

The output PDF document may be specified by the command line argument -o (default abc.pdf).

Example:
        abctopdf my_file.abc -o my_file.pdf

MEI support

As an experimental feature, an extented core mei2svg-1.js may be generated. This one may handle both the ABC and MEI notations.

In browser mode, the script abcemb-1.js loads either abc2svg-1.js or mei2svg-1.js after checking the music notation type (%abc or X: is ABC, <mei is MEI - see this tune for an example).

In batch mode, the script abcqjs also loads the right abc2svg core according to the source file extension (.abc or .mei).

Jean-François Moine