Extension:Myriad
From MediaWiki.org
|
Myriad Release status: stable |
|
|---|---|
| Implementation | Tag |
| Description | Myriad Music plug-in |
| Author(s) | Sylvain Machefert (Iubito Talk) |
| MediaWiki | 1.4+ |
| Download | no link |
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 to embed.
- You create your score with Harmony Assistant. Extension is .myr, .mus or .mu3. You can also use directly a MusicXML file with the plug-in.
- Upload myr... or xml it like an image.
- Myriad extension writes the object / embed to display the score.
Tag :
<myriad>filename.myr|options</myriad> <myriad>http://site/file.myr</myriad> <myriad>http://site/musicxmltune.xml</myriad>
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)
Contents |
[edit] 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.
[edit] Requisits
Requires :
- Myriad Music plug-in installed on users' computers.
Platforms :
- Windows 95 to XP
- Mac OS8 to OSX
- seems to work on Linux through Wine (tested by some users)
Browsers : mostly all
- IE 4+
- Netscape 4+
- Mozilla
- Opera
- K-Meleon
- ICab
- Safari
- Camino
- ...
[edit] Install instructions
- Include it at the end of your LocalSettings.php :
include("extensions/myriad.php"); - add .myr, .mus and .mu3 in the extension list :
$wgFileExtensions = array('png','gif',...,'myr','mus','mu3'); - Using MusicXML files with .xml extension works, but allowing them in upload may cause some security problem.
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.
[edit] Sample
For a complete list of parameters between tags, see the Myriad Music Plug-In Web Designer manual examples :
<myriad>file.myr|width=210|height=300|autoplay=on</myriad>
<myriad>http://www.anothersite.com/accordion.myr</myriad>
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 :
<myriad>file.myr|width=550|height=400|zoomvalue=220</myriad>
which produces :
Template:Br
[edit] PHP code (copy from here!)
Copy/paste into your editor, save it to extentions/myriad.php, and then upload it to your site.
<?php # Myriad Music Plug-in WikiMedia extension # # http://meta.wikimedia.org/w/index.php?title=Myriad # # Tag : # <myriad>uploaded filename.myr or .mus or .mu3|options</myriad> # Requires : # Myriad Music plug-in installed on users' computers. # Platforms : # Windows 95 to XP, Mac OS8 to OSX, maybe Linux through Wine (not tested) # Browsers : # mostly all : IE 4+, Netscape 4+, Mozilla, Opera, K-Meleon, ICab, Safari, Camino... # Contribution by : # Iubito # # Myriad Music plug-in display, allow to play, print, zoom, transpose # tunes created with Harmony Assistant and Melody Assistant. # # Harmony Assistant is a 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 numeric sound bank. # The one packaged in the downloadable plug-in is very tiny : about 600 KB. # The biggest one, the best quality, 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. # # To activate the extension : # - include it at the end of your LocalSettings.php : include("extensions/myriad.php"); # - 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 http://yoursite/wiki/index.php?title=MediaWiki:myriadafterplugin # You can also change the default values for height and width in MediaWiki # namespace or in this file. # # For a complete list of parameters between tags, see the # "Myriad Music Plug-In Web Designer manual" # at http://www.myriad-online.com/en/docs/plugdoc.htm # e.g. <myriad>file.myr|autoplay=on|look=moon</myriad> # # Enjoy ! # # For those who want to create extension, you may be interested to look how # I manage uploaded file (throught Image object), and also how to store default # messages in the MessageCache (addMessage), and get them from the MediaWiki # namespace or the MessageCache (wfMsg). $wgExtensionFunctions[] = 'wfMyriad'; $wgExtensionCredits['parserhook'][] = array( 'name' => 'Myriad', 'description' => '[http://www.myriad-online.com/en/products/mmplugin.htm ' . 'Myriad Music plug-in] ' . 'display, allow to play, print, zoom, transpose tunes ' . 'created with ' . '[http://www.myriad-online.com/en/products/harmony.htm ' . 'Harmony Assistant and Melody Assistant].', 'author' => 'Sylvain Machefert', 'url' => 'http://www.mediawiki.org/wiki/Extension:Myriad' ); 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 <myriad> ... </myriad> # 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 <a href="' .'http://www.myriad-online.com/en/products/mmplugin.htm' .'" target="_blank">Myriad music plug-in</a>.'); $wgMessageCache->addMessage('myriadafterplugin', 'For a better sound quality, you can <a href="' .'http://www.myriad-online.com/en/resources/extbase.htm' .'" target="_blank">download <em>GMSEBase</em> sound base</a>.'); # Default plug-in height and width, OK for a 800x600 screen $wgMessageCache->addMessage('myriadpluginheight', '500'); $wgMessageCache->addMessage('myriadpluginwidth', '325'); } # The callback function for converting the input text to HTML output function renderMyriad($input) { //$input = "filename.myr|param=xx|param2=yy|..." $arr = explode('|', trim($input)); $img = Image::newFromName($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'; $params['imgbkcolor'] = 'FFFFFF'; 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); if (!isset($params['zoom'])) $params['fullwidth'] = 'on'; //class="noprint" you can edit commonPrint.css to say that .noprint doesn't print on printer, only on screen $output = '<div class="noprint" style="text-align:center; font-size:84%;">' . wfMsg('myriadbeforeplugin') . '<br />' . '<object classid="CLSID:07000E2B-6AAD-497D-8E5B-5976560AD429" border="0" ' . 'height="'.$params['height'].'" width="'.$params['width'].'">'; foreach($params as $key=>$val) { $output .= '<param name="'.$key.'" value="'.$val.'" />'; } $output .='<embed '; foreach($params as $key=>$val) { $output .= ' '.$key.'="'.$val.'"'; } $output .='></embed></object><br />' . wfMsg('myriadafterplugin') . '</div>'; return $output; } ?>

