Commit Graph

227 Commits

Author SHA1 Message Date
kennethreitz 89df5c4201 Merge pull request #37 from kennethreitz/repl
Add interactive REPL — music theory scratchpad
2026-03-25 21:26:20 -04:00
kennethreitz b396f42f84 Add REPL guide: theory scratchpad, composition, effects, complete example
Covers the prompt, theory commands, composition flow, effects,
automation, LFOs, playback, export, and a full start-to-finish session.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 21:26:11 -04:00
kennethreitz 45789f7af0 Fix all 6 PR review issues
1. readline: try/except for Windows compatibility
2. drums: only persist preset after successful load
3. chords: use analyze() for correct Roman numerals in minor keys
4. clear: full reset to initial state (key, bpm, drums, parts)
5. progression: add as alias for prog
6. lint: split one-line if statements (ruff E701)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 21:24:23 -04:00
kennethreitz e0bf637de5 Add theory commands, guitar, systems, intervals, 22 REPL tests
Theory: circle, interval, identify, system (with correct per-system tonics)
Guitar: fingering, diagram (scale on fretboard)
22 new tests covering all REPL commands.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 21:20:25 -04:00
kennethreitz e5f258bc21 Add guided welcome: 5 commands that teach the flow
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 21:15:11 -04:00
kennethreitz a294887215 Multiline prompt: compact when short, stacks when context grows
Single line: pytheory[key=Am | bpm=140]>
Multiline when >60 chars:
  key=Am | bpm=140 | drums=bossa nova | →lead(saw) rev=0.3 lp=2000
♫>

Shows active part synth and effects in the prompt.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 21:14:00 -04:00
kennethreitz 20932f48ab Context-aware prompt: pytheory[key=Am bpm=140 drums=bossa nova →lead]>
Shows key, bpm, drums preset, and active part in the prompt.
Fix: Part with 0 notes was falsy due to __len__, use 'is not None'.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 21:12:54 -04:00
kennethreitz 9e0faf840b Add interactive REPL — music theory scratchpad and composition tool
pytheory repl — commands mirror the Python API:
  key Am, chords, prog I V vi IV, modes, scales (theory)
  drums bossa nova, part lead saw pluck, add C5 1 (composition)
  arp Am updown 2 2, reverb 0.4, lfo lowpass... (effects)
  play_score, save_midi, render (output)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 21:10:36 -04:00
