MUSIQ.js Primer

Musiq.js is a pure Javascript Library that helps you to understand music theory by representing the most common elements as easy to use javascript functions and objects. Take a note for example. To represent the middle C on the keyboard, we can write:

var middle_c = note("C4");
// we have just created a Note object, 
// representing the middle C

The 4 is the octave of the note, in this case this is the middle C.

Now, we can do all kinds of things with this note. Want to know what the fifth of the middle C is?

var c_with_fifth = middle_c.transpose("fifth");
// c_with_fifth is now equal to the fifth of C
// so, what is it called?
console.log( c_with_fifth );
// returns "G4"

There are only so many things you can do with a single note. Take a look at the API Documentation for a list of all the methods available.

When we play multiple notes together, they can form a chord. There are many types of chords each with their own sound and function. Let's say we want to create a G chord.

var g_chord = chord("G");
// what notes are in this chord?
console.log( g_chord )
// returns G B D

Before we dive any deeper into this nifty little library, let's set up our environment first so we can experiment.


MUSIQ.js is hosted on GitHub and can be easily included in your project. In the root folder of the GitHub project you will find a file called


Download this file and put it in your web project folder. In your html files, include it like so: