Music Sheet Viewer WordPress plugin

« Music Sheet Viewer » plugin allows you to display and play, one or more music sheets written in MEI, MusicXML (incl. compressed format), ABC … in a WordPress page.

The code is entered directly using the shortcode tag [pn_msv] … and that’s all!!

You do not need to escape HTML entities or anything. Just post your code as-is, even if the code is an XML dialect. The plugin will handle the rest.

The score is resized automatically so as to fit to the available content, you can specify the music font in which the score will be rendered and you can get the music code from a file if you don’t want to write the code inline.

You can play the score and there’s even an option to highlight the notes as they are played!

This plugin supports multi-pages scores and when played, the pages are turned automatically.

With this plugin, never ever upload a music sheet image to your website that is not zoomable and requires a new upload every time a single note must be changed!!!

At last it’s fully responsive!

Example : This same page uses the « Music Sheet Viewer » plugin.

The following PAE code :


displays as :

MusicSheetViewerPlugin 3.0.3


The plugin can be installed from : Music Sheet Viewer on WordPress plugins directory


The music sheet rendering is powered by the Verovio JavaScript toolkit.

The score can be played thanks to an enhancement of the Rism MIDI Player.

Supported formats

« Music Sheet Viewer » supports code written in :

Supported inputs

The input can be entered either inline inside [pn_msv] and [/pn_msv] shortcode, or for big scores, using the file parameter.

Content displayed

This plugin can play any score, even multi-pages ones.

Navigation inside multi-pages scores

If the score has several pages, the user can click (or tap on a device) on the right side of the score to move to next page, or the left side to return to the previous page.
A double click (double tap) right goes the the last page, while a double click left returns to the first page.

When the score is played, pages are turned automatically.

Score layout

The score fits automatically to the content in which it’s placed without any specific indication.
If what is displayed is too small to fit to the allowed content it’s possible to justify the rendering, using the layout="justified" parameter.

Shortcode parameters


Format of the music sheet code when passed inline. Has no effect if file parameter is used.

Possible values :

  • mei (MEI)
  • xml (MusicXML)
  • abc (ABC)
  • or pae (RISM format)

Default format is pae as it’s compact and convenient for displaying music sheet fragments.

Note that « Music Sheet Viewer » doesn’t check that the code is written in the language passed to format parameter. If they don’t match, the result is unpredictable.


If the code isn’t specified inline, allows to indicate either :

  • a local file previously uploaded on your website
  • In this case, file parameter must start with a ‘/’ and is assumed to be found under your website’s root.

    Example :

    [pn_msv file="/wp-content/uploads/2017/05/DoSerrure.mei"/]
  • a remote file
  • Specify the complete URL of the file.

    Example :

    [pn_msv file=""/]

The referenced file can be of any supported format including compressed MusicXML format.
In this latter case, the file must necessarily have a « .mxl » extension.

Local .mxl files are supported although unadvised as they require useless uncompression time : .xml files are recommended.


Renders the score with the corresponding SMuFL font. The following fonts are available :

  • Leipzig
  • Bravura
  • Gootville
  • Petaluma

By default, Leipzig is used.

A specific font value (« roll ») allows the music fragment to be displayed in a loop, in all available fonts. The font is changed every 2 seconds and the animation lasts 2 minutes. It can allow choosing at preview time which font is best for your score, or just to show it for demonstrating the capabilities of digital scores.


Plays the score with a MIDI piano synthesis.
The following options are possible:

  • player
  • Plays the score thanks to the mini-player.

  • auto
  • Plays the score automatically at page load.

  • highlight
  • Same as « player » but the notes are highlighted as they are played.


    [pn_msv format="abc" play="highlight"]
    T:La Vie En Rose
    MusicSheetViewerPlugin 3.0.3

  • autohigh
  • Same as auto but the notes are highlighted as they are played.

Remarks about multi-pages score playing

  • It the score has several pages, the pages are turned automatically when the music reaches the last note of the page.
  • When paused, playing restarts always from the place it was paused, even if we had navigated to another page in the meantime.


