Feat: improve 'at' in cagire grammar

This commit is contained in:
2026-03-20 23:29:47 +01:00
parent 609fe108bc
commit f020b5a172
13 changed files with 293 additions and 277 deletions

View File

@@ -34,9 +34,9 @@ clear
snare snd . ;; 1 snare (deltas cleared)
```
## Cross-product: at Without arp
## Polyphonic at
Without `arp`, deltas multiply with polyphonic voices. If you have 3 notes and 2 deltas, you get 6 emits -- every note at every delta:
Deltas multiply with polyphonic voices. If you have 3 notes and 2 deltas, you get 6 emits every note at every delta:
```forth
0 0.5 at
@@ -45,27 +45,25 @@ c4 e4 g4 note 1.5 decay sine snd .
6 emits: 3 notes x 2 deltas. A chord played twice per step.
## 1:1 Pairing: at With arp
## Arpeggios with at + cycle
`arp` changes the behavior. Instead of cross-product, deltas and arp values pair up 1:1. Each delta gets one note from the arpeggio:
Use `cycle` inside an `at` block to pick one note per subdivision:
```forth
0 0.33 0.66 at
c4 e4 g4 arp note 0.5 decay sine snd .
sine snd [ c4 e4 g4 ] cycle note 0.5 decay .
```
C4 at 0, E4 at 0.33, G4 at 0.66.
C4 at 0, E4 at 0.33, G4 at 0.66. `cycle` advances per iteration of the at-loop.
If the lists differ in length, the shorter one wraps around:
If the list is shorter than the number of deltas, it wraps:
```forth
0 0.25 0.5 0.75 at
c4 e4 arp note 0.3 decay sine snd .
sine snd [ c4 e4 ] cycle note 0.3 decay .
```
C4, E4, C4, E4 — the shorter list wraps to fill 4 time points.
This is THE key distinction. Without `arp`: every note at every time. With `arp`: one note per time slot.
C4, E4, C4, E4 — wraps to fill 4 time points.
## Generating Deltas