Skip to main content

A simple Python library for generating music chords and scales.

Project description

theory_snake 🐍🎶

A lightweight Python library for music theory. Easily generate scales, build chords, and handle note transformations with a simple, intuitive API.


🚀 Installation

Install theory_snake via pip:

pip install theory_snake

🎹 Features & Usage

1. Scales

Generate full scales by providing a root note and the scale type.

Python

from theory_snake.scale_builder import build_scale

# Generate a C Major Scale
c_major = build_scale("C", "major")
print(c_major)
# Output: ['C', 'D', 'E', 'F', 'G', 'A', 'B']

# Generate an A Minor Scale
a_minor = build_scale("A", "minor")
print(a_minor)

2. Chords

Construct triads quickly using the chord builder.

Python

from theory_snake.chord_builder import build_chord

# Build a G Major triad
g_major = build_chord("G", "major")
print(g_major)
# Output: ['G', 'B', 'D']

# Build a D Minor triad
d_minor = build_chord("D", "minor")
print(d_minor)

3. Note Utilities

Handle accidentals and note naming conventions efficiently.

Python

from theory_snake.note_utils import get_sharp, get_flat

print(get_sharp("C")) # "C#"
print(get_flat("B"))  # "Bb"

4. Constants

Access raw music theory data like intervals and formulas. Note: These must be imported explicitly from the consts module.

Python

from theory_snake import consts

# Access raw semitone formulas
print(consts.CHORD_FORMULAS['major']) # [0, 4, 7]

🏗 Project Structure

The library is organized for modularity and easy extension:

Plaintext

theory_snake/
├── src/
│   └── theory_snake/
│       ├── __init__.py      # Shortcuts for builders & utils
│       ├── note_utils.py    # Accidental handling
│       ├── chord_builder.py # Triad logic
│       ├── scale_builder.py # Scale logic
│       └── consts.py        # Intervals and formulas

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

theory_snake-0.1.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

theory_snake-0.1.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: theory_snake-0.1.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.2

File hashes

Hashes for theory_snake-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0bebef386783e1b160fe9fe8ba61d24aa39d47fb76520d4900e1c8f44cbe69a2
MD5 cd533c8e0238cc111f264ef08e56d3e4
BLAKE2b-256 6a4608a3996a2811b24b53d21bce076cb95edd40e180ab31522b36ac4a9ce7fb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: theory_snake-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.2

File hashes

Hashes for theory_snake-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 664206a6074cb1f4dd45126434339af78e0ffb969f44eedfe48e3f2a688abf22
MD5 f541ed0a68be3669f2694065af113cb9
BLAKE2b-256 4dde64ea9b9ad193497421428aa63956eb562f8c963ba392bb30566bae8d55f7

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