Skip to main content

Python library for dealing with musical scales and solfege

Project description

py-solfege

A Python library for dealing with musical scales and there solfège.

Static Badge GitHub Repo Code style: black

Why?

I needed a library that I could ask for "in this key, what is the solfege name for this note?"

JS has the Teoria library that could do the scale, but I needed this in Python.

I was unable to find a complete implementation in Python. All other projects I found on Pypi.org, github.com, and using Google search did NOT handle non-diatonic notes (and many required numpy as a dependency -> which is a quite heavy handed dependency for such a task...).

Usage:

>>> import solfege

>>> scale = solfege.Scale(solfege.Note("C"))
>>> scale.solfege(solfege.Note("C"))
'Do'
>>> scale.solfege(solfege.Note("D"))
'Re'
>>> scale.solfege(solfege.Note("B"))
'Ti'

# accidentals are handled
>>> scale.solfege(solfege.Note("C#"))
'Di'


>>> a_major_scale = solfege.Scale(solfege.Note("A"))
>>> a_major_scale.solfege(solfege.Note("A"))
'Do'
>>> a_major_scale.solfege(solfege.Note("B"))
'Re'
>>> a_major_scale.solfege(solfege.Note("C#"))
'Mi'

# minor scales are done with movable-Do, La-based method: https://en.wikipedia.org/wiki/Solf%C3%A8ge
>>> a_minor_scale = solfege.Scale(solfege.Note("A"), solfege.ScaleType.MINOR)
>>> a_minor_scale.solfege(solfege.Note("A"))
'La'
>>> a_minor_scale.solfege(solfege.Note("C"))
'Do'

See the docs.

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

solfege-1.0.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

solfege-1.0.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file solfege-1.0.0.tar.gz.

File metadata

  • Download URL: solfege-1.0.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for solfege-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5f9e2b997c1e20b768707a9646ffb5593d04fb0fd26cab5136a5cc6260a8e0e3
MD5 3ac8943a34de803018e2c0eb0d3f09e0
BLAKE2b-256 b0fac74c7545bdc3540fc45dc4913fb5738ef194a390b20dc0769292cadf4cc1

See more details on using hashes here.

File details

Details for the file solfege-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: solfege-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for solfege-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 269cafc5ed5b09ac71d46c51f01c475fa190eab053c8cfc4263eafdb2c342c7a
MD5 f3dec13658a180b3afb1d133a70da967
BLAKE2b-256 160ddf6cd691fb9d547609850c4670f4ea9155fdf74db984ca3aee66851bf7a6

See more details on using hashes here.

Supported by

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