Files
JIANT/tools/video/update.html
T
Claude 329aff53fa 0.9.12 draft: 12 voices with the second core, sound types + PRESETS by type, MIDI LEARN (MENU > MIDI), FM6 bank sector guard, copyright lines
- voice.c voice_cap: VOICES_2CORE 12 while the second core takes parts (fx.c mc_two: CORES 2, not REC at
  power-on, not given up); one core 8, LOAD ECO 6; a track still NVOICE 8 (no RAM). After Skiff by illuminus5.
  cpu_vg: mix/v12 (both cores 3924 instr/sample), mix/v12.c0 (core 0 1949), mix/v12.one (one core, 8 voices 3241);
  regress.c chk_budget_2core; the dual-core equivalence test at one budget (mc_host_v12).
- Sound types (PT_BASS..PT_FX) on all factory presets in preset_t.mono bits 1..4 (no format change); PRESETS LIST
  ALL / FAV / BASS LEAD PAD KEYS PLUCK BELL VOX DRUM FX across engines, saved in favorites.factory[15][18];
  gen.c keeps PT_BASS sounds off the other roles (was a name match). After Skiff by illuminus5.
- MIDI LEARN ported from Felucca 1.5 (midi_learn.c): 10 CCs, 3 bytes each in DIGITAL's favourites row, reserved
  CCs and the standard map refused, any channel, USB and TRS; MENU > MIDI tab (MIDI OUT, LEARN, LEARN CLEAR);
  state in the pool.
- fm6_vbank.c: 0xE7000 holding foreign data (Skiff's pattern bank) reads as no bank and is never erased at
  power-on; only a bank the user sends replaces it. fm6bank_test foreign_test.
- Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant) in JIANT's files ("Portions" in mostly-Felucca ones),
  README / LICENSING.md / MENU > ABOUT credits (Felucca, Skiff).
- Docs: MANUAL.md / MANUAL.es.md, README v0.9.12 draft, EDITOR_PROTOCOL.md (tabs), cheat sheets, nav map.

Flash 576192 -> 577712 B (+1520), .data+.bss unchanged, pool +8 B (spare 10528 B).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
2026-10-18 18:50:07 +00:00

