Commit 576be34
authored
* feat: adopt `wave` into the language, with a generative `harmonics` form
`wave <name> <32 hex nibbles>` was never part of the grammar. It was a
host-registered top-level statement, absent from DECK_GRAMMAR.md and from
Highlight's TOP_KEYS, and every host that needed it registered its own copy —
tish-gba (which it came from), and deck-player. Parser.tish already named the
consequence: the hook exists because, without it, "the GBA implementation ended
up a separate grammar rather than a subset".
A statement every host implements is a language feature living in the wrong
place. The corpus that exists to stop that drift never saw a `wave` line, since
conformance parses with no host registrations.
So `wave` is core now, and profiles.json no longer carries it as a GBA
extension. On top of that, the hex is a poor way to say what a table is: timbre
is harmonic content, and the digits had to be computed somewhere else and pasted
in. `wave <name> harmonics <a1> …` takes amplitudes — fundamental first — and
sums them into the same 32 levels, normalized so only the ratios matter.
Expanded at parse time, exactly as `steps euclid` is, and for the same reason: a
host reads `levels` and never learns which spelling produced it. The source form
is kept alongside so an emitter can write `harmonics` back rather than flattening
it to hex. 013-wave pins that the two spellings resolve to identical levels, in
JS, in the Tish VM, and in the generated Rust crate.
The clamps in the additive path are gone rather than covered: normalizing by the
peak lands every sample in 0..15 by construction. What is guarded instead is the
case that was actually reachable — a non-finite amplitude, which would have put
NaN in the table.
* docs: cover wavetables, timbre and basicOsc in the examples
The examples page was eight blocks, every one of them a Game Boy chip song, and
not one of them used a `wave` table — so the page never showed the feature this
branch just adopted, and read as if the language were GBA-only.
Five sections added: wavetables (both spellings, side by side, so you can hear
they are one sound), designing a timbre from harmonics, instrument voices, and
`basicOsc` for when you want the language without the console. Plus mix and fx,
which no example demonstrated at all despite the channel strip applying to every
generator.
Everything stays inside the three generators this player synthesizes faithfully.
Deckard's other thirty parse fine and then get substituted for a plain
oscillator, which on a page where every block has a Play button would be a demo
that lies about what you are hearing. The intro now says so.
test/examples.mjs is what keeps that true: it parses every block on the page and
fails on a substitution or an ignored feature, not just on a parse error.
1 parent becde52 commit 576be34
33 files changed
Lines changed: 968 additions & 64 deletions
File tree
- conformance
- docs
- packages/player
- src/song
- test
- rust
- src
- deckfile
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
214 | 215 | | |
215 | 216 | | |
216 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
0 commit comments