Extension:Myriad

Myriad Music plug-in lets you view, play, print, zoom, transpose tunes created with Harmony Assistant and Melody Assistant.

I've created this extension to add musical scores on my wiki.

I know there are some people working on Lilypond for Wikipedia. But Myriad music plug-in works differently.

Consider it works like Macromedia Flash : you have a file, need an external program, need a special tag.
 * 1) You create your score with Harmony Assistant, or import a MusicXML. Extension is .myr, .mus or .mu3.
 * 2) Upload it like an image.
 * 3) Myriad extension writes the object / embed to display the score.

On google we can find a flash extension for Mediawiki but it uses external .swf files, not uploaded ! Easy... :-)

On a programming side, it was a bit harder, but really interesting, you can copy it and modify to fit your need for other plug-ins (Flash now done - I didn't tested it -, Scorch...)

Tag : filename.myr|options The filename.myr is an uploaded one, or a link to an external file, on another website.

Contribution : Iubito 20:54, 21 May 2005 (UTC)

What is Harmony Assistant ?
Harmony Assistant is a commercial software for computer-assisted music composition and editing, with powerful harmonizing capabilities.

For me, its most unbeatable feature is the quality of the sound, instead of MIDI, Harmony Assistant uses a digital sound bank.

The one packaged in the downloadable plug-in is very tiny and lowest quality : about 600 KB. The biggest and best one, is sold on CD-Rom and called "Gold". A medium quality 6MB sound bank is downloadable at http://www.myriad-online.com/en/resources/extbase.htm

Harmony Assistant imports MusicXML. Melody Assistant is a shareware, with less features.

Requisits
Requires : Platforms : Browsers : mostly all
 * Myriad Music plug-in installed on users' computers.
 * Windows 95 to XP
 * Mac OS8 to OSX
 * seems to work on Linux through Wine (tested by some users)
 * IE 4+
 * Netscape 4+
 * Mozilla
 * Opera
 * K-Meleon
 * ICab
 * Safari
 * Camino

Install instructions

 * 1) Include it at the end of your LocalSettings.php : include("extensions/myriad.php");
 * 2) add .myr, .mus and .mu3 in the extension list : $wgFileExtensions = array('png','gif',...,'myr','mus','mu3');

If you want to translate the 2 messages in your language, go to http://yoursite/wiki/index.php?title=MediaWiki:myriadbeforeplugin and ...?title=MediaWiki:myriadafterplugin. You can also change the default values for height and width in MediaWiki namespace or in the myriad.php file.

Sample
For a complete list of parameters between tags, see the Myriad Music Plug-In Web Designer manual examples : file.myr|width=210|height=300|autoplay=on

http://www.anothersite.com/accordion.myr Produces : This screen capture show a score in the plug-in, with one of the sentences I've translated in French in the Mediawiki namespace.

For a simple melody, or a 2-3 staves scores (piano, organ) you can zoom. The best parameter, for a 800x600 screen is : file.myr|width=550|height=400|zoomvalue=220 which produces :


 * Trgnala Rumjana.myr
 * Shalom Aleichem.myr

PHP code (copy from here!)
Copy/paste into your editor, save it to extentions/myriad.php, and then upload it to your site.

