Universal Music Theory
A TypeScript library for music theory: harmony analysis, scales and modes, any tuning, rhythm, world music, set theory and notation export. One bundle, no dependencies. Everything on this page runs on it.
- 48modules
- 1362tests
- 152kb bundle
- 0dependencies
Progression analysis new
Roman numerals, functions, secondary dominants, borrowed chords, cadences and modulations. Type chord symbols or numerals.
Harmony.analyzeProgression · parseRomanProgression · formatChordSymbol
Identify notes new
Click keys or type notes. UMT names the chord with a score for each reading, describes the voicing, and lists the scales that hold the notes.
Harmony.detectChordsScored · analyzeVoicing · findScalesForNotes
Chord
One chord in every spelling style, its names, the scales that fit it and its substitutes in a key.
parseChordSymbol · formatChordSymbol · chordLongName · Harmony.getSuggestedScales · getSubstitutions · Harmony.getNegativeHarmony
Key explorer new
The chords of a key, what it can borrow from its parallel modes, its negative harmony, and the pivot chords to another key.
Scale.getDiatonicChords · Harmony.getBorrowedChords · Harmony.getNegativeHarmony · Harmony.findPivotChords · Harmony.getColtraneAxis
Key detection new
Correlates the notes of a melody, weighted by duration, with five key profiles. Write note:beats; the duration is optional.
KeyDetection.detect · KEY_PROFILES
Scales and modes
Notes, diatonic chords, brightness and parent scale. Over 80 scale patterns: try E phrygian dominant, C hirajoshi or D lydian augmented.
parseScaleSymbol · getDiatonicChords · getModalCharacteristics · getParentScale
Tunings
The same scale in equal temperament, 5-limit just intonation and Werckmeister III: how far each note moves, in cents.
EDO · JustIntonation · CentTuning · parseScaleSymbol(symbol, tuning)
Patterns
Euclidean rhythms spread k onsets as evenly as possible over n steps; many traditional patterns are one of them.
Polyrhythm.euclidean · CLAVE_PATTERNS · RhythmAnalysis.detectSyncopation
Rhythmic cycles new
Hindustani and Carnatic talas, flamenco compás and Balkan aksak meters, with the stroke of every pulse: a metronome that counts like the tradition does.
RHYTHMIC_CYCLES · cycleStrokes · cycleCounts · cycleTimeSignature
Ragas and maqamat
RAGAS · SVARA_NAMES · MAQAMAT (24-EDO)
Set theory and twelve-tone rows
Click the clock to build a set. C = 0.
SetTheory.normalForm · primeForm · getForteNumber · intervalVector · getZRelated · ToneRow
Notation export
ABC, LilyPond and MusicXML from the same source: key signatures, accidentals within the measure, ties across barlines and rests. A melody is written note:beats, with r for a rest.
MusicStream · ABCBridge.streamToABC · streamToLilyPond · streamToMusicXML · scaleToABC · chordToABC