Metadata-Version: 2.1
Name: pitchtypes
Version: 0.0.2
Summary: musically meaningful pitch types
Home-page: https://github.com/DCMLab/pitchtypes
Author: Robert Lieck
Author-email: robert.lieck@epfl.ch
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown

![tests](https://github.com/DCMLab/pitchtypes/workflows/tests/badge.svg)
[![codecov](https://codecov.io/gh/DCMLab/pitchtypes/branch/main/graph/badge.svg)](https://codecov.io/gh/DCMLab/pitchtypes)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

# 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:

```python
>>> 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:

```python
>>> 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):

```python
>>> 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](Tutorial.ipynb)!


