Skip to main content

A Python library for symbolic music analysis, focusing on chord voicings and tensions.

Project description

PyVoicing

A Python library for symbolic music analysis, focusing on chord voicings and tensions, providing intuitive Python classes for working with pitches, chromas, intervals, and voicings.

  • Pythonic syntax
  • Lightweight, no dependency

PyVoicing is currently in Alpha stage. API and type hints are subject to change.

Installation

pip install pyvoicing

Usage

from pyvoicing import Pitch, Chroma, Interval, Voicing
# shorthands
from pyvoicing import P, C, I, V
# or simply
from pyvoicing import *

# Pitch
middle_c = Pitch('C', 4)
middle_c.value  # 60
~middle_c       # 60, shorthand
middle_c.octave # 4
middle_c.offset # 0
middle_c.name   # 'C'
middle_c.chroma # Chroma("C")

g = Pitch('G')  # default octave=4
b = P('B')      # shorthand P for Pitch
e = P('E5')     # octave as part of the string

a = e >> 'P4'   # transpose up a perfect 4th
a <<= 12        # transpose down an octave

# Voicing
Cmaj7open = Voicing([middle_c, g, b, e], root='C')
Cmaj7open   # Voicing('C4 G4 B4 E5', 'C')
~Cmaj7open  # ['1', '5', 'maj7', 'maj5']

C69 = Cmaj7open + a - 'B4' + 'D5'
~C69        # ['1', '5', '6', '9', 'maj3']
C69 >> 3    # Voicing('Eb4 Bb4 C5 F5 G5', 'Eb')

Bm7b5 = V('B D5 F5 A5', 'B')  # shorthand
~Bm7b5      # ['1', 'min3', 'b5', 'min7']
Bm7b5.root = 'G'
~Bm7b5      # ['maj3', '5', 'dom7', '9']
G9rootless = V(Bm7b5)

C913rootless = G9rootless // 'C'
C913rootless    # Voicing('E4 G4 Bb4 D5', 'C')
C913rootless[1] >>= 2
C913rootless    # Voicing('E4 A4 Bb4 D5', 'C')
~C913rootless   # ['maj3', '13', 'dom7', '9']

License

PyVoicing is licensed under the MIT License.

Contributing

Feature suggestions and bug reports are welcome!

Changelog

See CHANGELOG.md for version history and release notes.

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

pyvoicing-0.1.1.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

pyvoicing-0.1.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file pyvoicing-0.1.1.tar.gz.

File metadata

  • Download URL: pyvoicing-0.1.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyvoicing-0.1.1.tar.gz
Algorithm Hash digest
SHA256 436458d7785f46c488d7c51d1787ccb4f1b19126de6ce5cd3117a300f181e8f7
MD5 f6e45997dc7ca14fed5c6aedee1b0621
BLAKE2b-256 c62c82e534e59fe10de9b8c8c88feaf378ea83e7bde1a9a7516e0173c42eea0f

See more details on using hashes here.

File details

Details for the file pyvoicing-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyvoicing-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyvoicing-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9d1ccba4fe6b97a84bd26459a08a4612b76935ef997eb7acf903e36908ddd20e
MD5 f406e4ab1fbfc3f925b555b7fd18ed7b
BLAKE2b-256 56a76c88adf3f8ac16c33cb2159581fb71c4bcaf701d4eea53f34d0bfc66102d

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