Skip to main content

Simple arithmetic on musical notes

Project description

This module provides representations for musical notes and intervals in the basic 12-note even tempered system that is typically used in western music. It provides basic arithmetic and conversion to and from midi numbers.

Classes, Functions and Definitions

This module provides the following classes:

Note: represents a musical note

Interval: represents the interval between two notes

It also provides the following utility functions:

get_midi_number(note_string) -> midi number

in_chord(note, root, chord) -> boolean

The following intervals are predefined:

P1 = unison = Interval(0)
m2 = semitone = Interval(1)
M2 = Interval(2)
m3 = Interval(3)
M3 = Interval(4)
P4 = Interval(5)
aug4 = dim5 = Interval(6)
P5 = Interval(7)
m6 = Interval(8)
M6 = Interval(9)
m7 = Interval(10)
M7 = Interval(11)
P8 = octave = Interval(12)

The following chord types are predefined:

MAJOR = (unison, M3, P5)
MINOR = (unison, m3, P5)
SEVENTH = (unison, M3, P5, m7)

Examples

Some examples of use:

>>> Note('c') - Note('a-2')
Interval(16)
>>> Note('c') + M3
Note(64)
>>> (Note('c3') + P5).get_note_string()
'G3'
>>> in_chord(Note('c5'), Note('a'), MINOR)
True
>>> in_chord(Note('c5'), Note('a'), MAJOR)
False

Installing

To install pyscales, use pip install pyscales.

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

pyscales-1.0.2.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

pyscales-1.0.2-py2.py3-none-any.whl (5.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pyscales-1.0.2.tar.gz.

File metadata

  • Download URL: pyscales-1.0.2.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyscales-1.0.2.tar.gz
Algorithm Hash digest
SHA256 2b6e73a0773f01caaed23ca18d79dfa6422921d19e02eb1bb72d964c07403b28
MD5 e766c5fc1c0263199027d7d5851691c0
BLAKE2b-256 2ced8311dd0a31fcf781742f99e3b3d86bd831f43eaf3653d262b04a611cd7ce

See more details on using hashes here.

File details

Details for the file pyscales-1.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pyscales-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6ab817793f96ccbbcb72bcdb0e652b1480f8dfecd99eaaf909ec0cd81107a705
MD5 40a050370226a14ff145bdba7a65543c
BLAKE2b-256 d6d90a3aabb3bae413f8549bd779e625d63a9b6a2a95b685216db22002230968

See more details on using hashes here.

Supported by

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