Skip to main content

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 C
  • Note(2) two semitones above middle C, which is the same as Note("D").

Notes have properties inferred from their interval from C.

  • .name e.g. "D#" (favours sharps)
  • .enharmonic e.g. "Eb" (favours flats)
  • .octave e.g. 3
  • .midi e.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

musical_scales-2.0.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

musical_scales-2.0.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

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

Hashes for musical_scales-2.0.0.tar.gz
Algorithm Hash digest
SHA256 e94996263d82c972c91e186e32a4f2cd4bb7321e6dfb6048cbec36f201b8ed89
MD5 228c2cd896d6e896dda0d9eac3e3f8c3
BLAKE2b-256 2de5aeaf719c13047190e8e03d4990564290723e2db3398d748ed919481b6468

See more details on using hashes here.

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

Hashes for musical_scales-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b41f3cf49836b27e4fce33038454c15234e27b89735f1d4b567e14d7a77cc251
MD5 7977cb69aef6c71c3ef379250485c047
BLAKE2b-256 7fd1461d1868bb66918fbae3a5fee8f366d82a29cc070a15febf4b66b9da4214

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page