Commit Graph
3 Commits
Author SHA1 Message Date
Claude 94cb7a1f17 MATH generator: seven families and CHAOS 0..100 (the owner: "poco versátiles, cambios muy suaves")
mathGenerate in the editor's MATH section (which JIANT Studio also loads from the published editor page) now builds
formulas by family and by CHAOS, and checks every one against the device (V10.8.75 MATH USER).

- MATH_FAMILIES, each with an id and EN/ES/JA labels: sierpinski (classic bit patterns, xor), melodic (scales as
  string tables, plucks, sine echoes, arpeggios, hex nibble tables), fm (FIX: sin(w) phase modulation, index
  envelopes, stepped carriers, harmonic stacks, ring), glitch (stutters, random grains, reversed and modulo-chopped
  t, bit-crush), drone (FIX: detuned saws and sines, slow LFO phase modulation, beating chords; a detuned INT pair),
  rhythm (a falling-pitch sine kick, hashed-noise hats and snares, pattern masks, toms), chip (pulses and PWM, fast
  arpeggios, triangle bass, noise).
- mathGenerate(seed, {family, chaos}) -> {src, fix, wave (5 INT / 6 FIX), family, chaos, bytes, stack}; one
  (seed, family, chaos) is one formula; "any" takes the seed's family whatever the CHAOS. mathGenerate(seed) is the
  old call: a text, the seed's family at CHAOS 40. mathGenerate.FAMILIES too, for Studio's loader.
- CHAOS changes the build: at 0, one of the family's shapes with musical numbers; above, odd numbers and more rewrites
  (each kept only while the formula still fits 64 bytes and sounds): a gate or a second voice (15), the family's own
  idioms: t bent, crush, xor, phase modulation, octave jumps, vibrato, swing, layers (30); modulo, waveshapers,
  switching to another formula, other families mixed in, odd constants (55); t replaced by a whole formula, every t
  bent, formulas multiplied, other families' idioms (80).
- Every formula: FVM compiles it, at most 64 B and a stack of 12, no ph lp hp eu nor FUNC calls, only t w a n v; heard
  with FVM.run in four windows (sounding, not stuck at full-scale DC, not white noise, changing); else the next try.
- The MATH tab: a Family selector (Any and the seven) and a Chaos slider (0..100) by Generate formula, EN/ES/JA,
  40 px touch targets; the status names the family and the CHAOS. A FIX result is shown as FIX -> FLOAT and sent on
  WAVE 6, as one's own FIX formulas are.
- math_test.mjs: 1056 formulas (7 families and any x CHAOS 0..100 x 12 seeds) all valid, 0 silent; determinism;
  variety (10 seeds a family at CHAOS 50, eleven audio features: every family's median pair distance 4.0..6.1x a
  formula's distance from itself 4 s later, 76..98% of pairs past that one's 90th percentile, high-passed waveform
  correlation at most 0.43); families apart (nearest family centroid right for 48/70 at CHAOS 0, 37/70 at 50, chance
  10/70; 26/70 at 90, the families mixed); CHAOS 0 -> 100 terms 1.5..3.9x and nesting 3..6 levels deeper; the old
  call as Studio loads it; with EMU_WASM, 28 generated formulas sent to the V10.8.75 emulator: all taken and heard.
- editor_browser_test.mjs: the family and CHAOS controls (FM 80: FIX, RHYTHM 0: INT, seeded), the slider's height on
  a phone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
