ChordDetect¶
The chord-detection function lives in its own module but is most commonly
accessed via [Chord.detect][tonal_py.chord.detect].
chord_detect ¶
Chord detection — find chord names from a list of notes.
The single public function detect
returns chord names that match the input notes, weighted so root-position
matches outrank inversions. Re-exported as
[Chord.detect][tonal_py.chord.detect].
Example
from tonal_py.chord_detect import detect detect(["C", "E", "G"]) ['CM', 'Em#5/C'] detect(["E", "G", "C"]) ['Em#5', 'CM/E']
Source parity: @tonaljs/chord-detect
detect ¶
Detect chord names that match a list of notes.
The first note is treated as a likely root (root-position weight = 1.0); inversions get half-weight (0.5). Results are sorted descending by weight.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
list[str]
|
Note names. |
required |
options
|
DetectOptions | None
|
Optional dict. |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
Matching chord names. Empty list for empty input. |
Example
from tonal_py import Chord Chord.detect(["C", "E", "G"]) ['CM', 'Em#5/C'] Chord.detect(["D", "F#", "A", "C"]) ['D7'] Chord.detect([]) []