Skip to main content

A module for music theory concepts including tone intervals, notes, scales and chords.

Project description

IDMTheory

IDMTheory is a python module with functions and data to support building of music theory applications.

The Current State of IDMTheory

IDMTheory is currently in beta version.

What's IDMTheory?

Notes and Intervals

In IDMTheory, notes are represented by an integer type. Note value 0 corresponds to the C note in the first octave. Each positive integer step from 0 represents a semitone step in the chromatic scale.

Note names can use the note name style 'flat' or 'sharp'. Flat notation uses the 'b' character to indicate a flattened note (e.g. 'Gb') while sharp notation uses the '#' character to indicate a shapened note (e.g. 'F#').

IDMTheory note values

The following note intervals are defined:

  • IDToneInterval.TONIC = 0
  • IDToneInterval.SEMI_TONE = 1
  • IDToneInterval.TONE = 2 * SEMI_TONE
  • IDToneInterval.MINOR_2ND = 1 * SEMI_TONE
  • IDToneInterval.MAJOR_2ND = 2 * SEMI_TONE
  • IDToneInterval.MINOR_3RD = 3 * SEMI_TONE
  • IDToneInterval.MAJOR_3RD = 4 * SEMI_TONE
  • IDToneInterval.PERFECT_4TH = 5 * SEMI_TONE
  • IDToneInterval.DIMINISHED_5TH = 6 * SEMI_TONE
  • IDToneInterval.AUGMENTED_4TH = 6 * SEMI_TONE
  • IDToneInterval.TRITONE = 6 * SEMI_TONE
  • IDToneInterval.PERFERCT_5TH = 7 * SEMI_TONE
  • IDToneInterval.AUGMENTED_5TH = 8 * SEMI_TONE
  • IDToneInterval.MINOR_6TH = 8 * SEMI_TONE
  • IDToneInterval.MAJOR_6TH = 9 * SEMI_TONE
  • IDToneInterval.MINOR_7TH = 10 * SEMI_TONE
  • IDToneInterval.MAJOR_7TH = 11 * SEMI_TONE
  • IDToneInterval.PERFECT_OCTAVE = 12 * SEMI_TONE
  • IDToneInterval.MINOR_9TH = 13 * SEMI_TONE
  • IDToneInterval.MAJOR_9TH = 14 * SEMI_TONE
  • IDToneInterval.PERFECT_11TH = 17 * SEMI_TONE
  • IDToneInterval.MAJOR_13TH = 21 * SEMI_TONE
  • IDToneInterval.OCTAVE = PERFECT_OCTAVE

A set of functions and range transforms can be used to manipulate notes, for example:

  • tone_interval_short_name
  • normalize_tone_intervals
  • transpose_tone_intervals

Chords

The class IDChord represents a chord. A chord is defined by:

  • Its tonic note.
  • Its IDChordType: MAJOR, MINOR, DIMINISHED or AUGMENTED.
  • A set of chord modifiers (aka flags), for example 'Dominant 7' or 'Major 7'.

The following chord modifiers are available:

  • IDChordFlags.DOMINANT_7
  • IDChordFlags.MAJOR_7
  • IDChordFlags.DOMINANT_9
  • IDChordFlags.DOMINANT_11
  • IDChordFlags.DOMINANT_13
  • IDChordFlags.ADD_2
  • IDChordFlags.ADD_6
  • IDChordFlags.ADD_9
  • IDChordFlags.FLAT_5TH
  • IDChordFlags.SUSPENDED_2ND
  • IDChordFlags.SUSPENDED_4TH

Chord modifiers can be combined, e.g. IDChordFlags.DOMINANT_7 | IDChordFlags.ADD_9 gives a 7+9 chord.

The class IDChordDatabase can be used to create a database with thousands of different chords. The database can be used to find which chord(s) a certain intervals of notes represent, or chords that a similar to each other.

Scales

The class IDScale can be used to define a specific note scale. Available scales are:

  • Diatonic scales:
    • Natural Major
    • Dorian
    • Phrygian
    • Lydian
    • Mixolydian
    • Natural Minor
    • Locrian
  • Harmonic scales:
    • Harmonic Minor
    • Locrian Natural 6
    • Major Augmented
    • Ukrainian Dorian
    • Phrygian Dominant
    • Lydian Natural 2
    • Super Locrian bb7
  • Melodic scales:
    • Melodic Minor
    • Dorian b6
    • Lydian Augmented
    • Lydian Dominant
    • Mixolydian b6
    • Locrian #2
    • Super Locrian

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

idmtheory-0.3.0.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

idmtheory-0.3.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file idmtheory-0.3.0.tar.gz.

File metadata

  • Download URL: idmtheory-0.3.0.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for idmtheory-0.3.0.tar.gz
Algorithm Hash digest
SHA256 dcfbec0477cb9be6e3ae8615cb44f7a70c50c062d9d747ff8d5192b5d336a32c
MD5 edff8890fb9a3b7ca9b9bb07d96df044
BLAKE2b-256 237abe53badd28156be16a82afcc99e074973c4258aa0f5e76685c23186f9c50

See more details on using hashes here.

File details

Details for the file idmtheory-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: idmtheory-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for idmtheory-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f54c2c93f5abef5685c451f7915d936ee977d013bad6e074641174e1c71264b4
MD5 f9dd24c47ce1d0e0aba68803e52f5ad6
BLAKE2b-256 9afa0c1e951f2f56cb65276cb718bd8116b4c74a960f9ab653a005c6b57728a7

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