2026-11-30 12:57:43 +00:00
Claude 378f2c5da6 MATH tab: formulas of one's own sent to the device (MATH USER, JIANT FM V10.8.75)
The MATH tab compiles a formula of one's own to the device's bytecode and sends it to a track, now that the firmware
plays them (JIANT FM V10.8.75, codex/v66-clean: firmware/src/math_user.c, JIANT BYTE's formula machine).

- FVM (in the MATH section): a port of JIANT BYTE's compiler (its firmware/src/fvm.c, GPL-3.0, the owner's): its
  grammar (t w a n v; C's operators; sin cos tri saw sqr abs min max floor int fix rnd sat clip; a string as a table),
  its INT / FIX types, its folding, its instructions, serialized as math_user.c reads them (EDITOR_PROTOCOL.md "1.5").
  ph() lp() hp() eu() and FUNC's calls are BYTE's only: refused with that message. At most 64 bytes, a stack of 12.
  FVM.run is math_user.c's machine in JavaScript; FVM.pack7 / unpack7 the backup's groups.
- The tab: a text that is one of the firmware's 48 BYTE formulas is sent as its ALGO, as before; any other is MATH
  USER (the message says its size and INT -> BYTE or FIX -> FLOAT). Heard through the emulator's own machine (the
  wasm's FORMULA, track 1 at ALGO USER), the model when the wasm is older. Sent with FORMULA (100) to a device whose
  INFO has 'E' (45 02 64 12), read back and compared, then the eight values with ALGO -4 (USER) and WAVE 5 (INT) or 6
  (FIX). Read: a track at ALGO USER gives its bytes; their text comes back if it was sent from this browser (kept in
  localStorage by its bytes). An older device: not sendable, as before. The generator's formulas are MATH USER ones.
- The mock device answers FORMULA and says 'E' and 'C' 1.5 (before its 'D' / 'H').
- EDITOR_PROTOCOL.md: the proposal becomes "1.5: MATH USER, a formula of one's own (100; V10.8.75)": the command, the
  bytes (BYTE's FO_* numbers, the operand modes), the checks, what is not in JIANT FM, the project block, the presets;
  the version table and the frozen command numbers.

Tests:
- math_test.mjs: web/math_fvm_gold.json (142 texts compiled by BYTE's own fvm_compile from BYTE origin/main 1495526,
  serialized, run by its fvm_run): FVM gives BYTE's bytes for all 135 that fit (93 of BYTE's 96 factory formulas: B16 and F32 are over 64 bytes, F05 and F22 use ph(); and every operator),
  FVM.run BYTE's values for each (3 x 4160); the 7 refused refused; errors with their place; pack7; the generator's
  formulas fit. With EMU_WASM: B01's bytecode at ALGO USER plays B01's samples bit for bit; FORMULA reads back; a FIX
  formula on FLOAT sounds. Passes against a wasm built from the firmware's V10.8.75 commit (emsdk 6.0.11).
- editor_browser_test.mjs: on the firmware wasm, a formula of one's own compiled, sent to track 4 (FORMULA 4 0 gives
  the editor's bytes, ALGO -4), read back into the editor with its text; without a device, one's own heard through the
  emulator (the model without one), a FIX floatbeat recognised. Passes (with that wasm); test_web, test_backup,
  test_manual pass.

The public emulator (web/EMULATOR's pin) gets the VM when the pin moves to the firmware's V10.8.75 commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
2026-11-30 11:13:55 +00:00
Claude 2f49580a00 Editor: a formula editor for MATH (MATH tab): write, hear, generate, send
- A VM for MATH's BYTE grammar (eng_lofi.c lofi_byte: a C expression of t and a, unsigned 32-bit): errors said with
  their place, the operators a tap away, the grammar's help; bit for bit the firmware's 48 BYTE formulas (768000
  samples against the C compiled natively), VARIANT's mutation (lofi_mut) and MOTION's speed (lofi_motion) too. A
  formula that is one of the device's (however spaced) is recognised as its ALGO
- Its picture: 128 rows of what it plays (VAR, BEND, LOOP, the start), each sample its heat
- Its sound: the device's formulas (BYTE and FLOAT's 48) through the emulator's own wasm (/emu/felucca.wasm, loaded on
  the first Play: track 1 made MATH as the send does, the note on MIDI channel 1); a formula of one's own through a model
  of the BYTE voice (the firmware's integer time, hold, bits, smoothing); against the emulator, dry, C4: waveform
  correlation median 0.97 (MOTION 0), 0.90 (MOTION 64)
- A seeded generator: formulas built from the families of the firmware's own (nibble-table melodies, Sierpinski,
  multiplied-and-shifted, modulo textures), each kept only if it moves and is not noise; and sounds the device plays
  (a formula of its own, VARIANT, MOTION, BEND, LOOP, CHIP)
- Send to a track (TRACK, SET of G_ENGSEL, the eight values by TRACK_PARAM, read back) and read a MATH track back
- EDITOR_PROTOCOL.md: the proposal for a user formula (100 FORMULA, the bytecode the editor builds and tests: at most 90
  bytes and a stack of 8 for the firmware's 48); no firmware change
- Built when the tab first opens; its sound stops with the tab. English, Spanish, Japanese
- The roll's operations run one after another (a reload never between a batch's writes)
- math_test.mjs (the VM, the bytecode, the generator, the model against the emulator); editor_browser_test.mjs: the MATH
  tab on desktop and phone, and a send to the firmware itself read back

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
2026-11-29 00:44:59 +00:00