verovio 3.8.1 → 3.11.0
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 +48 -16
- package/dist/verovio-module-hum.js +21 -0
- package/dist/verovio-module.js +21 -0
- package/dist/verovio-toolkit-wasm.js +367 -0
- package/dist/verovio.cjs +337 -0
- package/dist/verovio.mjs +333 -0
- package/package.json +26 -6
- package/index.js +0 -344
package/README.md
CHANGED
|
@@ -4,34 +4,66 @@ 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
|
-
|
|
7
|
+
|
|
8
|
+
## Basic usage
|
|
8
9
|
|
|
9
10
|
```javascript
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const verovio = require('verovio');
|
|
12
|
+
const fs = require('fs');
|
|
12
13
|
|
|
13
14
|
/* Wait for verovio to load */
|
|
14
15
|
verovio.module.onRuntimeInitialized = function ()
|
|
15
16
|
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
mei = fs.readFileSync(
|
|
20
|
-
|
|
17
|
+
// create the toolkit instance
|
|
18
|
+
const vrvToolkit = new verovio.toolkit();
|
|
19
|
+
// read the MEI file
|
|
20
|
+
mei = fs.readFileSync('hello.mei');
|
|
21
|
+
// load the MEI data as string into the toolkit
|
|
21
22
|
vrvToolkit.loadData(mei.toString());
|
|
22
|
-
|
|
23
|
+
// render the fist page as SVG
|
|
23
24
|
svg = vrvToolkit.renderToSVG(1, {});
|
|
24
|
-
|
|
25
|
-
fs.writeFileSync(
|
|
25
|
+
// save the SVG into a file
|
|
26
|
+
fs.writeFileSync('hello.svg', svg);
|
|
26
27
|
}
|
|
27
28
|
```
|
|
28
29
|
|
|
29
|
-
### Memory allocation
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
## Usage with ESM
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
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`.
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
import createVerovioModule from 'verovio/wasm';
|
|
37
|
+
import { VerovioToolkit } from 'verovio/esm';
|
|
38
|
+
import fs from 'node:fs';
|
|
39
|
+
|
|
40
|
+
createVerovioModule().then(VerovioModule => {
|
|
41
|
+
const verovioToolkit = new VerovioToolkit(VerovioModule);
|
|
42
|
+
const score = fs.readFileSync('hello.mei').toString();
|
|
43
|
+
verovioToolkit.loadData(score);
|
|
44
|
+
const data = verovioToolkit.renderToSVG(1, {});
|
|
45
|
+
console.log(data);
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
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
|
+
|
|
51
|
+
|
|
52
|
+
## Usage with CommonJS
|
|
53
|
+
|
|
54
|
+
Alternatively this package also exports a version compatible with CommonJS
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
const createVerovioModule = require('verovio/wasm');
|
|
58
|
+
const { VerovioToolkit } = require('verovio/esm');
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# Humdrum support
|
|
63
|
+
|
|
64
|
+
Since version 3.11.0 the npm package provides an additional module with Humdrum support:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import createVerovioModule from 'verovio/wasm-hum';
|
|
35
68
|
```
|
|
36
69
|
|
|
37
|
-
The value has to be less than 1024MB.
|