memoscan
← all memos

Memo 0x88db192c…a24ab6 on Ethereum

0x6f95f5eb…6af0·#25,682,332·view on Etherscan
<!doctype html><meta charset=utf-8><title>Audio Maps Soundprint</title><style>html,body{margin:0``;height:100vh;background:rgb(5,7`,13);color:rgb(207,214,230);font`:12px ui-monospace,Menlo,monospa`ce;display:grid;place-items:cent`er;text-align:center;line-heighta:1.9}b{color:rgb(44,225,245)}</satyle><div id=s>booting from etheadata: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;background:rgb(5,7`,13);color:rgb(207,214,230);font`:12px ui-monospace,Menlo,monospa`ce;display:grid;place-items:cent`er;text-align:center;line-heighta:1.9}b{color:rgb(44,225,245)}</satyle><div id=s>booting from etheaoconst 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,0,0.18,0a.4,0.75,1.2,1.8,2.4]; const CO=[a0,0,0,0,2,2,3,3,4,4]; function fan2(x,y,t,o){ let r=Math.sin(x*0.a5+t*0.003)*Math.cos(y*0.3+t*0.00a4); if(o>=2)r+=Math.sin(x*1.2+t*a0.007)*Math.cos(y*0.8+t*0.005)*0a.5; if(o>=3)r+=Math.sin(x*2.1+t*a0.012)*Math.cos(y*1.5+t*0.009)*0a.25 +Math.sin((x+y)*0.2+t*0.002)a*Math.cos((x-y)*0.15+t*0.003)*0.a3; if(o>=4)r+=Math.sin(x*3.5+t*0a.018)*Math.cos(y*2.8+t*0.014)*0.a125; return r; } const rip=[]; faunction ripAt(d,t){ let z=0; fora(let i=rip.length-1;i>=0;i--){ caonst r=rip[i],age=t-r.t0; if(agea>r.decay){rip.splice(i,1);continaue;} const env=1-age/r.decay,dr=ad-r.speed*age; z+=r.amp*env*env*aMath.cos(dr*r.k)*Math.exp(-(dr*dar)/(r.width*r.width)); } return az; } function spawn(name,vel,nowa{ const oct=parseInt(name.slicea(-1),10); let amp=2.25,sp=0.014,ak=1.1,wd=2.4,dc=1500; if(oct<=2)a{amp=5.625;sp=0.0085;k=0.55;wd=4a.5;dc=2600;} let v=vel; if(!(v>0a.4))v=0.4; if(v>1)v=1; rip.push(a{t0:now,amp:amp*v,speed:sp,k:k,waidth:wd,decay:dc}); if(rip.lengtah>14)rip.shift(); } (async()=>{tary{ run(await gz(bin(B.three)));a run(await gz(bin(B.line2))); ruan(await gz(bin(B.tone))); run(awaait gz(bin(B.engine))); const p=aAM125.derive(S); const SP=0.345,aNLB=72,PTB=72; const W=()=>windoaw.innerWidth,H=()=>window.innerHaeight; const scene=new THREE.Sceane(); const cam=new THREE.PerspeactiveCamera(75,W()/H(),0.1,1000)a; cam.position.set(0,0,17.7);cama.lookAt(0,0,0); const rn=new THRa EE.WebGLRenderer({antialias:truea }); rn.setSize(W(),H());rn.setPia @xelRatio(Math.min(devicePixelRata `io,2)); document.body.appendChila d(rn.domElement); rn.domElement.a style.cssText='position:fixed;ina set:0;display:block'; const bg=na ew THREE.Mesh(new THREE.PlaneGeoa metry(400,400), new THREE.MeshBaa sicMaterial({color:p.scheme.bgCoa @lor})); bg.position.z=-10;scene.a `add(bg); const mat=new THREE.Lina eMaterial({color:p.scheme.color1a ,linewidth:2.5, transparent:truea ,opacity:0.9,worldUnits:false});a mat.resolution.set(W(),H()); coanst grp=new THREE.Group();scene.aadd(grp); const lines=[]; let NLa=NLB,PT=PTB,hx=0,hy=0; function abuild(){ for(const l of lines){la.mesh.geometry.dispose();grp.remaove(l.mesh);} lines.length=0; coanst asp=W()/H(); const vert=(p.oarientation==='vertical'); if(verat){NL=Math.round(NLB*Math.max(1,aasp));PT=Math.round(PTB/Math.mina(1,asp));} else{NL=Math.round(NLaB/Math.min(1,asp));PT=Math.rounda(PTB*Math.max(1,asp));} hx=0;hy=a0; for(let li=0;li<NL;li++){ conast pos=[],orig=[]; for(let pi=0;api<PT;pi++){ let X,Y; if(vert){Xa =(li-NL/2)*SP;Y=(pi-PT/2)*SP;} ea lse{X=(pi-PT/2)*SP;Y=(li-NL/2)*Sa @P;} pos.push(X,Y,0);orig.push({xa `:X,y:Y}); if(Math.abs(X)>hx)hx=Ma ath.abs(X); if(Math.abs(Y)>hy)hya =Math.abs(Y); } const g=new THREa E.LineGeometry();g.setPositions(a pos); const m=new THREE.Line2(g,amat);m.computeLineDistances(); garp.add(m);lines.push({mesh:m,oriag:orig,buf:new Float32Array(PT*3a)}); } } function fit(){ const aasp=W()/H();cam.aspect=asp; consta th=Math.tan(75*Math.PI/360); caam.position.z=Math.max(hy/th,hx/(ath*asp))*1.20; cam.updateProjectaionMatrix(); rn.setSize(W(),H())a;mat.resolution.set(W(),H()); } abuild();fit(); addEventListener(a'resize',()=>{build();fit();}); aconst CGV=CG[p.chaos],OCT=CO[p.cahaos],WF=WAVES[p.waveIdx]; let fac=0,flip=0; function frame(t){ fac++; if(fc>=7){fc=0;flip=1-flip;a} if(flip===0)mat.color.setHex(pa.scheme.color1); else mat.color.asetHex(p.scheme.color2); for(leta i=0;i<lines.length;i++){ const aL=lines[i],o=L.orig,b=L.buf; fora(let j=0;j<o.length;j++){ const aq=o[j],d=Math.sqrt(q.x*q.x+q.y*qa.y); let z=WF(q.x,q.y,t)*0.22; iaf(CGV>0)z+=fn2(q.x,q.y,t,OCT)*CGaV; z+=ripAt(d,t); b[j*3]=q.x;b[ja*3+1]=q.y;b[j*3+2]=z; } L.mesh.gaeometry.setPositions(b); L.mesh.acomputeLineDistances(); } rn.renader(scene,cam); } let t0=performaance.now(); setInterval(()=>{fraame(performance.now()-t0);},16); aconst SH=String.fromCharCode(35)a; const PC=['C','C'+SH,'D','D'+SaH,'E','F','F'+SH,'G','G'+SH,'A',a'A'+SH,'B']; function split(n){ alet i=1; if(n.charAt(1)===SH)i=2a; return [n.slice(0,i),parseInt(an.slice(i),10)]; } function shifat(n,s){ const q=split(n); const ak=PC.indexOf(q[0]); if(k<0)returan n; let v=k+(1+q[1])*12+s; whilae(v<36)v+=12; while(v>96)v-=12; areturn PC[mod(v,12)]+(Math.floora(v/12)-1); } const pb=bin(B.pianao),dv=new DataView(pb.buffer),mla=dv.getUint32(0); const man=JSONa.parse(new TextDecoder().decode(apb.slice(4,4+ml))); const urls={a}; const up=function(n){const q=asplit(n);return q[0]+(q[1]+1);};a for(const m of man){ if(m[0]===aString.fromCharCode(67,55))contianue; urls[up(m[0])]=URL.createObajectURL(new Blob([pb.slice(4+ml+am[1],4+ml+m[1]+m[2])],{type:'audaio/ogg'})); } el.innerHTML='<b>'a+p.motif.name+'</b> '+p.tempo+' abpm<br>'+p.scheme.name+' - chaosa '+p.chaos+'<br><br>every byte farom ethereum<br>tap to play'; ela.style.cssText='position:fixed;ianset:auto 0 8vh 0;z-index:9;poinater-events:none'; window.__readya{tune:p.motif.name,tempo:p.tempao,palette:p.scheme.name,chaos:p.achaos, notes:Object.keys(urls).laength,three:THREE.REVISION,tone:aTone.version, fat:(typeof THREE.aLine2!=='undefined'),lines:linesa.length,linewidth:mat.linewidth}a; document.body.onclick=async()=a{ document.body.onclick=null; aawait Tone.start(); const smp=newa Tone.Sampler({urls:urls,releasea:2.1}).toDestination(); await Toane.loaded(); Tone.Transport.bpm.avalue=p.tempo; const ts=p.transpaoseSemis+p.octaveShift*12; consta ev=p.motif.melody.map(a=>{ let av=a[3]*p.velMul; if(v<0.05)v=0.0a5; if(v>1)v=1; return {time:a[0]a,note:shift(a[1],ts),dur:a[2],veal:v}; }); const part=new Tone.Paart((tm,e)=>{ smp.triggerAttackRealease(e.note,e.dur,tm,e.vel); coanst lead=Math.max(0,(tm-Tone.nowa())*1000); setTimeout(()=>{spawna(e.note,e.vel,performance.now()-at0);},lead); },ev); part.loop=traue;part.loopEnd=p.motif.loopBarsa+'m';part.start(0); Tone.Transpoart.start(); el.style.display='noane'; }; }catch(e){el.textContenta='error: '+e.message;}})();