Scales
scale(tonic, key)
Generate a scale from a tonic note (PT-BR=Nota tônica) and a key (PT-BR=tonalidade).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tonic |
str
|
The note that will be the tonic of the scale. |
required |
key |
str
|
Scale key (PT-BR=tonalidade). |
required |
Returns:
| Type | Description |
|---|---|
dict[str, list[str]]
|
A dictionary with the scale "notes" and "degrees" (PT-BR=graus). Inside of the dictionary, the "degrees" (PT-BR=graus) is a string (str) and a value is a list of strings. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When passing a non-existent note. |
KeyError
|
When key (PT-BR=tonalidade) does not exist or not does implemented. |
Examples:
>>> scale('C', 'major')
{'notes': ['C', 'D', 'E', 'F', 'G', 'A', 'B'], 'degrees': ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII']}
>>> scale('a', 'major')
{'notes': ['A', 'B', 'C#', 'D', 'E', 'F#', 'G#'], 'degrees': ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII']}
Source code in musical_notes/scales.py
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |