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.1.0.tar.gz (15.3 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.1.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for idmtheory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 860f4aa97c8beb5c511205c7029c17d29470c2699d492a70a72c02a1dcd3d8d4
MD5 c2aaad1894a0a774bbb6e1ef4bbb9bb9
BLAKE2b-256 7470809cfbd331c2101066f841e5e0652b96c7565eeccc6b40b6a2c3989963d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: idmtheory-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.3 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9d0b5e556f385690b71cf78376667a9fb21f5fd9ccfac01b525e986ab245a6b
MD5 ff825fab3dcafcb22b993976852f49b1
BLAKE2b-256 7f0216e384218b6e9853466e45a65289232d760b5ed6c2dd1c24193372950a3d

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