Skip to main content

Import

Web Music Score library contains following subpath modules:

  • core - a few core feaures
  • audio - audio interface
  • pieces - demo songs
  • theory - music theory enums, classes, functions, etc.
  • score - main score module (mostly used)
  • react-ui - React components

Import

// Import subpath modules
import * as Core from "web-music-score/core";
import * as Audio from "web-music-score/audio";
import * as Pieces from "web-music-score/pieces";
import * as Theory from "web-music-score/theory";
import * as Score from "web-music-score/score";
import * as ReactUI from "web-music-score/react-ui";

// You can alsoimport named exports, e.g.
import { DocumentBuilder } from "web-music-score/score";

Require

// You can also require subpath modules, e.g.
const Score = require("web-music-score/score");

HTML Script

IIFE bundles are available via unpkg and jsDelivr CDNs to use directly in HTML document. Modules can be accessed using window.WebMusicScore global name.

<!-- Use either one -->
<script src="https://unpkg.com/web-music-score@6.0.0-pre.3/dist/iife/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/web-music-score@6.0.0-pre.3/dist/iife/index.js"></script>

<script>
// Get library modules
const { Core, Audio, Pieces, Theory, Score } = window.WebMusicScore;
</script>

💡 ReactUI is not available in IIFE bundle.