All Projects → LibreScore → webmscore

LibreScore / webmscore

Licence: Unknown, Unknown licenses found Licenses found Unknown LICENSE.GPL Unknown LICENSE.rtf
MuseScore's core library (libmscore) in WebAssembly! Read mscz data, and generate audio/MIDI/MusicXML/SVG/PNG/PDF sheets right in browsers.

Projects that are alternatives of or similar to webmscore

gm
R Package for Music Score and Audio Generation
Stars: ✭ 116 (+27.47%)
Mutual labels:  musicxml, sheet-music, musescore
Musescore
MuseScore is an open source and free music notation software. For support, contribution, bug reports, visit MuseScore.org. Fork and make pull requests!
Stars: ✭ 6,546 (+7093.41%)
Mutual labels:  musicxml, sheet-music, musescore
Eternal
👾~ music, eternal ~ 👾
Stars: ✭ 323 (+254.95%)
Mutual labels:  midi, webaudio
Scribbletune
Create music with JavaScript
Stars: ✭ 3,509 (+3756.04%)
Mutual labels:  midi, webaudio
Fsynth
Web-based and pixels-based collaborative synthesizer
Stars: ✭ 146 (+60.44%)
Mutual labels:  midi, webaudio
embed-client
🎼 Sheet Music & Tabs Embed JavaScript Client
Stars: ✭ 43 (-52.75%)
Mutual labels:  musicxml, sheet-music
PicoAudio.js
A JavaScript library for playing MIDI (Standard MIDI File) on Web.
Stars: ✭ 28 (-69.23%)
Mutual labels:  midi, webaudio
Awesome Webaudio
A curated list of awesome WebAudio packages and resources.
Stars: ✭ 685 (+652.75%)
Mutual labels:  midi, webaudio
midica
A Music programming language. Translates source code into MIDI. Includes a player. Supports MIDI-Karaoke. Includes a MIDI analyzer.
Stars: ✭ 57 (-37.36%)
Mutual labels:  midi, musescore
webaudio-synth
WebAudio Polyphonic Synthesizer
Stars: ✭ 83 (-8.79%)
Mutual labels:  midi, webaudio
Shape-Your-Music
A web application for drawing music.
Stars: ✭ 106 (+16.48%)
Mutual labels:  midi, webaudio
Jzz
MIDI library for Node.js and web-browsers
Stars: ✭ 325 (+257.14%)
Mutual labels:  midi, webaudio
python-blobopera
Toolkit to convert MusicXML files into Blob Opera scores with real lyrics.
Stars: ✭ 24 (-73.63%)
Mutual labels:  musicxml, musescore
Signal
A friendly music sequencer built with web technology
Stars: ✭ 166 (+82.42%)
Mutual labels:  midi, webaudio
jamhub
low-latency jamming space for musicians
Stars: ✭ 29 (-68.13%)
Mutual labels:  midi, webaudio
midi
An Observable based library for the use of Web MIDI API with Angular
Stars: ✭ 35 (-61.54%)
Mutual labels:  midi, webaudio
arm synth
Wavetable Synth Running on an STM32F 32-bit ARM Cortex M3 microprocessor
Stars: ✭ 23 (-74.73%)
Mutual labels:  midi
ScalaMIDI
A library for accessing standard MIDI files
Stars: ✭ 14 (-84.62%)
Mutual labels:  midi
websynth
Web Synthesizer From Space
Stars: ✭ 16 (-82.42%)
Mutual labels:  webaudio
kikpad
KiKPad : the Midiplus SmartPad reinvented !
Stars: ✭ 31 (-65.93%)
Mutual labels:  midi

webmscore

MuseScore's libmscore (the core library) in WebAssembly!

Features

  • Parse mscz file data
  • Get score metadata
  • Export part score
  • Generate music sheets in SVG/PNG/PDF format
  • Generate MIDI
  • Generate audio files in WAV, OGG, MP3, or FLAC format
  • Synthesize raw audio frames, can be used in the Web Audio API
  • Export as MusicXML compressed/uncompressed
  • Generate position information of measures or segments on the generated sheets
  • Run inside a Web Worker thread

Installation

The package is available on npm: https://www.npmjs.com/package/webmscore

