Features
Web Music Score is a TypeScript/JavaScript library for rendering and
playing music notation directly in the browser.
It provides a modern API, flexible document builder, audio playback, and
optional React components for easy UI integration.
π Compatibilityβ
- Bundled in ESM, CJS and IIFE formats.
- The target JavaScript version is ES6/ES2015.
- No polyfills are included.
πΌ Core Featuresβ
β Music notation renderingβ
- Staff, grand staff, guitar tab, and combined guitar notation
- Clefs: Treble, Bass, octave-down variants, tab tunings
- Automatic layout for measures, rows, beams, accidentals, ties, slurs slides, tuplets
- Lyrics, annotations, labels, navigation symbols, fermatas
- Staff groups for custom placement of text/markings above/below systems
β DocumentBuilder APIβ
A powerful, chainable JS/TS API for constructing notation:
let doc = new Score.DocumentBuilder()
.setScoreConfiguration("treble")
.addMeasure()
.addNote(0, "C4", "4n")
.addRest(0, "4n")
.getDocument();
Supports:
- Score configuration presets & custom objects
- Headers, tempos, key signatures, time signatures
- Notes, chords, rests, tuplets
- Lyrics placement & hyphens
- Guitar tab string/fret handling
- Annotations, labels, extensions
- Playable navigation (repeats, D.S., D.C., Codas)
π§ Audio Playbackβ
Built-in playback engineβ
- Default synthesizer instrument included
- Accurate timing, navigation, repeats, tuplets
- Programmable via Score.MPlayer
Instrument modulesβ
- audio-cg: Classical Guitar module (browser or npm)
- Easily create custom instruments by implementing:
class MyInstrument implements Audio.Instrument {
playNote(note, duration, volume) {}
stop() {}
}
π» Browser & Framework Supportβ
Browserβ
- IIFE bundle available from unpkg / jsDelivr
- Loads as global WebMusicScore
- Optional instrument bundles: e.g. audio-cg
Reactβ
- First-class React UI components
<MusicScoreView />,<PlaybackButtons />- React 18+ compatible
- Ideal for score viewers, exercises, music education apps
Plain JavaScriptβ
A simple canvas renderer and playback controls:
new Score.MRenderContext().setCanvas("canvasId").setDocument(doc).draw();
new Score.MPlaybackButtons().setPlayButton("play").setDocument(doc);
π¦ Modulesβ
Web Music Score is split into logical modules for efficient importing:
- core β errors, utilities
- audio β playback engine & interface
- theory β scales, intervals, time signatures
- score β notation structures, rendering
- react-ui β React components
- pieces β demo songs
- audio-cg β classical guitar instrument
πΉ Instrumentsβ
Includedβ
- β Synthesizer
Optional modulesβ
- β Classical Guitar (audio-cg)
β loadable via npm or as standalone IIFE bundle
Custom instrumentsβ
Create your own with just a few methods β perfect for games, samplers, or experimental sounds.
π΅ Example Capabilitiesβ
Notationβ
- Notes, chords, rests
- Tuplets of any type
- Beams (automatic based on time signature)
- Key & time signatures
- Tempo markings
- Tabs with string selection
- Labels/chord symbols
- Lyrics with alignment & hyphens
- Annotations (dynamics, tempo, etc.)
- Navigation: repeats, endings, segno/coda, Fine
Renderingβ
- Canvas-based rendering
- Automatic layout
- Staff grouping
- Extension lines
Playbackβ
- Play/pause/stop
- Combined play/stop modes
- Controlled through JS or React
π§° Developer-Friendlyβ
- Strongly typed TypeScript API
- Modular imports to reduce bundle size
- Works in plain JS, TS, React, and browser-only environments
- Designed to avoid unnecessary abstractionsβsimple, predictable calls