Files
seedbox/test/render.js
Gee 346c820b10
Some checks failed
check / check (push) Has been cancelled
Split kit and keys; KEYS GEN with MOTIF, 303, TURING, ARP
- genome(seed, salts) now has three parts with their own RNG streams:
  shared (steps, form, swing, arc, layback, fill odds, phase offset),
  kit (density, frame, accent cycle, free snare) and keys (scale/root,
  progression, motif, hocket, bass tone, note lengths, range). ROLL KEYS
  now renews the harmony too; ROLL KIT leaves the keys alone.
- Keys generators share one signature and can fix note lengths:
  MOTIF (the old line), 303 (acid bass, answers in the rests, drone or
  silent pad), TURING (8/16-bit shift register, DRIFT flips bits, 16-bar
  window), ARP (triad/7th arpeggio, roots on kicks).
- Pages: KIT GEN, KEYS GEN; ROLL shows KIT / KEYS; slots keep both gens.
- Flash record v3 (old settings ignored). Bring-up golden checksums updated.
- C port matches; host test and ASan/UBSan pass.

Intended music change: every seed sounds different (genome split, new
generators). Vectors regenerated with npm run vectors; the case grid now
crosses all kit and keys generators, with TURING runs past its window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 21:50:41 +03:00

16 lines
1.0 KiB
JavaScript

/* Renders one case to rows [tick,lane,voice,vel,len,track] per bar, plus a whole-case checksum. */
var E=require('../sim/engine.js');
function hex(n){ return '0x'+('00000000'+(n>>>0).toString(16).toUpperCase()).slice(-8); }
function renderCase(c,bars){
var st={seed:c.seed>>>0,salts:c.salts.slice()}, all=[], out=[];
bars=c.bars||bars;
for(var b=0;b<bars;b++){
var r=E.renderBar(st,{gen:c.gen,keys:c.keys,energy:c.energy,drift:c.drift,fill:c.fillBars.indexOf(b)>=0,scale:c.scale,root:c.root},b);
var ev=r.events.map(function(e){ return [e.t,e.lane,e.v,e.vel,e.len,e.tr]; });
out.push({bar:b,sec:r.sec,fill:!!r.fill,barTicks:r.barTicks,events:ev}); all=all.concat(ev);
}
return {bars:out,checksum:hex(E.checksum(all))};
}
function caseId(c){ return hex(c.seed).slice(2)+'_s'+c.salts.join('-')+'_g'+c.gen+'_k'+c.keys+'_e'+c.energy+'_d'+c.drift+(c.fillBars.length?'_f'+c.fillBars.join('-'):'')+(c.scale>=0?'_sc'+c.scale:'')+(c.root>=0?'_r'+c.root:'')+(c.bars?'_b'+c.bars:''); }
module.exports={renderCase:renderCase,caseId:caseId,hex:hex};