Skip to main content

musically meaningful pitch types

Project description

tests codecov License: GPL v3

pitchtypes

Musically meaningful types

The purpose of this Python library is to:

  1. Provide types that handle pitch in a musically correct way.
  2. Make it easy to implement other musically meaningful types.

For instance, spelled pitch is handled correctly:

>>> from pitchtypes import SpelledPitchClass
>>> p1 = SpelledPitchClass("C#")
>>> p2 = SpelledPitchClass("Gb")
>>> i = p1 - p2
>>> type(i)
<class 'pitchtypes.datatypes.SpelledIntervalClass'>
>>> i
+AA4

Of course, you can also convert spelled pitches to their enharmonic equivalents:

>>> from pitchtypes import SpelledPitch, EnharmonicPitch
>>> spelled = SpelledPitch("C#4")
>>> enharmonic = spelled.convert_to(EnharmonicPitch)
>>> type(enharmonic)
<class 'pitchtypes.datatypes.EnharmonicPitch'>
>>> enharmonic.midi
61
>>> enharmonic.name('sharp')
C#4
>>> enharmonic.name('flat')
Db4

And used continuous log-frequency space (assuming twelve-tone equal temperament for enharmonic pitch):

>>> from pitchtypes import EnharmonicPitch, LogFreqPitch
>>> enharmonic = EnharmonicPitch("A4")
>>> logfreq = enharmonic.convert_to(LogFreqPitch)
>>> logfreq
440.Hz

For more examples, have a look at the Tutorial.ipynb!

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

pitchtypes-0.0.2.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

pitchtypes-0.0.2-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file pitchtypes-0.0.2.tar.gz.

File metadata

  • Download URL: pitchtypes-0.0.2.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for pitchtypes-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4d1fa61f96b30e531c3bf0a4e895c55f94c444b254c0ea13ad106ae072b2db7f
MD5 2929c1df94a327c137cd1a94fc158065
BLAKE2b-256 f7e44ebbfdddf0965fd8ba86ae947b130ba26c0bde84d635f36d041832773a91

See more details on using hashes here.

File details

Details for the file pitchtypes-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pitchtypes-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for pitchtypes-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d28c2188ee7742975eafdfce7b47c62327380459b86328a00d6a6239b6578740
MD5 75c363d52b876af70fe500a471e6fb42
BLAKE2b-256 dc15a17243268441b69048fcea739be6b59e743cc6ebc73475b0bfcd83c02b32

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