<?php
 * 1) Myriad Music Plug-in WikiMedia extension
 * 2) http://meta.wikimedia.org/w/index.php?title=Myriad
 * 3) Tag :
 * 4)   uploaded filename.myr or .mus or .mu3|options
 * 5) Requires :
 * 6)   Myriad Music plug-in installed on users' computers.
 * 7) Platforms :
 * 8)   Windows 95 to XP, Mac OS8 to OSX, maybe Linux through Wine (not tested)
 * 9) Browsers :
 * 10)   mostly all : IE 4+, Netscape 4+, Mozilla, Opera, K-Meleon, ICab, Safari, Camino...
 * 11) Contribution by :
 * 12)   Iubito
 * 13) Myriad Music plug-in display, allow to play, print, zoom, transpose
 * 14) tunes created with Harmony Assistant and Melody Assistant.
 * 15) Harmony Assistant is a software for computer-assisted music composition
 * 16) and editing, with powerful harmonizing capabilities.
 * 17) For me, its most unbeatable feature is the quality of the sound, instead
 * 18) of MIDI, Harmony Assistant uses a numeric sound bank.
 * 19) The one packaged in the downloadable plug-in is very tiny : about 600 KB.
 * 20) The biggest one, the best quality, is sold on CD-Rom and called "Gold".
 * 21) A medium quality 6MB sound bank is downloadable at
 * 22) http://www.myriad-online.com/en/resources/extbase.htm
 * 23) Harmony Assistant imports MusicXML.
 * 24) Melody Assistant is a shareware, with less features.
 * 25) To activate the extension :
 * 26) - include it at the end of your LocalSettings.php : include("extensions/myriad.php");
 * 27) - add .myr, .mus and .mu3 in the extension list :
 * 28)   $wgFileExtensions = array('png','gif',...,'myr','mus','mu3');
 * 29) If you want to translate the 2 messages in your language, go to
 * 30) http://yoursite/wiki/index.php?title=MediaWiki:myriadbeforeplugin
 * 31) and http://yoursite/wiki/index.php?title=MediaWiki:myriadafterplugin
 * 32) You can also change the default values for height and width in MediaWiki
 * 33) namespace or in this file.
 * 34) For a complete list of parameters between tags, see the
 * 35) "Myriad Music Plug-In Web Designer manual"
 * 36) at http://www.myriad-online.com/en/docs/plugdoc.htm
 * 37) e.g. file.myr|autoplay=on|look=moon
 * 38) Enjoy !
 * 39) For those who want to create extension, you may be interested to look how
 * 40) I manage uploaded file (throught Image object), and also how to store default
 * 41) messages in the MessageCache (addMessage), and get them from the MediaWiki
 * 42) namespace or the MessageCache (wfMsg).
 * 1) at http://www.myriad-online.com/en/docs/plugdoc.htm
 * 2) e.g. file.myr|autoplay=on|look=moon
 * 3) Enjoy !
 * 4) For those who want to create extension, you may be interested to look how
 * 5) I manage uploaded file (throught Image object), and also how to store default
 * 6) messages in the MessageCache (addMessage), and get them from the MediaWiki
 * 7) namespace or the MessageCache (wfMsg).
 * 1) messages in the MessageCache (addMessage), and get them from the MediaWiki
 * 2) namespace or the MessageCache (wfMsg).

$wgExtensionFunctions[] = 'wfMyriad';

function wfMyriad { global $wgParser, $wgMessageCache; # register the extension with the WikiText parser # the first parameter is the name of the new tag. In this case it defines the tag ... 	# the second parameter is the callback function for processing the text between the tags $wgParser->setHook('myriad', 'renderMyriad'); # Default text before and after the plug-in, you can translate them in MediaWiki namespace. $wgMessageCache->addMessage('myriadbeforeplugin',		'To view, play and print this musical score, you need the Myriad music plug-in.'); $wgMessageCache->addMessage('myriadafterplugin',		'For a better sound quality, you can download GMSEBase sound base.'); # Default plug-in height and width, OK for a 800x600 screen $wgMessageCache->addMessage('myriadpluginheight', '500'); $wgMessageCache->addMessage('myriadpluginwidth', '325'); }

function renderMyriad($input) { //$input = "filename.myr|param=xx|param2=yy|..." $arr = explode('|', trim($input)); $img = new Image($arr[0]); //The parameters for object and embed $params = Array; # File uploaded or external link ? if (!$img->exists) $params['src'] = $arr[0]; else $params['src'] = $img->getURL; unset($arr[0], $img); //Don't change this $params['type'] = 'application/x-myriad-music'; $params['pluginspage'] = 'http://www.myriad-online.com/cgi-bin/mmplug.pl'; //Default height & width $params['height'] = wfMsg('myriadpluginheight'); $params['width'] = wfMsg('myriadpluginwidth'); //Other defaults, less important $params['antialias'] = 'high'; $params['soundbaselogo'] = 'off'; $params['desktopcolor'] = 'E7E3E7'; foreach($arr as $oneparam) { $pos = strpos($oneparam, '='); if ($pos !== false) { $left = trim(substr($oneparam, 0, $pos)); $right = trim(substr($oneparam, $pos+1)); $params[$left] = $right; }	}	unset($arr); //class="toctoggle" is just a hack to print on screen but not on printer ;-)	$output = ' '			. wfMsg('myriadbeforeplugin')			. ' '			. '';	foreach($params as $key=>$val) {		$output .= '';	}	$output .='$val) {		$output .= ' '.$key.'="'.$val.'"';	}	$output .='> '			. wfMsg('myriadafterplugin')			. ' ';	return $output; } ?>
 * 1) The callback function for converting the input text to HTML output