MusicTheory Docs API Toolbox GitHub NuGet
Contents

API / MusicTheory

ModulationDetector static class

Splits a chord sequence into key regions by voting over sliding KeyDetector windows.

Methods

static IReadOnlyList<KeyRegion> Detect(IReadOnlyList<ChordSymbol> chords, int window = 4)
Finds the key regions of a chord sequence. Each chord takes the most frequent best key among the windows covering it (a tie goes to the latest window), regions shorter than three chords are absorbed into a neighbour, and the pivot is looked for in the two chords before each boundary.
chords
The chords, in order.
window
Chords per window, at least 2.

Returns Contiguous regions covering every chord; empty for an empty input.

Throws ArgumentNullException chords is null.

Throws ArgumentOutOfRangeException window is below 2.