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
- 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
- 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.
$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
- The media bar can be placed at the top or bottom of the song. Default is top. To move to bottom set
$Top = 0;
- The midi download link may be diabled by adding the line:
$MidiDownload = 0;
Example config.php entry
$IgnoreArticle=1; $Top = 1; $MidiDownload = 0; $SongGroup = "Contemporary"; include_once('cookbook/abcsong.php');
A demonstration site has been set up at http://s593332318.websitehome.co.uk/folkwiki/pmwiki/pmwiki.php
This set up in the same way as my own site, http://folk-lyrics.co.uk 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.
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.
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.
If enabled, the link provided will download an independent midi file, which may be saved and played off-line
To do / some day / maybe
- Print to pdf / epub
- 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.
- AbcMusic - Display music scores from abc notation
- With thanks to PetkoYotov
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.