kennethreitz c7c733044c Remove Claude Code links from homepage, keep text
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 21:03:08 -04:00
kennethreitz 866065d7d7 Add connective prose to homepage — warm but concise
Brief intro paragraph, theory/composition section intros, pytheory demo
context. Enough personality without the wall of text.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 20:53:20 -04:00
kennethreitz aa9d4282c9 Trim homepage: two examples, compact feature list, get out of the way
197 → 85 lines. Theory example, composition example, pytheory demo,
one-line feature summary per category. No more walls of text
before the toctree.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 20:09:57 -04:00
kennethreitz 3593735243 Polish systems, fretboard, and theory docs
Systems: fix "four" to "six", add cultural context for each system
(Indian ragas, Arabic maqam, Japanese koto, Blues Delta origins,
Gamelan's influence on Debussy). Each system feels alive now.
Fretboard: add scale_diagram chord highlighting, non-string instruments note.
Theory: warmer opening, cross-reference to composition guide.
Tones, scales, chords, cli: verified complete — no changes needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 20:09:01 -04:00
kennethreitz 54fd4c2241 Make theory-only path first-class in quickstart
Two clear paths: theory (no audio needed) and composition.
Theory section expanded with tones, intervals, keys, chords,
analysis, modulation, 6 systems, guitar — all pure Python.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 20:05:25 -04:00
kennethreitz a4b11e6f35 Rewrite quickstart, update CLI docs, add composition recipes to cookbook
Quickstart: zero to arrangement in 5 minutes, pytheory demo, MIDI export.
CLI: add demo command docs at the top.
Cookbook: acid house, dub reggae, jazz ballad, song sections, MIDI export recipes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 20:04:46 -04:00
kennethreitz 044e9a7eac Fix CI: lazy-import sounddevice so MIDI/render work without PortAudio
sounddevice is now only imported when actually playing audio through
speakers. All other functions (save_midi, render_score, save) work
without PortAudio installed. Fixes 9 test failures in CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 19:43:39 -04:00
kennethreitz 094887c849 v0.25.1: pytheory demo command, README rewrite
- `pytheory demo` plays a randomly generated track (6 moods, different every time)
- README rewritten to showcase full feature set: composition, effects, drums,
  sidechain, automation, MIDI export, AI collaboration

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 15:28:42 -04:00
kennethreitz 2fc5aae678 Document sidechain compression and song structure sections
Effects: sidechain pump with parameters, practical examples, tip
about not sidechaining everything.
Sequencing: song sections with verse/chorus/repeat workflow,
custom names, real songwriting analogy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 15:22:51 -04:00
kennethreitz ac0cc0b6ce v0.25.0: Sidechain compression, song sections, punchier kick
- Sidechain: kick ducks pad/bass for EDM pump (sidechain=0.85)
- Song structure: score.section("verse"), score.repeat("chorus")
- Kick: 808-style 200→45Hz sweep, sub thump, soft saturation
- Section repeat copies notes, drums, automation with offset

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 15:21:33 -04:00
kennethreitz ce5f3e7626 Document humanize in sequencing guide
Values, use cases, combo with swing for realistic feel.
Convolution reverb was already documented in effects guide.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 15:06:24 -04:00
kennethreitz 0c4ba83b0c v0.24.1: Humanize — random micro-timing and velocity variation
Makes programmed parts feel like a real player. Random timing jitter
and velocity wobble applied at render time, score data stays clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 15:04:07 -04:00
kennethreitz f81b1e882d Document velocity, swing, tempo changes, and fades in sequencing guide
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 14:50:24 -04:00
kennethreitz ebf26cfbfa v0.24.0: Velocity, swing, tempo changes, fade in/out
- Per-note velocity for dynamics and accents
- Swing/groove parameter on Score and per-Part override
- score.set_tempo() for mid-song tempo changes with tempo map engine
- Part.fade_in() and Part.fade_out() volume envelopes
- Arpeggiator velocity support

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 14:44:50 -04:00
kennethreitz f9654fcdea Clean up code formatting: black-style, remove >>> from config snippets
Multi-line part creation uses vertical layout with trailing commas.
Configuration snippets use code-block:: python (clean, no >>>).
Interactive exploration keeps pycon format.
Mixed blocks split into setup + exploration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 14:36:58 -04:00
kennethreitz f3f4174783 Mention AI collaboration (Claude Code) on homepage
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 14:14:38 -04:00
kennethreitz 119dd2d921 Add conversational prose throughout all 5 guide pages
Sequencing: Score concept, time signatures for non-musicians, Parts as
DAW tracks, arpeggiator/legato/glide context with TB-303 and acid history.
Synths: synthesis philosophy, DX7/Juno/JP-8000 history, practical combos.
Effects: real-music context (The Edge, DJ knobs, shower reverb), why signal
chain order matters, automation as breathing, LFO as repeating automation.
Drums: drums-as-genre foundation, genre group cultural context, fills as
transition signals, drum synthesis as real drum machine techniques.
Playback: three output options context, MIDI as the working musician's path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 14:13:44 -04:00
kennethreitz 80698ccc3a Restructure docs: 5 focused pages + why-compose-in-Python intro
Break rhythm.rst and playback.rst into:
- sequencing.rst: Score, Parts, Duration, arpeggiator, legato
- synths.rst: 10 waveforms, 8 envelopes, combo recommendations
- effects.rst: signal chain, 5 effects, automation, LFOs
- drums.rst: DrumSound, 58 patterns, 21 fills, synthesis
- playback.rst: simplified output functions only

Rewrite index.rst with "Why compose in Python?" section explaining
the sketch→hear→export→DAW workflow, plus comprehensive highlights.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 14:03:27 -04:00
kennethreitz a41f20e805 v0.22.0: LFO automation for parameter modulation
- Part.lfo() generates automation points from oscillator shapes
- 4 shapes: sine, triangle, saw, square
- Rate, range, duration, and resolution all configurable
- Stack LFOs on different params for complex modulation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:52:40 -04:00
kennethreitz 2de263c814 v0.21.0: Effect automation via Part.set(), chorus effect
- Part.set() inserts automation markers for mid-song parameter changes
- Chorus effect (LFO-modulated delay, Juno-style thickening)
- Renderer segments at automation points for per-section processing
- Chain: distortion → chorus → lowpass → delay → reverb
- Docs: automation, chorus, updated signal chain

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:49:12 -04:00
kennethreitz a7ad8a374b v0.20.0: Arpeggiator, flat numeral parser, generative showoff
- Part.arpeggio() with 5 patterns, octave spanning, division control
- Roman numeral parser handles bVI, bVII, bIII, #IV prefixes
- song_showoff.py: generative composition using every feature,
  different every time (4 moods, matched keys/drums/effects)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:41:03 -04:00
kennethreitz e75c35a099 v0.19.1: Arpeggiator, legato/glide docs, sequencing page rename
- Part.arpeggio() with up/down/updown/downup/random patterns
- Octave spanning and division control for arps
- Document legato, glide, and arpeggiator in rhythm guide
- Rename docs page to "Sequencing: Rhythm and Scores"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:33:19 -04:00
kennethreitz b9f0a3870a v0.19.0: Legato mode with pitch glide/portamento
- Part(legato=True) renders continuous waveform without per-note retriggering
- Part(glide=0.04) adds 303-style pitch slides between notes
- Phase-accumulating oscillator for smooth frequency changes
- Exponential pitch interpolation for perceptually linear slides

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:28:50 -04:00
kennethreitz d425d6b624 Document per-part effects chain: distortion → lowpass → delay → reverb
Comprehensive effects docs with signal chain diagram, per-effect
reference, and combination examples (dub, acid, Drake-style 808).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:22:56 -04:00
kennethreitz 8c61cb146b Bump version to 0.18.1
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:06:29 -04:00
kennethreitz a11523e889 v0.18.1: Distortion effect, 3 new songs (dub delay, DnB, Drake)
- Soft-clip distortion (tanh waveshaping) with drive and mix controls
- Dub Delay Madness: separate snare track with massive delay/reverb
- Liquid DnB: 174bpm rollers with flowing lead
- Late Night Texts: Drake-style trap with 808 bass + distortion
- 16 total example songs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:05:56 -04:00
kennethreitz cf061e3783 Rewrite all 13 songs with per-part effects (reverb, delay, lowpass)
Every song now uses the full effects chain. Added 3 new songs:
Kingston After Dark (dub), Minimal Techno, Gospel Shuffle.
Each demonstrates different effect combinations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 13:01:56 -04:00
kennethreitz 5d746ed0b1 v0.18.0: Per-part audio effects — reverb, delay, lowpass filter
- Schroeder reverb (4 comb + 2 allpass filters) with mix/decay
- Tempo-synced delay with feedback
- 12 dB/oct biquad lowpass with resonance (Q) control
- Effects set at part creation, applied per-part before mixing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 12:56:48 -04:00
kennethreitz 89323c0eb3 v0.17.0: 10 new grooves + 10 new fills (58 grooves, 21 fills total)
Grooves: country, ska, dub, jungle, techno, gospel, swing, bolero, tango, flamenco
Fills: reggae, afrobeat, bossa nova, house, trap, hip hop, disco, cumbia, highlife, second line

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 12:49:14 -04:00
kennethreitz 5a44d619d0 v0.16.0: Drum fills — 11 genre presets with auto-fill support
- Pattern.fill() with 11 presets: rock, jazz, salsa, samba, funk, metal, blast, buildup, breakdown
- Score.fill() inserts a fill at the current position
- Score.drums() auto-fill support: fill_every=4 replaces every 4th bar

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 12:43:46 -04:00
kennethreitz f5bf7ce505 v0.15.1: PWM synths, score.drums() shorthand, docs update
- Synth.PWM_SLOW: pulse width modulation with 0.3 Hz LFO (Juno pads)
- Synth.PWM_FAST: pulse width modulation with 3 Hz LFO (chorus/vibrato)
- Score.drums("preset", repeats=N) shorthand
- All docs updated with score.drums() syntax and 10-synth reference table

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 12:37:36 -04:00
kennethreitz 4f3b706336 v0.15.0: Add square, pulse, FM, noise, and supersaw synth waveforms
- Square wave: chiptune / 8-bit (odd harmonics at 1/n)
- Pulse wave: variable duty cycle NES-style timbres
- FM synthesis: DX7-style carrier/modulator for bells, e-piano, brass
- Noise: white noise for percussion and texture
- Supersaw: 7 detuned saws for trance/EDM pads
- Refactor Synth enum to string-valued with callable dispatch
- All 8 waveforms available via API, Part strings, and CLI

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:37:21 -04:00
kennethreitz 83a988d085 Update rhythm and playback docs with Part class, multi-part examples
- Rhythm guide: full Part API docs with synths, envelopes, chaining,
  raw float beats, headless rendering, complete bossa nova example
- Playback guide: rewrite intro with quick-start showing both simple
  and expressive usage, update all Score examples to use named parts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:30:09 -04:00
kennethreitz d0e8e43b56 v0.14.0: Multi-part Score API with Part class
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:24:27 -04:00
kennethreitz c67a08a34e Rewrite songs with multi-part API, accept raw float durations
- All 10 songs now use score.part() for lead, bass, and chords
- Part.add() and .rest() accept raw float beats alongside Duration enums
- _RawDuration duck-type wrapper for arbitrary beat values

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:23:13 -04:00
kennethreitz e72ef4a6a7 Add Part class for multi-voice Score arrangements
- Part: named voice with synth, envelope, and volume settings
- Score.part() creates and registers parts
- Score.add_pattern() for cleaner drum pattern attachment
- render_score() renders all parts + drums into one buffer
- play_score() updated to use the new multi-part renderer
- Backwards compatible: Score.add() still works for simple cases

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:20:26 -04:00
kennethreitz 994c4e244a Rewrite song.py with 10 full arrangements using drums, chords, and synth leads
Bossa nova, bebop, salsa, afrobeat, reggae, funk, 12/8 blues, samba,
jazz waltz, and house — each with drum patterns, chord progressions,
and hand-written melody lines rendered through the synthesizer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:15:06 -04:00
kennethreitz adfbc3079a v0.13.1: Fix drum pattern repeat sync
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:10:35 -04:00
kennethreitz 772fa84b4f Fix drum pattern repeats: offset hit positions for each cycle
Hits were piling up at the same positions instead of being spread
across repeats. Now each repeat offsets by pattern.beats.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:10:07 -04:00
kennethreitz b97378c836 Add Playing a Score section to playback docs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:04:29 -04:00
kennethreitz f00cf10c41 v0.13.0: Drum synthesizer with play_pattern() and play_score()
- 27 synthesized drum voices (kick, snare, hat, conga, timbale, etc.)
- play_pattern() renders and plays drum patterns through speakers
- play_score() mixes drum patterns + chord progressions together
- Comprehensive drum synthesis docs with sound descriptions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:01:02 -04:00
kennethreitz d57e780f6f v0.12.0: Rhythm module with 48 drum pattern presets
- Duration, TimeSignature, Score for note-level rhythm
- DrumSound enum (27 GM percussion sounds)
- Pattern class with 48 presets: rock, jazz, bebop, salsa, bossa nova,
  samba, afrobeat, funk, reggae, house, trap, metal, Afro-Cuban claves,
  cumbia, merengue, breakbeat, and many more
- Pattern.to_score() + save_midi() for drum MIDI export
- Comprehensive rhythm guide documentation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 05:02:01 -04:00