Musical Scales
Retrieve a scale based on a given mode and starting note. Information about these scales can be found on Wikipedia.
Currently supported scales:
- acoustic
- aeolian
- algerian
- super locrian
- augmented
- bebop dominant
- blues
- chromatic
- dorian
- double harmonic
- enigmatic
- flamenco
- romani
- half-diminished
- harmonic major
- harmonic minor
- hijaroshi
- hungarian minor
- hungarian major
- in
- insen
- ionian
- iwato
- locrian
- lydian augmented
- lydian
- locrian major
- pentatonic major
- melodic minor ascending
- melodic minor descending
- pentatonic minor
- mixolydian
- neapolitan major
- neapolitan minor
- octatonic c-d
- octatonic c-c#
- persian
- phrygian dominant
- phrygian
- prometheus
- harmonics
- tritone
- two-semitone tritone
- ukranian dorian
- whole-tone scale
- yo
Dependencies
This is Version 2 of the package, which requires Python 3.10 or later (released in 2021). Version 1 supported Python 3.8, and can still be found on PyPI.
The Note class
Notes can be specified with either a name or a given number of semitones above middle C (C3). Octaves are done MIDI-style, so B2 is immediately followed by C3.
Example notes:
Note("D")the first D above middle CNote(2)two semitones above middle C, which is the same asNote("D").
Notes have properties inferred from their interval from C.
.namee.g. "D#" (favours sharps).enharmonice.g. "Eb" (favours flats).octavee.g. 3.midie.g. "F#4" (MIDI representation)
Examples
import musical_scales
# Notes
# Middle C. If no octave name is provided then defaults to octave 3.
C3 = musical_scales.Note("C")
musical_scales.Note("C3")
# Or specify by interval above/below Middle C
C3 = musical_scales.Note(0)
C4 = musical_scales.Note(12)
D_sharp = musical_scales.Note(3)
# You can add / subtract integers from notes to shift them
assert C3 = D_sharp - 3
# Scales
# Defaults to a major scale
musical_scales.scale("D")
# [D3, E3, F#3, G3, A3, B3, C#4, D4]
# Or specify a name from musical_scales.scale_intervals.keys()
musical_scales.scale("F#", "blues")
# [F#3, A3, B3, C4, C#4, E4, F#4]
# Specify a starting octave for the note (defaults to 3)
musical_scales.scale("D5")
# [D5, E5, F#5, G5, A5, B5, C#6, D6]
# Specify how many octaves to output (keyword required)
musical_scales.scale("F#", "blues", octaves=2)
# [F#3, A3, B3, C4, C#4, E4, F#4, A4, B4, C5, C#5, E5, F#5]
Documentation
Detailed documentation can be found at readthedocs.io as well as in the docstrings of the python files themselves.
Licensing
The source code is available under the MIT licence and can be found on Hector Miller-Bakewell's github.
Acknowledgements
This package was created as part of the QuTune Project.
Metadata
Release files for musical-scales 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| musical_scales-2.0.0.tar.gz | 6.5 kB | Without provenance | Details for musical_scales-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| musical_scales-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for musical_scales-2.0.0-py3-none-any.whl |
Total release size: 12.2 kB
Release files / musical_scales-2.0.0.tar.gz
| Download URL | musical_scales-2.0.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e94996263d82c972c91e186e32a4f2cd4bb7321e6dfb6048cbec36f201b8ed89
|
|
BLAKE2b-256 checksum How to use checksums |
2de5aeaf719c13047190e8e03d4990564290723e2db3398d748ed919481b6468
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / musical_scales-2.0.0-py3-none-any.whl
| Download URL | musical_scales-2.0.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b41f3cf49836b27e4fce33038454c15234e27b89735f1d4b567e14d7a77cc251
|
|
BLAKE2b-256 checksum How to use checksums |
7fd1461d1868bb66918fbae3a5fee8f366d82a29cc070a15febf4b66b9da4214
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for musical-scales 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.