Introduction
What is Musique.js?
Musique.js is a JavaScript library that allows you to create music in the browser. It is based on the Web Audio API.
Here is a minimal example of how to use Musique.js:
import { Partition, Note } from 'musiquejs';
const partition = new Partition(
[
new Note('D', 4, 0.18),
new Note('D', 4, 0.18),
new Note('D', 5, 0.36),
new Note('A', 4, 0.54),
],
'sine',
new AudioContext()
);
partition.play();
The above code will play the first few notes of the song Megalovania.
Why Musique.js?
Musique.js is a wrapper around the Web Audio API. It is designed to make it easier to create music in the browser. It is also designed to be easy to use and easy to learn.
How to use Musique.js?
Musique.js is a JavaScript library. It can be used in any JavaScript project. It can also be used in any JavaScript framework, such as React, Vue, Angular, etc.