Skip to main content

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.

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)

Source distribution for musical-scales 2.0.0
File Size Uploaded
musical_scales-2.0.0.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for musical-scales 2.0.0
File Interpreter ABI Platform
musical_scales-2.0.0-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.1

1 release file

1.0

1 release file

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page