adamjenkins / moodle-tiny_sheetmusic
The sheet-music authoring plugin for Moodle's TinyMCE editor: a toolbar button and Insert menu item that open the local_sheetmusic score editor
Package info
github.com/adamjenkins/moodle-tiny_sheetmusic
Language:JavaScript
Type:moodle-tiny
pkg:composer/adamjenkins/moodle-tiny_sheetmusic
Requires
- adamjenkins/moodle-local_sheetmusic: >=0.1 <1.0
- moodle/composer-installer: ^1.0
- moodle/moodle: ^4.5 || ^5.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
The sheet-music authoring plugin for Moodle's TinyMCE editor. It adds a toolbar button and an Insert menu item that open the score editor, and writes the resulting score into the HTML field in the suite's stored-content form.
This is one of three plugins in the sheetmusic suite:
| Plugin | Role |
|---|---|
local_sheetmusic |
The shared engine: document model, serialisers, engraver |
filter_sheetmusic |
Displays scores wherever Moodle renders text |
tiny_sheetmusic |
Authors scores in Moodle's editor (this plugin) |
Why a TinyMCE subplugin
A tiny_* subplugin is handed the live context in both of its PHP entry points, so score
authoring can be switched on for music courses and activities without being forced on the whole
site. An editor_* plugin has no supported way to do that.
Availability is controlled by the capability tiny/sheetmusic:use, allowed for all
authenticated users by default — students answer notation exercises with the same editor their
teachers set them in. Remove it from a role, or override it in a context, to take the button
away there.
Requirements
- Moodle 4.5 or later.
local_sheetmusic2026082100 or later. This is a hard dependency: the engine is where the notation code lives.- The TinyMCE editor.
editor_tinysupportsFORMAT_HTMLonly, so score authoring is available only in HTML-format fields.
filter_sheetmusic is not a hard dependency, but without it a score will be stored and never
displayed as notation. The plugin checks whether the filter is active in the current context and
says so when it is not.
What the dialogue does
The dialogue is this plugin's; the editing surface inside it is local_sheetmusic/editor, the
engine's public editing module. That split is deliberate — the modal, the buttons, the
author-facing warnings and everything that touches the HTML field live here, and nothing that
understands notation does.
- Insert. Write ABC, watch it engrave as you type, press Insert score. What lands in the
field is a
<pre class="sheetmusic sheetmusic-abc">holding the source as entity-encoded text. A score that does not engrave cannot be inserted: the dialogue stays open and says why. - Edit. Click a score already in the field and the same dialogue reopens with its source.
Scores are found by the
sheetmusicmarker class alone, never by what the display filter makes of them. - Import. ABC, MusicXML (
.xml,.musicxml,.mxl) and MIDI. MIDI import is a guess and is presented as one: the dialogue opens its limits, lists everything the import had to assume, and gives you grid, time signature, key and transposition controls to correct it before anything reaches your page. - Export. SVG, PNG, PDF and MIDI, from whatever is currently in the editor.
Status
Beta. Authoring, editing, import and export work, as do point-and-click and keyboard note
entry: the notes tab is the default, and the ABC source remains available on its own tab with a
live preview. The preview and saved scores can be played back, with a speed control (playback comes
from local_sheetmusic, and a site administrator can turn it off there). MIDI-keyboard input and
Braille output are a later phase.
Design documents
Comments in this plugin refer to DESIGN.md, RELATIONS.md and the P0-FINDINGS-* notes by
bare name. Those are the sheet music suite's development records and are deliberately not shipped
inside the plugin: they cover all three plugins together and change on a different rhythm from the
code. RELATIONS.md in particular is the normative contract between the plugins - the stored
<pre class="sheetmusic sheetmusic-abc"> format, the engine's public module API, and the editor
and filter coupling - and is the document to read before changing either side of a boundary.
They are kept with the suite's development documentation alongside the source repositories rather than in this one.
Licence
GPL v3 or later.