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.2.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.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: theory_snake-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 3653c7f184eb6f60440acf6644a9f2d9b64d3b3ab85871d3c56e2cc579d3a295
MD5 b54255bb51b10ce7607e0ee197d67b57
BLAKE2b-256 79e7e65350f17078fbcbee144ebaf49e7ff24df3a9e19e336310d370d6acb903

See more details on using hashes here.

File details

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

File metadata

  • Download URL: theory_snake-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8a7a424808940d1722cb49321c509ae192db881cb0d6d20997f21e4bc84fbf1b
MD5 4e380be2d174fff8a5ed961e80cd48cf
BLAKE2b-256 c9f886cf1891fb2bb8d0cdbc59f10f7cae141d4d5a433840f726dfe11fec340b

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