🌐 Live API: https://notes21.onrender.com/
📘 Swagger Docs: https://notes21.onrender.com/docs
notes21 requires Python 3.13 or newer.
A tonal computation engine based on a structured 7×3 grid representation of music.
notes21 provides:
- A formal note abstraction (
Note) - Key-aware grid projection
- 2D harmonic encoding (octave-collapsed)
- 3D register-aware encoding (octave-preserving)
- Text and graphical visualization
- A FastAPI-based HTTP API
- Full test coverage
The system models pitch using a 7×3 tonal grid:
- 7 rows → Diatonic degrees (C, D, E, F, G, A, B)
- 3 columns → Relative accidental (flat, natural, sharp)
- Optional 3rd dimension → Octave (register)
This creates a structured tonal geometry suitable for:
- Harmonic analysis
- Tonal fingerprinting
- Register-aware modeling
- Algorithmic processing
- ML embedding experiments
src/notes21/
music/
core.py
encoding.py
visualization.py
api/
app.py
This project uses uv for dependency management and commits a uv.lock
file to ensure deterministic builds across local, CI, and production.
Install uv (macOS example):
brew install uvFor Linux, Windows, and other installation methods, see the official uv installation guide:
https://docs.astral.sh/uv/getting-started/installation/
Create and activate a virtual environment:
uv venv
source .venv/bin/activateInstall dependencies (including development dependencies):
uv sync --extra devStart the FastAPI server:
uvicorn notes21.api.app:app --reloadThen open:
http://127.0.0.1:8000/docs
to access the interactive API documentation.
curl "http://127.0.0.1:8000/grid?note=Db&key=C"curl "http://127.0.0.1:8000/grid?note=Db&key=C&format=text"Run the test suite:
uv run pytestOctave-collapsed tonal distribution:
shape → (7, 3)
Use case:
- Harmony analysis
- Chord density
- Tonal fingerprinting
Octave-preserving tonal tensor:
shape → (D, 7, 3)
Where D = number of octaves in the selected range.
Use case:
- Melody modeling
- Voice leading
- Register-sensitive analysis
- Expressive structure modeling
docs/7x3_music_representation.mddocs/7x3_2D_vs_3D_tonal_grid_representations.mddocs/7x3_structural_and_computational_significance.mddocs/api.md
Early-stage tonal computation framework.
Designed for experimentation, research, and computational music modeling.