npm i webmscore

Use webmscore

Load in browsers

<!-- using a CDN -->
<script src="https://cdn.jsdelivr.net/npm/webmscore/webmscore.js"></script>
<script>
    WebMscore.ready.then(async () => {
        const score = await WebMscore.load('mscz', msczdata)
    })
</script>

For latest browsers which support ES Modules

import WebMscore from 'https://cdn.jsdelivr.net/npm/webmscore/webmscore.mjs'

Run in Node.js directly

Minimum version: v8.9.0 with ES Modules support

The --experimental-modules flag is required for Node.js versions under 14,
Also require "type": "module" in package.json

import WebMscore from 'webmscore'
WebMscore.ready.then(async () => {
    const score = await WebMscore.load('mscz', msczdata)
})

Use a JavaScript bundler

(TBD)

Load extra fonts

If your score sheet contains characters out of the range of the bundled FreeFont, those characters will be shown as tofu characters ( or ) in SVG/PNG/PDF files. Loading extra fonts is required.

webmscore can load any font format supported by FreeType.

const score = await WebMscore.load('mscz', msczdata, [...arrOfFontData])

CJK fonts are no longer bundled inside webmscore since v0.6.0

Load soundfont files

Loading a soudfont (sf2/sf3) file is required before generating/synthesizing audio.

await score.setSoundFont(soudfontData)

Soudfonts can be found on musescore.org website.

Example: (FluidR3Mono_GM.sf3)

const soudfontData = new Uint8Array(
    await (
        await fetch('https://cdn.jsdelivr.net/gh/musescore/[email protected]/share/sound/FluidR3Mono_GM.sf3')
    ).arrayBuffer()
)

Boost Mode

Sometimes you only want to process a bunch of score metadata, so drawing sheet images internally is a waste of time and system resource.

You can enable the Boost Mode by setting the doLayout parameter in WebMscore.load to false.

Example:

const score = await WebMscore.load('mscz', msczdata, [], false)
const metadata = await score.metadata()
score.destroy()

webmscore's Boost Mode is about 3x faster than the batch converter feature (-j) of the musescore software, according to the benchmark result.

WebAssembly vs native C++ program!

Compiling

  1. Install essential tools like make, cmake, llvm, etc.

  2. Install emscripten v2.0.6 using emsdk https://emscripten.org/docs/getting_started/downloads.html

  3. Get and compile Qt5 for WebAssembly

CPUS=$(getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || 8)

QT_PATH=/usr/qt515
# If you want to use other directory, make sure you changed `PREFIX_PATH` to your Qt5WASM installation dir in the Makefile

git clone git://code.qt.io/qt/qt5.git --depth=1 -b 5.15.0 $QT_PATH
# or
# download and extract qt-everywhere 5.15.0 (https://download.qt.io/official_releases/qt/5.15/5.15.0/single/)

cd $QT_PATH
./configure -xplatform wasm-emscripten -nomake examples -prefix $PWD/qtbase
make -j$CPUS

# exclude unused Qt5Gui plugins
sed -i -E "s/\s(\S+?Qt5Gui_)\*(Plugin)?(.*)\)/ \1QWasmIntegrationPlugin\3 \1QJpegPlugin\3)/" $QT_PATH/qtbase/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake

# patch emcc.py to emit separate .mem files regardless of MEM_INIT_METHOD settings (MEM_INIT_METHOD won't work with wasm)
sed -i -r "s/(shared.Settings.MEM_INIT_IN_WASM = )True/\1False/" "$(which emcc).py"
  1. Checkout submodules
git submodule init
git submodule update
  1. Compile webmscore
make release

Build artifacts are in the web-public directory

Browser Support

All modern browsers which support WebAssembly and Async Functions

Name Minimum Version
Chrome 57
Firefox 53, 52 (non-ESR)
Edge 16 (Fall Creators Update)
Safari 11
IE NO!
Other browsers I don't know!

Only tested on the latest version of Chrome and Firefox.

Examples

see files in the web-example directory

cd ./web-example
npm i
npm start  # Node.js example
npm run start:browser  # browser example

Debugging

See How to look up function names in the .symbols file?


webmscore is part of the LibreScore project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].