360 lines
26 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<!-- SPDX-License-Identifier: GPL-3.0-only
Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)
(JIANT 0.6.68) the presentation film, a frame at a time (tools/video/film.mjs drives it with "promo"): the landing
page's organic cyberspace and protozoa; the FM-1's screen large, floating in a living membrane (cilia, organelles),
drifting and breathing with the kick; what happens on it told as the landing tags its specimens (a caption, data
lines on curved leaders to points of the screen, live readings); the beings swim out of the membrane on their notes;
at the end the list of what is new, a picture of each. All of it moved by the sound. -->
<html><head><meta charset="utf-8"><link rel="stylesheet" href="fonts/fonts.css">
<style>html,body{margin:0;background:#050409}canvas{display:block}</style></head>
<body><canvas id="c" width="1920" height="1080"></canvas>
<script>
const W = 1920, H = 1080, TAU = Math.PI * 2;
const C = {line:'#efe6c8',cyan:'#3fe0e6',blue:'#3b30ff',red:'#ff3b2f',orange:'#ff7a1a',yellow:'#ffe14d',mag:'#ff3ea5',dim:'#9c94b4',void:'#050409'};
const DISPLAY = 'Michroma', MONO = '"IBM Plex Mono"', BODY = '"Instrument Sans"', TERM = 'VT323';
const cv = document.getElementById('c'), x = cv.getContext('2d');
let D = null;
function rng(a){return function(){a|=0;a=a+0x6D2B79F5|0;let t=Math.imul(a^a>>>15,1|a);t=t+Math.imul(t^t>>>7,61|t)^t;return((t^t>>>14)>>>0)/4294967296;};}
/* ---------- the landing's protozoa, as it draws them ---------- */
function organism(x,o,t){
const s=o.s;x.save();x.translate(o.x,o.y);x.rotate(o.rot+Math.sin(t*.25+o.ph)*.25);x.globalAlpha=o.a;
if(o.glow){const g=x.createRadialGradient(0,0,0,0,0,s*2.4);g.addColorStop(0,'rgba(90,100,255,.55)');g.addColorStop(.45,'rgba(150,80,255,.22)');g.addColorStop(.72,'rgba(255,110,60,.16)');g.addColorStop(1,'rgba(0,0,0,0)');x.fillStyle=g;x.beginPath();x.arc(0,0,s*2.4,0,TAU);x.fill();}
x.lineWidth=o.lw||1;x.strokeStyle=C.line;
switch(o.type){
case 0:{const rx=s,ry=s*.55;x.beginPath();x.ellipse(0,0,rx,ry,0,0,TAU);x.stroke();
x.globalAlpha=o.a*.45;x.beginPath();x.ellipse(0,0,rx*.88,ry*.8,0,0,TAU);x.stroke();x.globalAlpha=o.a;
for(let i=0;i<44;i++){const a=i/44*TAU,px=Math.cos(a)*rx,py=Math.sin(a)*ry;let nx=Math.cos(a)/rx,ny=Math.sin(a)/ry;const l=Math.hypot(nx,ny);nx/=l;ny/=l;const w=Math.sin(t*5+i*.6+o.ph)*.5,L=s*.14;const ex=nx*Math.cos(w)-ny*Math.sin(w),ey=nx*Math.sin(w)+ny*Math.cos(w);x.beginPath();x.moveTo(px,py);x.lineTo(px+ex*L,py+ey*L);x.stroke();}
x.fillStyle='rgba(255,225,77,.85)';x.beginPath();x.ellipse(-s*.15,0,s*.2,s*.14,0,0,TAU);x.fill();x.strokeStyle=C.orange;x.stroke();
x.strokeStyle=C.mag;for(let k=0;k<3;k++){x.beginPath();x.arc(s*(.25+k*.18),Math.sin(k*2)*s*.12,s*.07,0,TAU);x.stroke();}
x.strokeStyle=C.red;x.lineWidth=1.6;x.beginPath();x.moveTo(-s*.75,-s*.15);x.quadraticCurveTo(-s*.45,s*.25,-s*.1,s*.3);x.stroke();break;}
case 1:{x.beginPath();for(let a=0;a<=TAU+.01;a+=.08){const r=s*(.7+.22*Math.sin(3*a+t*.8+o.ph)+.12*Math.sin(5*a-t*.6));const px=Math.cos(a)*r,py=Math.sin(a)*r;a?x.lineTo(px,py):x.moveTo(px,py);}x.closePath();x.stroke();
x.fillStyle=C.orange;for(const d of o.dots)x.fillRect(d[0]*s,d[1]*s,1.4*(o.lw||1),1.4*(o.lw||1));
x.strokeStyle=C.cyan;x.beginPath();x.arc(s*.1,-s*.1,s*.16,0,TAU);x.stroke();x.fillStyle=C.cyan;x.beginPath();x.arc(s*.1,-s*.1,s*.05,0,TAU);x.fill();break;}
case 2:{x.beginPath();x.arc(0,0,s*.5,0,TAU);x.stroke();x.beginPath();x.arc(0,0,s*.38,0,TAU);x.stroke();
x.fillStyle='rgba(255,59,47,.9)';x.beginPath();x.arc(0,0,s*.2,0,TAU);x.fill();
for(let i=0;i<28;i++){const a=i/28*TAU+t*.05,l=s*(.95+.15*Math.sin(i*3.1));x.beginPath();x.moveTo(Math.cos(a)*s*.5,Math.sin(a)*s*.5);x.lineTo(Math.cos(a)*l,Math.sin(a)*l);x.stroke();x.fillStyle=C.line;x.fillRect(Math.cos(a)*l-1,Math.sin(a)*l-1,2,2);}
x.fillStyle=C.yellow;for(let i=0;i<12;i++){const a=i/12*TAU;x.fillRect(Math.cos(a)*s*.44-1,Math.sin(a)*s*.44-1,2,2);}break;}
case 3:{x.beginPath();x.moveTo(s*.6,0);x.bezierCurveTo(s*.6,-s*.4,-s*.4,-s*.3,-s*.5,0);x.bezierCurveTo(-s*.4,s*.3,s*.6,s*.4,s*.6,0);x.stroke();
x.strokeStyle=C.cyan;x.beginPath();for(let i=0;i<=40;i++){const u=i/40,px=-s*.5-u*s*2.2,py=Math.sin(u*10-t*6+o.ph)*s*.14*u;i?x.lineTo(px,py):x.moveTo(px,py);}x.stroke();
x.fillStyle=C.red;x.beginPath();x.arc(s*.35,-s*.08,s*.06,0,TAU);x.fill();x.strokeStyle=C.orange;x.beginPath();x.arc(0,0,s*.13,0,TAU);x.stroke();break;}
default:{const L=s*.9,Wd=s*.28;x.beginPath();x.ellipse(0,0,L,Wd,0,0,TAU);x.stroke();x.strokeStyle=C.cyan;x.beginPath();x.moveTo(-L*.9,0);x.lineTo(L*.9,0);x.stroke();x.strokeStyle=C.line;
for(let i=-9;i<=9;i++){const px=i/10*L,hh=Wd*Math.sqrt(Math.max(0,1-(px/L)*(px/L)))*.8;x.beginPath();x.moveTo(px,-hh);x.lineTo(px,-hh*.25);x.moveTo(px,hh*.25);x.lineTo(px,hh);x.stroke();}
x.fillStyle=C.mag;x.beginPath();x.arc(0,0,s*.06,0,TAU);x.fill();}
}
x.restore();
}
/* ---------- the landing's background: organic cyberspace ---------- */
const ids=['R078','K729','F802','D732','V763','S209','P398'];
const TYPE_OF = [3, 1, 4, 2, 0, 1]; /* lead a flagellate, bass an amoeba, plucks a diatom, drums the radiolarian,
strings the ciliate, the choir a glowing amoeba */
const TNAME = ['LEAD', 'BASS', 'PLUCK', 'DRUM-X', 'STRINGS', 'CHOIR'];
let orgs = [], stars = [];
(function(){const R=rng(7);
for(let i=0;i<18;i++){const z=.5+R()*.8;const o={x0:R()*W,y0:R()*H,s0:(16+R()*34)*z,z:z,rot:R()*TAU,ph:R()*10,type:i%5,trk:i%6,vx:(R()-.5)*.32*z,vy:(-.1-R()*.24)*z,a0:.3+z*.45,glow:R()<.38,tag:i<ids.length?ids[i]:null,dot:R()<.5,dots:[]};
for(let k=0;k<26;k++){const a=R()*TAU,r=Math.sqrt(R())*.5;o.dots.push([Math.cos(a)*r,Math.sin(a)*r]);}orgs.push(o);}
for(let i=0;i<Math.round(W*H/4500);i++)stars.push([R()*W,R()*H,R()<.2,R()]);})();
function globe(t,cx,cy,R,amp){x.save();x.strokeStyle=`rgba(255,122,26,${.3+.4*amp})`;x.lineWidth=.8+amp;x.beginPath();x.arc(cx,cy,R,0,TAU);x.stroke();
for(let i=0;i<8;i++){const ph=t*.15+i/8*Math.PI;x.beginPath();x.ellipse(cx,cy,Math.abs(Math.cos(ph))*R,R,0,0,TAU);x.stroke();}
for(let k=-3;k<=3;k++){const yy=k/4*R,rr=Math.sqrt(R*R-yy*yy);x.beginPath();x.ellipse(cx,cy+yy,rr,rr*.16,0,0,TAU);x.stroke();}
x.setLineDash([2,4]);x.strokeStyle='rgba(63,224,230,.35)';x.beginPath();x.ellipse(cx,cy,R*1.35,R*.4,-.4+t*.1,0,TAU);x.stroke();x.setLineDash([]);x.restore();}
function chevron(cx,cy,label){x.fillStyle=C.mag;[[0,0],[1,1],[2,2],[3,1],[4,0]].forEach(p=>x.fillRect(cx+p[0]*8,cy+p[1]*8,7,7));x.font='22px VT323,monospace';x.fillText(label,cx,cy-8);}
function background(f,t,A){
x.fillStyle='#050409';x.fillRect(0,0,W,H);
for(const s of stars){const tw=.6+.4*Math.sin(t*2+s[3]*40)+A.high*.8*s[3];x.fillStyle=s[2]?`rgba(63,224,230,${.55*tw})`:`rgba(239,230,200,${.3*tw})`;x.fillRect(s[0],s[1],1+(A.high>.7&&s[3]>.85?1:0),1);}
/* the floor: its lines roll toward us a line a beat, brighter on the kick */
const gy=H*.66, roll=(t/D.beat)%1;
x.strokeStyle=`rgba(59,48,255,${.24+.4*A.low})`;x.lineWidth=1;
for(let i=0;i<=14;i++){const u=(i+roll)/14;const y=gy+Math.pow(u,2)*(H-gy);x.beginPath();x.moveTo(0,y);x.lineTo(W,y);x.stroke();}
for(let i=-16;i<=16;i++){x.beginPath();x.moveTo(W/2+i*18,gy);x.lineTo(W/2+i*W*.12,H);x.stroke();}
globe(t*(1+A.mid),W*.5,H*.2,Math.min(W,H)*.11*(1+.08*A.low),A.low);
const tagged=[];
for(const o of orgs){
const m=o.s0*3, px=((o.x0+o.vx*f*2)%(W+2*m)+(W+2*m))%(W+2*m)-m, py=((o.y0+o.vy*f*2)%(H+2*m)+(H+2*m))%(H+2*m)-m;
const lv=A.trk[o.trk]||0;
const d=Object.assign({},o,{x:px,y:py,s:o.s0*(1+.55*lv),a:Math.min(1,o.a0*(.75+.6*lv)),lw:1+lv*.8});
organism(x,d,t);if(o.tag)tagged.push(d);
if(o.dot){x.fillStyle=C.red;x.beginPath();x.arc(d.x+d.s*.45,d.y-d.s*.3,2.5+2*lv,0,TAU);x.fill();}}
x.strokeStyle=`rgba(255,225,77,${.3+.4*A.mid})`;x.lineWidth=1;
for(let i=0;i<tagged.length-1;i++){const a=tagged[i],b=tagged[i+1];x.beginPath();x.moveTo(a.x,a.y);x.quadraticCurveTo((a.x+b.x)/2,Math.min(a.y,b.y)-90,b.x,b.y);x.stroke();}
for(const o of tagged){const bx=o.x+o.s*.7,by=o.y-o.s*.7;x.fillStyle=C.yellow;x.fillRect(bx,by-10,10,10);
x.fillStyle=C.line;x.font='500 12px "IBM Plex Mono",monospace';x.fillText(o.tag+' · '+TNAME[o.trk],bx+15,by);
x.fillStyle='rgba(239,230,200,.55)';x.font='10px "IBM Plex Mono",monospace';x.fillText('x:'+Math.round(o.x)+' y:'+Math.round(o.y)+' lvl:'+(A.trk[o.trk]||0).toFixed(2),bx,by+14);}
chevron(W*.035,H*.93,String(Math.floor(t/D.beat/4)+1).padStart(3,'0'));
}
/* ---------- HUD corners (the landing's .brk) and its glass ---------- */
function brk(X,Y,w,h,col,k,glass){
if(glass){x.fillStyle=glass;x.fillRect(X,Y,w,h);}
x.fillStyle=col;k=k||14;
x.fillRect(X,Y,k,1);x.fillRect(X,Y,1,k);x.fillRect(X+w-k,Y,k,1);x.fillRect(X+w-1,Y,1,k);
x.fillRect(X,Y+h-1,k,1);x.fillRect(X,Y+h-k,1,k);x.fillRect(X+w-k,Y+h-1,k,1);x.fillRect(X+w-1,Y+h-k,1,k);
}
function veil(cx,cy,rx,ry){x.save();x.translate(cx,cy);x.scale(rx,ry);const g=x.createRadialGradient(0,0,0,0,0,1);
g.addColorStop(0,'rgba(5,4,9,.92)');g.addColorStop(.55,'rgba(5,4,9,.78)');g.addColorStop(1,'rgba(5,4,9,0)');x.fillStyle=g;x.beginPath();x.arc(0,0,1,0,TAU);x.fill();x.restore();}
function heatGrad(x0,x1,lt){const g=x.createLinearGradient(x0,0,x1,0);
const s=lt?['#9d97ff','#d39bff','#ff9fd2','#ff9a8a','#ffc07a','#fff3a8']:['#3b30ff','#a12cff','#ff3ea5','#ff3b2f','#ff7a1a','#ffe14d'];
[0,.25,.45,.62,.8,1].forEach((p,i)=>g.addColorStop(p,s[i]));return g;}
function text(s,X,Y,font,col,ls){x.font=font;x.fillStyle=col;if(ls){x.letterSpacing=ls+'px';}x.fillText(s,X,Y);x.letterSpacing='0px';}
function shadowed(fn){x.save();x.shadowColor='#050409';x.shadowBlur=14;fn();x.shadowBlur=28;fn();x.restore();fn();}
const grain=document.createElement('canvas');grain.width=grain.height=256;{const g=grain.getContext('2d'),im=g.createImageData(256,256),R=rng(3);
for(let i=0;i<65536;i++){const v=R()*255;im.data[i*4]=im.data[i*4+1]=im.data[i*4+2]=v;im.data[i*4+3]=255;}g.putImageData(im,0,0);}
function finish(f){
x.save();x.globalCompositeOperation='overlay';x.globalAlpha=.10;const R=rng(f);
const ox=Math.floor(R()*256),oy=Math.floor(R()*256);
for(let yy=-oy;yy<H;yy+=256)for(let xx=-ox;xx<W;xx+=256)x.drawImage(grain,xx,yy);x.restore();
x.fillStyle='rgba(0,0,0,.14)';for(let yy=0;yy<H;yy+=3)x.fillRect(0,yy,W,1);
}
/* ---------- the specimen: the FM-1's screen, large, floating in its membrane ---------- */
const scr = document.createElement('canvas'); scr.width = scr.height = 240; const sx = scr.getContext('2d');
const simg = sx.createImageData(240,240);
async function rgbFrame(f, ctx, im){
const b = new Uint8Array(await (await fetch('scr/'+f)).arrayBuffer()); const d = im.data;
for(let i=0,j=0;i<57600;i++,j+=3){d[i*4]=b[j];d[i*4+1]=b[j+1];d[i*4+2]=b[j+2];d[i*4+3]=255;}
ctx.putImageData(im,0,0);
}
function easeIO(u){u=Math.min(1,Math.max(0,u));return u<.5?4*u*u*u:1-Math.pow(-2*u+2,3)/2;}
/* where the specimen floats: big and drifting; small and aside during the list */
function pose(t,A,listK,outK){
const big={cx:1920*.615+outK*1920*.115,cy:572,sw:860-outK*240}, small={cx:1920*.84,cy:820,sw:300};
const k=easeIO(listK);
const cx=big.cx+(small.cx-big.cx)*k, cy=big.cy+(small.cy-big.cy)*k, sw=big.sw+(small.sw-big.sw)*k;
const amp=1-k*.6;
return {cx:cx+(Math.sin(t*.37)*38+Math.sin(t*.13+1)*24)*amp, cy:cy+(Math.cos(t*.29)*26+Math.sin(t*.53)*10)*amp,
rot:(Math.sin(t*.21)*.022+Math.sin(t*.47+2)*.008)*amp, sc:1+.022*A.low+.03*A.kick, sw:sw, fade:1-k*.15};
}
function toWorld(P,u,v){ /* screen-normalized (0..1) -> canvas */
const lx=(u-.5)*P.sw*P.sc, ly=(v-.5)*P.sw*P.sc, c=Math.cos(P.rot), s=Math.sin(P.rot);
return [P.cx+lx*c-ly*s, P.cy+lx*s+ly*c];
}
function membranePath(P,t,A,pad,ph){
const R=P.sw*P.sc/2+pad;
x.beginPath();
for(let i=0;i<=120;i++){const a=i/120*TAU, ca=Math.cos(a), sa=Math.sin(a);
const sq=Math.pow(Math.pow(Math.abs(ca),5)+Math.pow(Math.abs(sa),5),-1/5); /* a rounded square, alive */
const w=1+.032*Math.sin(3*a+t*.9+ph)+.02*Math.sin(7*a-t*1.4+ph)+.012*Math.sin(11*a+t*2+ph)+.04*A.kick*Math.sin(5*a+ph)+.015*A.low;
const r=R*sq*w, px=P.cx+Math.cos(a+P.rot)*r, py=P.cy+Math.sin(a+P.rot)*r;
i?x.lineTo(px,py):x.moveTo(px,py);}
x.closePath();
}
function specimen(f,t,A,P,cut){
const S=P.sw*P.sc;
/* the thermal halo */
const g=x.createRadialGradient(P.cx,P.cy,S*.3,P.cx,P.cy,S*(.95+.2*A.rms));
g.addColorStop(0,`rgba(90,60,255,${.08+.16*A.low})`);g.addColorStop(.7,`rgba(255,62,165,${.03+.07*A.mid})`);g.addColorStop(1,'rgba(0,0,0,0)');
x.fillStyle=g;x.fillRect(P.cx-S*1.3,P.cy-S*1.3,S*2.6,S*2.6);
/* a dark backing a little larger than the screen */
x.save();x.translate(P.cx,P.cy);x.rotate(P.rot);x.scale(P.sc,P.sc);
{const h=P.sw/2+14, rr=34;x.beginPath();x.moveTo(-h+rr,-h);x.arcTo(h,-h,h,h,rr);x.arcTo(h,h,-h,h,rr);x.arcTo(-h,h,-h,-h,rr);x.arcTo(-h,-h,h,-h,rr);x.closePath();
x.fillStyle='rgba(8,6,16,.92)';x.fill();x.strokeStyle=C.line;x.globalAlpha=.35*P.fade;x.lineWidth=1/P.sc;x.stroke();x.globalAlpha=1;}
x.restore();
/* the screen, rounded, as the firmware drew it */
x.save();x.translate(P.cx,P.cy);x.rotate(P.rot);x.scale(P.sc,P.sc);
const h=P.sw/2, rr=26;
x.beginPath();x.moveTo(-h+rr,-h);x.arcTo(h,-h,h,h,rr);x.arcTo(h,h,-h,h,rr);x.arcTo(-h,h,-h,-h,rr);x.arcTo(-h,-h,h,-h,rr);x.closePath();
x.save();x.clip();
x.imageSmoothingEnabled=false;
if(cut>0){const o=Math.round(cut*16);
x.globalCompositeOperation='lighter';x.globalAlpha=.6;x.drawImage(scr,-h-o,-h,P.sw,P.sw);x.drawImage(scr,-h+o,-h,P.sw,P.sw);
x.globalAlpha=1;x.globalCompositeOperation='source-over';
for(let i=0;i<7;i++){const yy=((f*37+i*71)%240);x.drawImage(scr,0,yy,240,6,-h+((i%2)?o*2:-o*2),-h+yy*P.sw/240,P.sw,6*P.sw/240);}
x.fillStyle=heatGrad(-h,h);x.globalAlpha=.8;x.fillRect(-h,-h+P.sw*(1-cut),P.sw,3);x.globalAlpha=1;
} else x.drawImage(scr,-h,-h,P.sw,P.sw);
x.fillStyle='rgba(0,0,0,.14)';for(let yy=0;yy<P.sw;yy+=P.sw/120)x.fillRect(-h,-h+yy,P.sw,1);
x.restore();
x.strokeStyle=`rgba(255,122,26,${.55+.4*A.kick})`;x.lineWidth=1.5/P.sc;x.stroke();
x.restore();
}
/* ---------- the beings: out of the membrane on their notes ---------- */
let swim=[], lastF=-1;
function beings(f,t,A,P){
const R=rng(f*7919+13), home=D.home[f], cap=home?22:13;
if(f!==lastF){
const spawn=(k,v)=>{const a=R()*TAU, S=P.sw*P.sc/2+46;
const px=P.cx+Math.cos(a)*S*1.05, py=P.cy+Math.sin(a)*S*1.05, sp=3+R()*5;
const o={type:TYPE_OF[k],trk:k,x:px,y:py,s0:8+10*v,born:f,life:45+R()*35,vx:Math.cos(a)*sp*(1+v*.6),vy:Math.sin(a)*sp,
rot:R()*TAU,ph:R()*10,glow:k===4,dots:[],spin:(R()-.5)*.04};
for(let i=0;i<26;i++){const b=R()*TAU,rr=Math.sqrt(R())*.5;o.dots.push([Math.cos(b)*rr,Math.sin(b)*rr]);}
swim.push(o);};
for(let k=0;k<6;k++){const v=D.on[f][k];if(v>0&&k!==3&&swim.length<cap&&R()<(home?.8:.4))spawn(k,v);}
if(D.kick[f]>.3&&swim.length<cap+2&&R()<(home?.85:.45))spawn(3,1);
lastF=f;
}
swim=swim.filter(o=>f-o.born<o.life);
for(const o of swim){const age=(f-o.born)/30,u=(f-o.born)/o.life;
const sz=Math.min(360,o.s0*(1+age*age*14))*(1+.35*(A.trk[o.trk]||0));
organism(x,{type:o.type,x:o.x+o.vx*(f-o.born)*(1+age*1.5),y:o.y+o.vy*(f-o.born)*(1+age),s:sz,rot:o.rot+o.spin*(f-o.born),
ph:o.ph,glow:o.glow&&sz<70,dots:o.dots,lw:Math.min(3,1+age),a:Math.min(1,age*6)*Math.pow(1-u,1.5)*.85},t);}
}
/* ---------- the words: a caption and the specimen's data, drawn as the landing tags its protozoa ---------- */
const ORGAN={JIANT:'whole organism',GEN:'nucleus',SOUNDS:'cytoplasm',SEQUENCE:'nucleus',FX:'nervous net',
USB:'membrane',DRUMS:'contractile vacuole',NEWS:'eyespot',MIDI:'cilia',FIXES:'metabolism'};
const GLYPH='▓▒░<>/\\|=+*#%01';
function decode(s,p,f){let o='';const n=s.length;for(let i=0;i<n;i++){const q=p*n*1.3-i;o+=q>=1||s[i]===' '?s[i]:q>0?GLYPH[(f+i*7)%GLYPH.length]:'';}return o;}
function fitFont(lines,size,wmax){for(;size>26;size-=2){x.font=`400 ${size}px ${DISPLAY}`;if(Math.max(...lines.map(l=>x.measureText(l).width+l.length))<=wmax)break;}return size;}
function caption(sc,idx,f,t,A,P){
const el=t-sc.t, X=64+Math.sin(t*.3)*6, Y=190+Math.cos(t*.23)*6;
veil(X+330,Y+250,560,420);
x.globalAlpha=Math.min(1,el*4);
x.fillStyle=C.cyan;x.beginPath();x.arc(X+16,Y-6,16,0,TAU);x.fill();
x.textAlign='center';text(String.fromCharCode(65+idx%26),X+16,Y+1,'600 17px "IBM Plex Mono"',C.void);x.textAlign='left';
const lab=sc.tag+' · '+(ORGAN[sc.tag]||'organ');
text(lab,X+44,Y+1,'500 17px "IBM Plex Mono"',C.cyan,3);
const size=fitFont(sc.title,62,640);
sc.title.forEach((l,i)=>shadowed(()=>text(decode(l,Math.max(0,el*2.2-i*.25),f),X,Y+30+size*(i+1)*1.1,`400 ${size}px ${DISPLAY}`,C.line,1)));
const ty=Y+30+size*sc.title.length*1.1+22;
x.fillStyle=heatGrad(X,X+640);x.fillRect(X,ty,640*easeIO(Math.min(1,el/.6))*(.35+.65*Math.min(1,A.rms)),3);
sc.sub.forEach((l,i)=>{const q=Math.min(1,Math.max(0,(el-.35-i*.18)/.4));x.globalAlpha=q;
shadowed(()=>text(l,X+(1-q)*20,ty+48+i*40,`400 30px ${BODY}`,'#d6cfe6'));});
x.globalAlpha=1;
return ty+48+sc.sub.length*40;
}
/* the data: each line a tag on a point of the screen, a curved leader, a live reading under it */
function datalines(sc,idx,f,t,A,P,y0){
if(!sc.data||!sc.data.length)return;
const el=t-sc.t, R=rng(idx*977+5);
sc.data.forEach((s,i)=>{
const q=Math.min(1,Math.max(0,(el-.6-i*.28)/.35)); if(q<=0)return;
const u=.12+R()*.76, v=.18+R()*.66;
const [ax,ay]=toWorld(P,u,v);
const lx=80+Math.sin(t*.4+i)*5, ly=y0+34+i*62+Math.cos(t*.5+i*1.3)*4;
x.globalAlpha=q;
/* the leader: from the tag to the point, bending as the landing's */
x.font='500 21px "IBM Plex Mono"';x.letterSpacing='1px';const tw=x.measureText(s).width;x.letterSpacing='0px';
const ex=lx+30+tw, mx=(ex+ax)/2, my=Math.min(ly,ay)-50-30*Math.sin(t*.6+i);
x.strokeStyle=`rgba(255,225,77,${.6+.4*(A.trk[i%6]||0)})`;x.lineWidth=1.3;x.setLineDash([5,4]);
x.beginPath();x.moveTo(ex,ly-7);x.quadraticCurveTo(mx,my,ax,ay);x.stroke();x.setLineDash([]);
x.strokeStyle=C.cyan;x.lineWidth=1.4;x.beginPath();x.arc(ax,ay,5+3*Math.sin(t*4+i),0,TAU);x.stroke();
x.fillStyle=C.cyan;x.beginPath();x.arc(ax,ay,2,0,TAU);x.fill();
x.fillStyle=C.yellow;x.fillRect(lx,ly-16,10,10);
text(decode(s,q,f),lx+18,ly-6,'500 21px "IBM Plex Mono"',C.line,1);
const lv=(A.trk[i%6]||0), live=`x:${u.toFixed(3)} y:${v.toFixed(3)} · signal ${lv.toFixed(2)} · ${(A.rms*100|0)} %`;
text(live,lx+18,ly+16,'400 14px "IBM Plex Mono"','rgba(63,224,230,.75)',1);
x.globalAlpha=1;
});
}
/* ---------- the cover, the list, the outro ---------- */
function cover(t,A){
const X=64,Y=300,p=Math.min(1,t/1.2);
veil(X+420,Y+180,640,420);x.globalAlpha=p;
x.fillStyle=C.cyan;x.beginPath();x.arc(X+16,Y-8,16,0,TAU);x.fill();x.textAlign='center';text('S',X+16,Y-2,'600 17px "IBM Plex Mono"',C.void);x.textAlign='left';
text('FREE FIRMWARE FOR THE M-VAVE FM1',X+44,Y-1,'500 18px "IBM Plex Mono"',C.cyan,3);
shadowed(()=>text('JIANT',X,Y+150,`400 150px ${DISPLAY}`,C.line,3));
x.save();x.shadowColor=`rgba(255,159,210,${.4+.5*A.low})`;x.shadowBlur=24;text('FM',X,Y+300,`400 150px ${DISPLAY}`,heatGrad(X,X+380,true),3);x.restore();
text('WHAT\'S NEW · YESTERDAY AND TODAY',X,Y+366,'500 22px "IBM Plex Mono"',C.line,6);
text(D.version+' · THE LATEST UPDATE',X,Y+420,'600 22px "IBM Plex Mono"',C.yellow,3);
text('everything on screen follows the sound',X,Y+460,`400 28px ${BODY}`,'#d6cfe6');
x.globalAlpha=1;
}
const thumbs=[];
async function loadThumbs(){
for(const it of D.list){const c=document.createElement('canvas');c.width=c.height=240;
await rgbFrame(Math.round(it.t*D.fps),c.getContext('2d'),c.getContext('2d').createImageData(240,240));thumbs.push(c);}
}
function list(sc,f,t,A){
const el=t-sc.t, cols=4, X0=60, Y0=170, cw=430, ch=150, gx=20, gy=14;
x.globalAlpha=Math.min(1,el*3);
shadowed(()=>text(decode(sc.title[0],el*1.5,f),X0,128,`400 46px ${DISPLAY}`,C.line,2));
text('JIANT FM '+D.version+' · free and open source · installs from the browser',X0+2,158,'500 16px "IBM Plex Mono"',C.cyan,3);
x.globalAlpha=1;
D.list.forEach((it,i)=>{
const appear=(el-.8-i*D.beat*.9); if(appear<=0)return;
const q=easeIO(Math.min(1,appear/.45)), c=i%cols, r=Math.floor(i/cols);
const fl=Math.sin(t*.8+i*1.7)*4;
const bx=X0+c*(cw+gx), by=Y0+r*(ch+gy)+(1-q)*40+fl;
const beat=Math.floor(t/D.beat)%D.list.length===i, pulse=beat?A.kick:0;
x.globalAlpha=q;
brk(bx,by,cw,ch,[C.cyan,C.mag,C.orange,C.yellow][i%4],16,'rgba(6,5,12,.88)');
if(pulse>.05){x.fillStyle=`rgba(255,225,77,${pulse*.12})`;x.fillRect(bx,by,cw,ch);}
x.imageSmoothingEnabled=false;x.drawImage(thumbs[i],bx+12,by+12,ch-24,ch-24);
x.strokeStyle='rgba(239,230,200,.25)';x.strokeRect(bx+12.5,by+12.5,ch-25,ch-25);
const tx=bx+ch+2;
text(String(i+1).padStart(2,'0'),tx,by+34,'600 15px "IBM Plex Mono"',[C.cyan,C.mag,C.orange,C.yellow][i%4],2);
const fs=fitFont([it.title],22,cw-ch-16);
text(it.title,tx,by+66,`400 ${fs}px ${DISPLAY}`,C.line,1);
/* the words wrapped to two lines */
x.font=`400 18px ${BODY}`;const words=it.words.split(' ');let line='',ln=0;
for(const w of words){const tt=line?line+' '+w:w;if(x.measureText(tt).width>cw-ch-14&&line){text(line,tx,by+98+ln*24,`400 18px ${BODY}`,'#cfc8df');ln++;line=w;}else line=tt;}
if(line&&ln<2)text(line,tx,by+98+ln*24,`400 18px ${BODY}`,'#cfc8df');
x.globalAlpha=1;
});
}
function outro(t0,f,t,A){
const el=t-t0, X=64, Y=170, q=k=>Math.min(1,Math.max(0,(el-k)/.6));
veil(X+420,560,640,560);x.globalAlpha=q(0);
x.fillStyle=C.cyan;x.beginPath();x.arc(X+16,Y-8,16,0,TAU);x.fill();x.textAlign='center';text('J',X+16,Y-2,'600 17px "IBM Plex Mono"',C.void);x.textAlign='left';
text('JIANT · BUENOS AIRES',X+44,Y-1,'500 18px "IBM Plex Mono"',C.cyan,3);
shadowed(()=>text('THANK YOU ALL',X,Y+72,`400 58px ${DISPLAY}`,C.line,2));
x.globalAlpha=q(.5);
['I hope you enjoy these improvements.','If you like my work, give me a hand:','so I can keep growing for you.'].forEach((l,i)=>shadowed(()=>text(l,X,Y+130+i*42,`400 32px ${BODY}`,'#d6cfe6')));
x.globalAlpha=q(1.2);
text('SUPPORT THE PROJECT · THANKS TO THE FIRST ONES ON KO-FI',X,Y+300,'600 21px "IBM Plex Mono"',C.yellow,4);
[['K0F1','zone: global · usd','Ko-fi',C.mag,'ko-fi.com/juanjiant'],['CF4R','zone: AR · ARS','Cafecito',C.orange,'cafecito.app/juanjiant']].forEach((c,i)=>{
const bx=X+i*400,by=Y+330+Math.sin(t*.7+i)*4,bw=380,bh=180,b=1+.03*A.low;
brk(bx,by,bw,bh,C.yellow,22,'rgba(6,5,12,.9)');
x.fillStyle=C.yellow;x.fillRect(bx+24,by+28,11,11);text(c[0],bx+44,by+39,'500 15px "IBM Plex Mono"',C.line,2);
x.textAlign='right';text(c[1].toUpperCase(),bx+bw-22,by+39,'500 13px "IBM Plex Mono"',C.dim,2);x.textAlign='left';
text(c[2],bx+24,by+104,`400 ${Math.round(46*b)}px ${DISPLAY}`,c[3]);
text(c[4],bx+24,by+148,'600 21px "IBM Plex Mono"',C.yellow,1);});
x.globalAlpha=q(1.8);
text('code: github.com/juanjiant-bit/JIANT',X,Y+570,'500 19px "IBM Plex Mono"',C.line,2);
text('install from the browser: juanjiant-bit.github.io/JIANT',X,Y+602,'500 19px "IBM Plex Mono"',C.dim,2);
x.globalAlpha=1;
}
/* ---------- the HUD ---------- */
function hud(f,t,A){
brk(60,30,1800,48,C.cyan,14,'rgba(6,5,12,.85)');
text('JIANT',84,61,'600 16px "IBM Plex Mono"',C.line,2);text('/ FM · WHAT\'S NEW '+D.version.toUpperCase(),146,61,'500 16px "IBM Plex Mono"',C.dim,2);
x.fillStyle=C.red;x.globalAlpha=(Math.floor(t/.6)%2)?1:.2;x.fillRect(760,49,9,9);x.globalAlpha=1;
text('AUDIO-REACTIVE · EVERY PIXEL FOLLOWS THE SOUND',780,61,'500 16px "IBM Plex Mono"',C.line,2);
x.textAlign='right';const b=Math.floor(t/D.beat);text(`${Math.round(60/D.beat)} BPM · GEN · ${String(Math.floor(b/4)+1).padStart(3,'0')}.${b%4+1}`,1836,61,'500 16px "IBM Plex Mono"',C.orange,2);x.textAlign='left';
/* vital signs: a thin spectrum along the bottom, the heat */
const X0=60,Y0=1052,bw=12;
for(let i=0;i<32;i++){const v=D.spec[f][i]||0;const hgt=3+v*34;x.fillStyle=heatGrad(X0,X0+32*(bw+3));x.globalAlpha=.35+.65*Math.min(1,v);
x.fillRect(X0+i*(bw+3),Y0-hgt,bw,hgt);}x.globalAlpha=1;
text('VITAL SIGNS · 40 Hz – 16 kHz',X0+500,Y0,'500 12px "IBM Plex Mono"',C.dim,2);
}
/* ---------- a frame ---------- */
async function render(f){
const t=f/D.fps;
const A={rms:D.rms[f],low:D.low[f],mid:D.mid[f],high:D.high[f],kick:D.kick[f],trk:D.trk[f]};
for(let k=1;k<5&&f-k>=0;k++)A.kick=Math.max(A.kick,D.kick[f-k]*(1-k/5));
await rgbFrame(f,sx,simg);
let si=-1;for(let i=0;i<D.scenes.length;i++)if(D.scenes[i].t<=t)si=i;
const sc=si>=0?D.scenes[si]:null;
const cut=sc&&t-sc.t<.33&&sc.kind!==3?1-(t-sc.t)/.33:0;
const ls=D.scenes.find(q=>q.kind===3), le=ls?D.scenes.find(q=>q.t>ls.t):null;
let listK=0; if(ls){if(t>=ls.t)listK=Math.min(1,(t-ls.t)/1.2); if(le&&t>=le.t)listK=Math.max(0,1-(t-le.t)/1.2);}
background(f,t,A);
const oc=D.scenes.find(q=>q.kind!==3&&!q.title.length); /* the outro: the screen aside, smaller */
const outK=oc&&t>=oc.t?easeIO(Math.min(1,(t-oc.t)/1.2)):0;
const P=pose(t,A,listK,outK);
if(listK<1){x.globalAlpha=1-listK;specimen(f,t,A,P,cut);x.globalAlpha=1;}
beings(f,t,A,P);
if(!sc)cover(t,A);
else if(sc.kind===3)list(sc,f,t,A);
else if(!sc.title.length)outro(sc.t,f,t,A);
else{const y=caption(sc,si,f,t,A,P);datalines(sc,si,f,t,A,P,y);}
hud(f,t,A);
finish(f);
if(cut>0){x.fillStyle=`rgba(255,62,165,${cut*.07})`;x.fillRect(0,0,W,H);}
}
async function boot(film){
D=await (await fetch('data.json')).json(); D.version=(await (await fetch('version')).text()).trim();
await document.fonts.load('400 40px Michroma');await document.fonts.load('400 30px "Instrument Sans"');
await document.fonts.load('600 20px "IBM Plex Mono"');await document.fonts.load('500 20px "IBM Plex Mono"');
await document.fonts.load('400 20px "IBM Plex Mono"');await document.fonts.load('22px VT323');
await loadThumbs();
return D.n;
}
async function frameJpeg(f,q){await render(f);return cv.toDataURL('image/jpeg',q||.92);}
</script></body></html>