By default the score fits automatically to the content in which it’s placed.

layout="justified" allows to maximize the space used to display a score line too small to fit to the allowed content.
To keep for this specific situation as this option will display every music sheet on a single line.

This is the only possible layout value so far.

Example :
Without justification :

@data:=25//$xFCG @c 2-4.-'8E/{6AGFE}{8A''C}'B''4D{6C'B}/{''DC'BA}{''8EA}
MusicSheetViewerPlugin 3.0.3

With justification:

[pn_msv layout="justified" font="Gootville"]
@data:=25//$xFCG @c 2-4.-'8E/{6AGFE}{8A''C}'B''4D{6C'B}/{''DC'BA}{''8EA}
MusicSheetViewerPlugin 3.0.3


Allows you to assign an id to the underlying generated HTML element.
That allows you styling it with a CSS element selector.


Allows you to assign a class to the underlying generated HTML element.
That allows you styling it with a CSS class selector.

NB : CSS styles on a specific page can be added by means of the Per page add to head plugin

Advanced topics

Mini-player styling

The Mini-player style can be overridden according to your needs.
Insert your own CSS styles in your page body by means of your theme customization (if any) of through dedicated plugins.

Roughly the Mini-player is structured as follows:

For example if you want to style the mini-player with the national Spanish flag colors and rounded borders, use:

.midiPlayer_div{background:#EF3340;border-radius: 4px;}

You’ll get:

For more possibilities, please read the js/midiplayer.css in music-sheet-viewer plugin’s directory.

Call pn_msv shortcode in a PHP page

You may want to be able to iterate over many uploaded files of your site so as to display all of them in a same page.
This is possible with this kind of code : The directory in question is opened, then pn_msv shortcode is called on any file in a supported format.

$uploads = wp_upload_dir();
if ($dir = opendir($uploads['basedir'].'/2017/05')) {
    while (false !== ($file = readdir($dir))) {
     if ($file != "." && $file != "..") {
         $lenfile = strlen($file);
         if ($lenfile > 4) {
            if ((strrpos($file, ".abc", $lenfile-4) === FALSE)
            && (strrpos($file, ".mei", $lenfile-4) === FALSE)
            && (strrpos($file, ".pae", $lenfile-4) === FALSE)
            && (strrpos($file, ".mxl", $lenfile-4) === FALSE)
            && (strrpos($file, ".xml", $lenfile-4) === FALSE))
            else echo do_shortcode('[pn_msv file="/wp-content/uploads/2017/05/'.$file.'"/]');

Error messages

Error messages can raise at preview time (e.g font parameter with an unknown value), letting you fix the code prior to publishing.
Or they can raise later, for example if the content of a score file previously uploaded is changed and produces a loading error : In this case the error might only be visible in the browser’s console in development mode.


From WordPress 5.0 it is strongly recommended to switch to the Classical editor if you intend to write pn_msv shortcodes with inline MusicXML or MEI code.
Indeed, the block editor, even with shortcodes, swallows some tags like <body> which is a licit MEI tag.

Known limitations

  • No nested shortcodes are allowed within MEI or XML formats.
  • The font="roll" is not compatible with « play » options. It’s either one or the other.
  • If several shortcodes in the same page have the font="roll" option, the behaviour is unpredictable.
  • Specific fonts are not compatible with play="highlight" or « autohigh » options. In that case the font — if any — is forced to Leipzig.
  • If several shortcodes in the same page have the font="auto" or « autohigh » options, the behaviour is unpredictable.
  • If a score with font="roll" is currently displaying and another score is played, the roll effect is stopped.
  • If a multi-pages score is played in highlight mode, a slight delay may be experienced when page turns.
  • If a score is played, when paused, if we have navigated inside another score of the page, when resumed, playing will restart from the beginning.


You can find many examples of plugin options implemented at:

Gallery of examples using Music Sheet Viewer plugin

Les commentaires sont fermés.