Summary: add and edit abc music using existing PmWiki scripts and rendered as score and midi by abcjs javascript abc editor
Version: 2020-01-20
Prerequisites: PmWiki 2.2.56 (compatible with PHP 7.2)
Status: stable
Maintainer: DaveCooke
License: (Apache 2.0|BSD-3-clause|BSD-2-clause|GPL|LGPL|MIT|MPL-2.0|CDDL-1.0|EPL-1.0) - OpenSourceLicenses Cookbook:Cookbook Licenses
Users: (view? / edit)
Discussion: AbcSong-Talk?

Questions answered by this recipe

  • How can I enter, display and print songs on a PmWiki webpage?

All sections are optional, you can remove those that do not apply to your recipe, and add new ones.


This recipe is designed to display and play music entered onto the Wiki page using ABC notation. Designed to be compatible with the latest browsers and (hopefully) independent of PHP version. Based on work by HansB and abcjs by Gregory Dyke and Paul Rosen.


Download abcsong.zipΔ, unpack the files to the associated directories, and add to config.php:



There are currently 4 options

  1. To order the songs including any leading articles (the/a etc.) i.e. 'The Apple' follows 'Barnacle' or to ignore the articles i.e. 'The Apple' preceeds 'Barnacle'. The default is to ignore it. To include set
  1. You may have as many song groups as you want. The default is 1, Songbook. Any others may be added by adding the group name to the array $SongGroup again in config.php prior to inclusion.

For example:

   $SongGroup[] = "NewGroup";

If you do create a new group, you need to copy and rename 3 pages in wikid.b for the default group as:

   Songbook.Songbook -> NewGroup.NewGroup
   Songbook.GroupFooter -> NewGroup.GroupFooter
   Songbook.Template -> NewGroup.Template
  1. The media bar can be placed at the top or bottom of the song. Default is top. To move to bottom set
	$Top = 0;
  1. The midi download link may be diabled by adding the line:
	$MidiDownload = 0;


Example config.php entry

	$Top = 1;
	$MidiDownload = 0;
	$SongGroup[] = "Contemporary";

Demonstration Site

A demonstration site has been set up at

This set up in the same way as my own site, I have set it up for 'playing with' all changes will be reset every day. Password is set to 'password'. It is set up with two songbook groups and a couple of tunes / songs in each.

New Tune

To create a new page is pretty much the same as any other PmWiki site. Either create a link or type in the camel cased name in the address bar. What will be displayed is a blank page with just a media play/progress bar. Click on edit and enter the ABC data foir that song or tune . Save and all being well, the tune will be displayed.

Edit Tune

Editing a page is also the same as a normal wiki page, just using Main/ABC Notation.

If you select to display ABC data, when a page is being displayed, the ABC data can be temporarily edited - a sort of sandbox. The noted being edited will be highlited on the score. Similarly when a note is selected, its code is highlighted. In this mode, any changed ar lost when you move on to another page or page reloaded. As the displayed data is standard abc notation, then anyone else may now copy it and us it elsewhere.

Midi Download

If enabled, the link provided will download an independent midi file, which may be saved and played off-line


To do / some day / maybe

  1. Print to pdf / epub
  2. Print as a book (A Song Book)

If you have future plans or wishes for this recipe.

Change log / Release notes

  • 2020-01-20: initial release.
  • 2020-02-18: Update 1
   Improved printing
   Ability to move media bar to top or bottom
   Removed requirements for 'special characters' only abc notation required.
  • 2020-02-27: Update 2
   Improved printing
   Downloadlink for midi file
   Display/hide download link
  • 2020-06-16: Update 3
   error removed from script which inhibited script if download of media disabled.

See also



See discussion at AbcSong-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.