Harmonics
convert_degrees(tonic_note, degree)
Converts a musical degree to its corresponding notation based on the given tonic note.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tonic_note |
str
|
The tonic note of the chord (e.g., "C", "Cm", "Cdim"). |
required |
degree |
str
|
The degree of the scale (e.g., "I", "II", "III"). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
The converted degree. |
Examples:
>>> convert_degrees('C', 'I')
'I'
>>> convert_degrees('Cm', 'I')
'i'
>>> convert_degrees('Cdim', 'I')
'i°'
Source code in melodica_notes/harmonics.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
harmonic(tonic_note, scale_type)
Generates a harmonic progression based on a note and a scale.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tonic_note |
str
|
The root note of the harmonic progression. |
required |
scale_type |
str
|
The scale, e.g., major, minor, etc. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, list[str]]
|
A harmonic progression containing chords and their corresponding degrees. |
Examples:
>>> harmonic("C", "major")
{'chords': ['C', 'Dm', 'Em', 'F', 'G', 'Am', 'Bdim'], 'degrees': ['I', 'ii', 'iii', 'IV', 'V', 'vi', 'vii°']}
>>> harmonic("C", "minor")
{'chords': ['Cm', 'Ddim', 'D#', 'Fm', 'Gm', 'G#', 'A#'], 'degrees': ['i', 'ii°', 'III', 'iv', 'v', 'VI', 'VII']}
Source code in melodica_notes/harmonics.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
triad_scale(key, scale_key)
Determine whether the triad of a note is within the scale.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key |
str
|
The tonic note or root note of the scale for which you want to determine the triad type. |
required |
scale_key |
list
|
A list of notes representing a specific musical scale. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
The tonic note of the triad based on the key and scale notes provided. |
Examples:
>>> triad_scale('C', ['C', 'D', 'E', 'F', 'G', 'A', 'B'])
'C'
>>> triad_scale('D', ['C', 'D', 'E', 'F', 'G', 'A', 'B'])
'Dm'
>>> triad_scale('B', ['C', 'D', 'E', 'F', 'G', 'A', 'B'])
'Bdim'
Source code in melodica_notes/harmonics.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |