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-0.2.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for solfege-0.2.0.tar.gz
Algorithm Hash digest
SHA256 52c39247c46ba653096b6c2d10cc3b7fe41428a4bf1e9552865a7f351763141b
MD5 20e351c83c8fd417f7c4ee882ba3def2
BLAKE2b-256 2edbe673288008a55923e6edbffe1e804078b147e6fabc0d1ef83488c05acae6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: solfege-0.2.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-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb92cc6f6e495128d060db72ebed057889533ea809fb8dbc050e33e8868fc3a4
MD5 1de70a2ca0fdc401cbe8169d95b1a2d9
BLAKE2b-256 26fe71767754c5878cf4ab308a424db8cfd2b469fa44d9687e22d44239f47d4e

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