Retrieve a scale based on a given mode and starting note.
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file musical_scales-2.0.0.tar.gz.
File metadata
- Download URL: musical_scales-2.0.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e94996263d82c972c91e186e32a4f2cd4bb7321e6dfb6048cbec36f201b8ed89
|
|
| MD5 |
228c2cd896d6e896dda0d9eac3e3f8c3
|
|
| BLAKE2b-256 |
2de5aeaf719c13047190e8e03d4990564290723e2db3398d748ed919481b6468
|
File details
Details for the file musical_scales-2.0.0-py3-none-any.whl.
File metadata
- Download URL: musical_scales-2.0.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b41f3cf49836b27e4fce33038454c15234e27b89735f1d4b567e14d7a77cc251
|
|
| MD5 |
7977cb69aef6c71c3ef379250485c047
|
|
| BLAKE2b-256 |
7fd1461d1868bb66918fbae3a5fee8f366d82a29cc070a15febf4b66b9da4214
|