Skip to content

feat(ascii_tracker): grid notation inspired by Switch Angel's Strudel sequencer#5

Open
Talador12 wants to merge 1 commit into
mainfrom
feat/ascii-tracker
Open

feat(ascii_tracker): grid notation inspired by Switch Angel's Strudel sequencer#5
Talador12 wants to merge 1 commit into
mainfrom
feat/ascii-tracker

Conversation

@Talador12
Copy link
Copy Markdown
Owner

Summary

  • Phase 2 of docs/strudel_integration.md: Switch Angel-style ASCII tracker as a pure offline module that renders through the existing PolyphonicTrack pipeline.
  • New module code_music.ascii_tracker exposes AsciiTracker.from_string / to_patterns / to_song / to_string. Cells parse as rests, pitched notes, chords (C2,E2,G2), and notes with velocity (C2:80 MIDI scale or C2:0.6 fractional).
  • Two demo songs: songs/tracker_trance.py (138 BPM trance grid, 6 voices) and songs/tracker_chord_progression.py (I-vi-IV-V at 84 BPM).
  • 35 tests covering parsing, rendering, error cases, round-trip, and edge cases.

Format example

     KICK SNARE HAT  BASS LEAD PAD
00 | C2   ...   C5   F1   ...  F3,A3,C4
01 | ...  ...   C5   ...  ...  ...
02 | ...  ...   C5   F1   A4   ...
...

Changes

  • code_music/ascii_tracker.py - new module (~300 lines).
  • code_music/__init__.py - re-export AsciiTracker, Cell, tracker.
  • tests/test_ascii_tracker.py - 35 tests.
  • songs/tracker_trance.py, songs/tracker_chord_progression.py - demo songs.
  • .github/workflows/ci.yml - tracker smoke render alongside existing songs.
  • docs/strudel_integration.md - Phase 2 marked shipped, ship-order updated.
  • claude.md - status updated, next-step pointer to Phase 1 mini-notation parity.

Verification

  • ruff check code_music tests songs samples scales scripts albums -> clean.
  • pytest tests/ -> 3844 passed (was 3804 before this PR + visualizer/hook PRs; +35 new ascii_tracker tests).
  • Both demo songs render to WAV locally (/tmp/tracker_trance.wav 0.7 MB, /tmp/tracker_chord.wav 3.3 MB).

Out of scope

  • Slide notation (C2~D2) and modulation lanes - cell parser deliberately raises ValueError on these tokens so the gap is visible. Future PR.
  • Strudel mini-notation parity in code_music.pattern - that is Phase 1 of the plan, separate PR.

… sequencer

Phase 2 of the Strudel integration plan. Switch Angel mentioned in her
Night Friends video description that she built her own ASCII track
sequencer in Strudel for live param tweaking; this lands the same idea
in code-music as a pure offline module that renders through the existing
PolyphonicTrack pipeline.

Format: a multi-line text grid where rows are time steps and columns are
voices. Cells parse as:

  C2, F#3, Bb4    pitched notes
  C2,E2,G2        chord (comma-separated)
  C2:80           note with explicit MIDI velocity (0..127)
  C2:0.6          note with fractional velocity (0..1)
  ~ - ...         rest tokens
  # comment       comment line
  00 |            optional step-index prefix per row

Module:
- code_music/ascii_tracker.py — AsciiTracker.from_string, to_patterns,
  to_song, to_string. Round-trip clean for any tracker built from
  from_string.
- code_music/__init__.py — re-export AsciiTracker, Cell, tracker.

Songs:
- songs/tracker_trance.py — 16-step trance grid at 138 BPM (Switch Angel
  style: kick/snare/hat/bass/lead/pad).
- songs/tracker_chord_progression.py — 16-step I-vi-IV-V grid at 84 BPM
  (piano + bass).

Tests:
- tests/test_ascii_tracker.py — 35 tests covering rest tokens, single
  notes, sharp/flat, chord cells, velocity (MIDI + fractional), invalid
  tokens, header parsing, comment + blank-line handling, optional step
  index, row/column count mismatch errors, to_patterns chord collapse,
  to_song polytrack assignment, instruments dict, default fallback,
  step-duration timing, simultaneous chord events, and to_string round-
  trip for both monophonic and chord grids.

CI: added a tracker_trance smoke render alongside the existing songs.

Slide notation (C2~D2) and modulation lanes documented as deferred -
the v1 cell parser raises ValueError on those tokens deliberately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant