A harmony-based music composition toolkit with MIDI I/O

music, song, midi, harmony, harmonies, harmonic, compose, composing, composition, scale, scales, chord, chords, progression, progressions, rhythm, rhtyhms, multitrack, multi-track, microtonal
npm install chorus@0.6.4


Chorus.js: Music Composition in JavaScript

npm version    build status    test coverage


  • Compose music with code via multi-track MIDI
    • output real-time MIDI to control synthesizers, samplers, and other MIDI instruments
    • output MIDI files to save your musical ideas with perfect timing
  • Explore harmony using scales and chord progressions
  • Explore microtonal tunings


  • Node.js v6+ (browser support is planned)
  • Optional: compilation tools for native dependencies
    • If you want real-time MIDI output, follow node-gyp's installation instructions to setup compilation tools
    • Otherwise, ignore non-fatal errors during install. You can still use MIDI file output

Quick Start Guide

  1. Install

     npm install chorus
  2. Create the file quick-start.js

// quick-start.js 
const { Song, Output } = require('chorus');

const song = new Song({
  sections: [{
    parts: [{
      pitches: [C4, D4, E4, F4, G4, F4, E4, D4, C4],

Output.select().then(output => output.play(song));
  1. Output a MIDI file
  • Run:

      node quick-start.js -f quick-start.mid
  • Open quick-start.mid in any app that supports MIDI files

  1. Output real-time MIDI (requires native dependencies)
  • On macOS

    • Download SimpleSynth and launch it

    • Select MIDI Source: SimpleSynth virtual input in SimpleSynth

    • Run:

        node quick-start.js -p simplesynth
  • On Windows

    Use the built-in wavetable synth:

     node quick-start.js -p wavetable  


Work in progress!

  1. Intro / Setup - The basics of chorus.js and how to setup with a DAW
  2. Pitch - how to organize pitch
  3. Rhythm - how to organize time
  4. Pitch & Harmony - chords
  5. Song Structure - how to organize song structure
  6. Advanced Features - how to avoid repetition and create variety
  7. Microtonality - how to use more than 12 pitches per octave

Project Info