Home

Chorus.js: Music Composition in JavaScript

npm version    build status    test coverage

Features

  • 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

Requirements

  • 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');
    require('chorus/names').into(global);
    
    const song = new Song({
     sections: [{
       parts: [{
         pitches: [C4, D4, E4, F4, G4, F4, E4, D4, C4],
       }]
     }]
    });
    
    Output.select().then(output => output.play(song));
  3. Output a MIDI file

    • Run:

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

  4. Output real-time MIDI (requires native depedencies)

    • 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  

Tutorials

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