PyTheory is a Python toolkit for exploring music theory, composing arrangements, synthesizing sound, and exporting musical ideas programmatically. It models concepts such as notes, intervals, scales, chords, keys, progressions, fretboards, modes, and multiple musical systems. A score API can combine melodic parts, bass lines, chords, drums, synthesis, effects, automation, and sequencing. Compositions can be played immediately or exported as MIDI for continued production in a digital audio workstation. The command-line interface includes chord analysis, progression generation, tuning, playback, live MIDI tools, and an interactive REPL. A browser playground provides access without installation, while optional integrations support Ableton Link and external MIDI input. The project also offers Claude Code skills for AI-assisted composition and analysis.
Features
- Scales, chords, keys, and interval analysis
- Multi-part score composition
- Built-in synthesis, drums, and effects
- MIDI generation and export
- Interactive CLI and browser playground
- Live MIDI, Ableton Link, and AI composition integrations