verovio 3.11.0 → 3.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,10 +4,9 @@ Verovio is a fast, portable and lightweight library for engraving [Music Encodin
|
|
|
4
4
|
|
|
5
5
|
See it running in the [MEI Viewer](http://www.verovio.org/mei-viewer.xhtml) and check out the [tutorial](http://www.verovio.org/tutorial.xhtml) for its web integration and for enabling user interaction.
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
## Basic usage
|
|
9
8
|
|
|
10
|
-
```
|
|
9
|
+
```js
|
|
11
10
|
const verovio = require('verovio');
|
|
12
11
|
const fs = require('fs');
|
|
13
12
|
|
|
@@ -17,17 +16,16 @@ verovio.module.onRuntimeInitialized = function ()
|
|
|
17
16
|
// create the toolkit instance
|
|
18
17
|
const vrvToolkit = new verovio.toolkit();
|
|
19
18
|
// read the MEI file
|
|
20
|
-
|
|
19
|
+
mei = fs.readFileSync('hello.mei');
|
|
21
20
|
// load the MEI data as string into the toolkit
|
|
22
|
-
|
|
21
|
+
vrvToolkit.loadData(mei.toString());
|
|
23
22
|
// render the fist page as SVG
|
|
24
|
-
|
|
23
|
+
svg = vrvToolkit.renderToSVG(1, {});
|
|
25
24
|
// save the SVG into a file
|
|
26
|
-
|
|
25
|
+
fs.writeFileSync('hello.svg', svg);
|
|
27
26
|
}
|
|
28
27
|
```
|
|
29
28
|
|
|
30
|
-
|
|
31
29
|
## Usage with ESM
|
|
32
30
|
|
|
33
31
|
This package also provides an ESM version which can be used with a modularized build of the Verovio module. Use `.mjs` as file extension when using this directly in Node.js or set `"type": "module"` in your `package.json`.
|
|
@@ -41,14 +39,13 @@ createVerovioModule().then(VerovioModule => {
|
|
|
41
39
|
const verovioToolkit = new VerovioToolkit(VerovioModule);
|
|
42
40
|
const score = fs.readFileSync('hello.mei').toString();
|
|
43
41
|
verovioToolkit.loadData(score);
|
|
44
|
-
const data = verovioToolkit.renderToSVG(1
|
|
42
|
+
const data = verovioToolkit.renderToSVG(1);
|
|
45
43
|
console.log(data);
|
|
46
44
|
});
|
|
47
45
|
```
|
|
48
46
|
|
|
49
47
|
This is the recommended way to use Verovio when creating a website or web app with bundlers like webpack or Vite or when using JavaScript frameworks like React or Vue.js.
|
|
50
48
|
|
|
51
|
-
|
|
52
49
|
## Usage with CommonJS
|
|
53
50
|
|
|
54
51
|
Alternatively this package also exports a version compatible with CommonJS
|
|
@@ -58,8 +55,7 @@ const createVerovioModule = require('verovio/wasm');
|
|
|
58
55
|
const { VerovioToolkit } = require('verovio/esm');
|
|
59
56
|
```
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
# Humdrum support
|
|
58
|
+
## Humdrum support
|
|
63
59
|
|
|
64
60
|
Since version 3.11.0 the npm package provides an additional module with Humdrum support:
|
|
65
61
|
|