pcset library

npm version tonal

tonal-pcset is a collection of functions to work with pitch class sets, oriented to make comparations (isEqual, isSubset, isSuperset)

This is part of tonal music theory library.

You can install via npm: npm i --save tonal-pcset

// es6
import PcSet from "tonal-pcset"
var PcSet = require("tonal-pcset")

PcSet.isEqual("c2 d5 e6", "c6 e3 d1") // => true

API documentation



all ↔ dynamic
read / write
chr → dynamic Function(dynamic str)
clen int Function(String chroma)
IVLS List<String>
read / write
pcsetNum int Function(dynamic set)
read / write


chroma(dynamic set) String
Get chroma of a pitch class set. A chroma identifies each set uniquely. It"s a 12-digit binary each presenting one semitone of the octave.
chromas([dynamic n]) → dynamic
Get a list of all possible chromas (all possible scales) More information: http://allthescales.org/
filter(dynamic set, dynamic notes) → dynamic
Filter a list with a pitch class set
includes(dynamic set, [dynamic note]) → dynamic
Test if a given pitch class set includes a note
intervals(String set) → dynamic
Given a pcset (notes or chroma) return it"s intervals
isChroma(dynamic set) → dynamic
Test if the given string is a pitch class set chroma.
isEqual(dynamic s1, dynamic s2) → dynamic
Test if two pitch class sets are identical
isSubsetOf(dynamic set, [dynamic notes]) → dynamic
Create a function that test if a collection of notes is a subset of a given set
isSupersetOf(dynamic set, [dynamic notes]) → dynamic
Create a function that test if a collectio of notes is a superset of a given set (it contains all notes and at least one more)
modes(dynamic set, [dynamic normalize]) → dynamic
Given a a list of notes or a pcset chroma, produce the rotations of the chroma discarding the ones that starts with "0"