Scribbletune | scale


A scale is a set of musical notes ordered by pitch. Scribbletune uses tonal to expose scales (or modes).

The scale method takes a string input that denotes the key and the scale you want.

const scribble = require('scribbletune');

// Get the C major scale
let cMajor = scribble.scale('c4 major'); // [ 'c4', 'd4', 'e4' ... ]

// That's the same as
cMajor = scribble.scale('c4 ionian'); // [ 'c4', 'd4', 'e4', 'f4' ...]

// Create a clip that plays this C major scale
const clip = scribble.clip({
  notes: cMajor,
  pattern: 'xxxxxxx'

// Export this clip as a MIDI file
scribble.midi(clip, 'c-major.mid');

This will generate a MIDI file at the same location as you run this script. This is how it sounded when I imported the generated c-major.mid MIDI file into Garage Band

Scales are also exposed as modes.

let cMinor = scribble.mode('c4 aeolian'); // [ 'c4', 'd4', 'd#4', 'f4' ...]

You can list all the available scales by invoking scales or modes method.

const allScales = scribble.scales(); // returns an array of all the available scales from tonal