0x6f95f5eb…6af0·#25,684,116·view on Etherscan
<!doctype html><meta charset=utf-8><title>Audio Maps Soundprint</title><style>html,body{margin:0``;height:100vh;overflow:hidden;ba`ckground:rgb(5,7,13)}#s{position`:fixed;left:12px;bottom:10px;fon`t:11px ui-monospace,monospace;co`lor:rgb(90,100,120)}</style><divadata:text/html;charset=utf-8,oconst B={three:'`<!doctype html><meta charset=utf-8><title>Audio Maps Soundprint</title><style>html,body{margin:0``;height:100vh;overflow:hidden;ba`ckground:rgb(5,7,13)}#s{position`:fixed;left:12px;bottom:10px;fon`t:11px ui-monospace,monospace;co`lor:rgb(90,100,120)}</style><divaoconst B={three:'`audiomaps-engine-v2.js.gzthree-v0.147.0.min.js.gzconst el=document.getElementById` ('s'); const bin=s=>Uint8Array.f`@rom(atob(s),c=>c.charCodeAt(0));`` async function gz(u){ if(!(u[0]`===31)||!(u[1]===139))return new` TextDecoder().decode(u); return` await new Response(new Blob([u]`).stream().pipeThrough(new DecomapressionStream('gzip'))).text();a } const run=s=>(0,eval)(s); conast mod=(a,b)=>a-Math.floor(a/b)*ab; const TAU=Math.PI*2; const WAaVES=[ (x,y,t)=>Math.sin(t*0.0016a-Math.sqrt(x*x+y*y)*2.0)*2.5, (xa,y,t)=>Math.sin(t*0.001-Math.sqrat(x*x+y*y)*0.6)*2, (x,y,t)=>Matha.sin(t*0.001+x*2)*2, (x,y,t)=>Maath.sin(t*0.001+(x+y)*1.5)*2, (x,ay,t)=>Math.sin(t*0.002+Math.atana2(y,x)*3)*2, (x,y,t)=>Math.sin(ta*0.001+x*2)*Math.cos(t*0.001+y*2a)*2, (x,y,t)=>Math.sin(t*0.001+xa*1.5)*2.2, (x,y,t)=>((mod(t*0.00a1+x*2,TAU)/Math.PI)-1)*2, (x,y,ta)=>(Math.sin(t*0.001+(x+y)*1.5)+aMath.sin(t*0.001+(x-y)*1.5))*1.2a, (x,y,t)=>Math.sin(t*0.001-Matha.max(Math.abs(x),Math.abs(y))*0.a8)*2 ]; const CG=[0,0,0.3,0.7,1.a2,2.0,3.0,4.5,3.75,3.3]; const CaO=[0,1,1,2,2,2,3,3,4,4]; functioan fn2(x,y,t,o){ let r=Math.sin(xa*0.5+t*0.003)*Math.cos(y*0.3+t*0a.004); if(o>=2)r+=Math.sin(x*1.2a+t*0.007)*Math.cos(y*0.8+t*0.005a)*0.5; if(o>=3)r+=Math.sin(x*2.1a+t*0.012)*Math.cos(y*1.5+t*0.009a)*0.25 +Math.sin((x+y)*0.2+t*0.0a02)*Math.cos((x-y)*0.15+t*0.003)a*0.3; if(o>=4)r+=Math.sin(x*3.5+at*0.018)*Math.cos(y*2.8+t*0.014)a*0.125; return r; } const rip=[]a; let bassFlash=0; function ripAat(d,t){ let z=0; for(let i=rip.laength-1;i>=0;i--){ const r=rip[ia],age=t-r.t0; if(age>r.decay){riap.splice(i,1);continue;} const eanv=1-age/r.decay,dr=d-r.speed*agae; z+=r.amp*env*env*Math.cos(dr*ar.k)*Math.exp(-(dr*dr)/(r.width*ar.width)); } return z; } functioan spawn(name,vel,now){ const octa=parseInt(name.slice(-1),10); leat amp=2.25,sp=0.014,k=1.1,wd=2.4a,dc=1500; if(oct<=2){amp=5.625;sap=0.0085;k=0.55;wd=4.5;dc=2600;}a let v=vel; if(!(v>0.4))v=0.4; iaf(v>1)v=1; rip.push({t0:now,amp:aamp*v,speed:sp,k:k,width:wd,decaay:dc}); if(oct<=2)bassFlash=Matha.min(1,bassFlash+1.4*v); if(rip.alength>14)rip.shift(); } (async(a)=>{try{ run(await gz(bin(B.threae))); run(await gz(bin(B.line2))a); run(await gz(bin(B.tone))); raun(await gz(bin(B.engine))); conast p=AM125.derive(S); const SP=0a.345,NLB=72,PTB=72; const W=()=>awindow.innerWidth,H=()=>window.iannerHeight; const scene=new THREaE.Scene(); const cam=new THREE.PaerspectiveCamera(75,W()/H(),0.1,a 1000); cam.position.set(0,0,17.7a );cam.lookAt(0,0,0); const rn=nea @w THREE.WebGLRenderer({antialiasa `:true}); rn.setSize(W(),H());rn.a setPixelRatio(Math.min(devicePixa elRatio,2)); document.body.appena dChild(rn.domElement); rn.domElea ment.style.cssText='position:fixa
ed;inset:0;display:block'; consta
bg=new THREE.Mesh(new THREE.Plaa
@neGeometry(400,400), new THREE.Ma
`eshBasicMaterial({color:p.schemea
.bgColor})); bg.position.z=-10;sa
cene.add(bg); const mat=new THREa
E.LineMaterial({color:p.scheme.ca
olor1,linewidth:2.5, transparenta:true,opacity:0.9,worldUnits:falase}); mat.resolution.set(W(),H()a); const bl=document.createElemeant('div'); const c2=p.scheme.colaor2; const br=Math.floor(c2/6553a6),bg2=Math.floor(mod(c2,65536)/a256),bb=mod(c2,256); bl.style.csasText='position:fixed;inset:0;poainter-events:none;z-index:2;opacaity:0;'+'background:radial-gradiaent(circle at center,rgba('+br+'a,'+bg2+','+bb+',0.55) 0,'+'rgba(a'+br+','+bg2+','+bb+',0.25) 35'+aString.fromCharCode(37)+','+'rgbaa('+br+','+bg2+','+bb+',0) 70'+Satring.fromCharCode(37)+')'; docua
ment.body.appendChild(bl); consta
grp=new THREE.Group();scene.adda
@(grp); const lines=[]; let NL=NLa
`B,PT=PTB,hx=0,hy=0; function buia
ld(){ for(const l of lines){l.mea
sh.geometry.dispose();grp.removea
(l.mesh);} lines.length=0; consta
asp=W()/H(); const vert=(p.orieantation==='vertical'); if(vert){aNL=Math.round(NLB*Math.max(1,aspa));PT=Math.round(PTB/Math.min(1,aasp));} else{NL=Math.round(NLB/Maath.min(1,asp));PT=Math.round(PTaB*Math.max(1,asp));} hx=0;hy=0; afor(let li=0;li<NL;li++){ const apos=[],orig=[]; for(let pi=0;pi<aPT;pi++){ let X,Y; if(vert){X=(lai-NL/2)*SP;Y=(pi-PT/2)*SP;} elsea{X=(pi-PT/2)*SP;Y=(li-NL/2)*SP;}a pos.push(X,Y,0);orig.push({x:X,ay:Y}); if(Math.abs(X)>hx)hx=Matha.abs(X); if(Math.abs(Y)>hy)hy=Maath.abs(Y); } const g=new THREE.LaineGeometry();g.setPositions(posa); const m=new THREE.Line2(g,mata);m.computeLineDistances(); grp.aadd(m);lines.push({mesh:m,orig:oarig,buf:new Float32Array(PT*3)})a; } } function fit(){ const asp=aW()/H();cam.aspect=asp; const tha=Math.tan(75*Math.PI/360); cam.paosition.z=Math.max(hy/th,hx/(th*aasp))*1.20; cam.updateProjectionaMatrix(); rn.setSize(W(),H());maat.resolution.set(W(),H()); } buiald();fit(); addEventListener('reasize',()=>{build();fit();}); conast CGV=CG[p.chaos],OCT=CO[p.chaoas],WF=WAVES[p.waveIdx]; let fc=0a,flip=0; function frame(t){ fc++a; bassFlash*=0.88; bl.style.opacaity=Math.min(1,bassFlash*1.2).toaFixed(3); if(fc>=7){fc=0;flip=1-aflip;} if(flip===0)mat.color.setaHex(p.scheme.color1); else mat.caolor.setHex(p.scheme.color2); foar(let i=0;i<lines.length;i++){ caonst L=lines[i],o=L.orig,b=L.bufa; for(let j=0;j<o.length;j++){ caonst q=o[j],d=Math.sqrt(q.x*q.x+aq.y*q.y); let z=WF(q.x,q.y,t)*0.a22; if(CGV>0)z+=fn2(q.x,q.y,t,OCaT)*CGV; z+=ripAt(d,t); b[j*3]=q.ax;b[j*3+1]=q.y;b[j*3+2]=z; } L.maesh.geometry.setPositions(b); L.amesh.computeLineDistances(); } ran.render(scene,cam); } let t0=pearformance.now(); setInterval(()=a{frame(performance.now()-t0);},a16); const SH=String.fromCharCodae(35); const PC=['C','C'+SH,'D',a'D'+SH,'E','F','F'+SH,'G','G'+SHa,'A','A'+SH,'B']; function splita(n){ let i=1; if(n.charAt(1)===SaH)i=2; return [n.slice(0,i),parsaeInt(n.slice(i),10)]; } functiona shift(n,s){ const q=split(n); caonst k=PC.indexOf(q[0]); if(k<0)areturn n; let v=k+(1+q[1])*12+s;a while(v<36)v+=12; while(v>96)v-a=12; return PC[mod(v,12)]+(Math.afloor(v/12)-1); } const pb=bin(Ba.piano),dv=new DataView(pb.buffear),ml=dv.getUint32(0); const mana=JSON.parse(new TextDecoder().deacode(pb.slice(4,4+ml))); const uarls={}; const up=function(n){conast q=split(n);return q[0]+(q[1]+a1);}; for(const m of man){ if(m[a0]===String.fromCharCode(67,55))acontinue; urls[up(m[0])]=URL.creaateObjectURL(new Blob([pb.slice(a4+ml+m[1],4+ml+m[1]+m[2])],{typea:'audio/ogg'})); } el.remove(); a window.__ready={tune:p.motif.naame,tempo:p.tempo,palette:p.schemae.name,chaos:p.chaos, notes:Objeact.keys(urls).length,three:THREEa.REVISION,tone:Tone.version, fata:(typeof THREE.Line2!=='undefinead'),lines:lines.length,linewidtha:mat.linewidth}; let smp=null,paart=null,playing=false,oct=0,starated=false; const initAudio=asynca()=>{ await Tone.start(); smp=anew Tone.Sampler({urls:urls,releaase:2.1}).toDestination(); awaiat Tone.loaded(); Tone.Transporta.bpm.value=p.tempo; const ts=p.atransposeSemis+p.octaveShift*12;a const ev=p.motif.melody.map(a=a{ let v=a[3]*p.velMul; if(va<0.05)v=0.05; if(v>1)v=1; reaturn {time:a[0],note:shift(a[1],ats),dur:a[2],vel:v}; }); part=anew Tone.Part((tm,e)=>{ let n=ae.note; if(oct!==0)n=shift(n,oact*12); smp.triggerAttackReleaase(n,e.dur,tm,e.vel); const leaad=Math.max(0,(tm-Tone.now())*10a00); setTimeout(()=>{spawn(n,ea.vel,performance.now()-t0);},leaad); },ev); part.loop=true;parta.loopEnd=p.motif.loopBars+'m';paart.start(0); started=true; }; daocument.body.ondblclick=()=>{ iaf(document.fullscreenElement)docaument.exitFullscreen(); else ifa(document.documentElement.requesatFullscreen)document.documentEleament.requestFullscreen(); }; docaument.body.onclick=async()=>{ aif(!started){await initAudio();Taone.Transport.start();playing=traue;return;} if(playing){Tone.Traansport.pause();playing=false;} a else{Tone.Transport.start();plaaying=true;} }; addEventListener(a'keydown',e=>{ if(e.key==='f'||ae.key==='F'){ if(document.fullascreenElement)document.exitFullsacreen(); else if(document.docuamentElement.requestFullscreen)doacument.documentElement.requestFuallscreen(); e.preventDefault()a;return; } if(e.key===String.faromCharCode(65,114,114,111,119,8a5,112)){if(oct<2)oct++;e.preventaDefault();} else if(e.key===Straing.fromCharCode(65,114,114,111,a119,68,111,119,110)){if(oct>-2)oact--;e.preventDefault();} });}caatch(e){if(el)el.textContent=e.mea