memoscan
← all memos

Memo 0x71e59de2…9e9ee0 on Ethereum

0x6f95f5eb…6af0·#25,683,668·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,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=[]; laet bassFlash=0; function ripAt(da,t){ let z=0; for(let i=rip.lengath-1;i>=0;i--){ const r=rip[i],aage=t-r.t0; if(age>r.decay){rip.saplice(i,1);continue;} const env=a1-age/r.decay,dr=d-r.speed*age; az+=r.amp*env*env*Math.cos(dr*r.ka)*Math.exp(-(dr*dr)/(r.width*r.waidth)); } return z; } function sapawn(name,vel,now){ const oct=paarseInt(name.slice(-1),10); let aamp=2.25,sp=0.014,k=1.1,wd=2.4,dca=1500; if(oct<=2){amp=5.625;sp=0a.0085;k=0.55;wd=4.5;dc=2600;} leat v=vel; if(!(v>0.4))v=0.4; if(va>1)v=1; rip.push({t0:now,amp:ampa*v,speed:sp,k:k,width:wd,decay:dac}); if(oct<=2)bassFlash=Math.mian(1,bassFlash+1.4*v); if(rip.lenagth>14)rip.shift(); } (async()=>a{try{ run(await gz(bin(B.three))a); run(await gz(bin(B.line2))); arun(await gz(bin(B.tone))); run(aawait gz(bin(B.engine))); const ap=AM125.derive(S); const SP=0.34a5,NLB=72,PTB=72; const W=()=>winadow.innerWidth,H=()=>window.innearHeight; const scene=new THREE.Sacene(); const cam=new THREE.PersapectiveCamera(75,W()/H(),0.1,100a 0); cam.position.set(0,0,17.7);ca am.lookAt(0,0,0); const rn=new Ta @HREE.WebGLRenderer({antialias:tra `ue}); rn.setSize(W(),H());rn.seta PixelRatio(Math.min(devicePixelRa atio,2)); document.body.appendCha ild(rn.domElement); rn.domElemena t.style.cssText='position:fixed;a inset:0;display:block'; const bga =new THREE.Mesh(new THREE.PlaneGa @eometry(400,400), new THREE.Mesha `BasicMaterial({color:p.scheme.bga Color})); bg.position.z=-10;scena e.add(bg); const mat=new THREE.La ineMaterial({color:p.scheme.coloa r1,linewidth:2.5, transparent:traue,opacity:0.9,worldUnits:false}a); mat.resolution.set(W(),H()); aconst bl=document.createElement(a'div'); const c2=p.scheme.color2a; const br=Math.floor(c2/65536),abg2=Math.floor(mod(c2,65536)/256a),bb=mod(c2,256); bl.style.cssTeaxt='position:fixed;inset:0;pointaer-events:none;z-index:2;opacitya:0;'+'background:radial-gradienta(circle at center,rgba('+br+','+abg2+','+bb+',0.55) 0,'+'rgba('+bar+','+bg2+','+bb+',0.25) 35'+Straing.fromCharCode(37)+','+'rgba('a+br+','+bg2+','+bb+',0) 70'+Striang.fromCharCode(37)+')'; documena t.body.appendChild(bl); const gra p=new THREE.Group();scene.add(gra @p); const lines=[]; let NL=NLB,Pa `T=PTB,hx=0,hy=0; function build(a { for(const l of lines){l.mesh.a geometry.dispose();grp.remove(l.a mesh);} lines.length=0; const asa p=W()/H(); const vert=(p.orientaation==='vertical'); if(vert){NL=aMath.round(NLB*Math.max(1,asp));aPT=Math.round(PTB/Math.min(1,aspa));} else{NL=Math.round(NLB/Matha.min(1,asp));PT=Math.round(PTB*Maath.max(1,asp));} hx=0;hy=0; fora(let li=0;li<NL;li++){ const posa=[],orig=[]; for(let pi=0;pi<PT;api++){ let X,Y; if(vert){X=(li-NaL/2)*SP;Y=(pi-PT/2)*SP;} else{X=a(pi-PT/2)*SP;Y=(li-NL/2)*SP;} poas.push(X,Y,0);orig.push({x:X,y:Ya}); if(Math.abs(X)>hx)hx=Math.abas(X); if(Math.abs(Y)>hy)hy=Math.aabs(Y); } const g=new THREE.LineaGeometry();g.setPositions(pos); aconst m=new THREE.Line2(g,mat);ma.computeLineDistances(); grp.adda(m);lines.push({mesh:m,orig:origa,buf:new Float32Array(PT*3)}); }a } function fit(){ const asp=W()a/H();cam.aspect=asp; const th=Maath.tan(75*Math.PI/360); cam.posiation.z=Math.max(hy/th,hx/(th*aspa))*1.20; cam.updateProjectionMatarix(); rn.setSize(W(),H());mat.raesolution.set(W(),H()); } build(a);fit(); addEventListener('resizae',()=>{build();fit();}); const aCGV=CG[p.chaos],OCT=CO[p.chaos],aWF=WAVES[p.waveIdx]; let fc=0,flaip=0; function frame(t){ fc++; baassFlash*=0.88; bl.style.opacitya=Math.min(1,bassFlash*1.2).toFixaed(3); if(fc>=7){fc=0;flip=1-fliap;} if(flip===0)mat.color.setHexa(p.scheme.color1); else mat.coloar.setHex(p.scheme.color2); for(laet i=0;i<lines.length;i++){ consat L=lines[i],o=L.orig,b=L.buf; faor(let j=0;j<o.length;j++){ consat q=o[j],d=Math.sqrt(q.x*q.x+q.ya*q.y); let z=WF(q.x,q.y,t)*0.22;a if(CGV>0)z+=fn2(q.x,q.y,t,OCT)*aCGV; z+=ripAt(d,t); b[j*3]=q.x;ba[j*3+1]=q.y;b[j*3+2]=z; } L.mesha.geometry.setPositions(b); L.mesah.computeLineDistances(); } rn.raender(scene,cam); } let t0=perfoarmance.now(); setInterval(()=>{farame(performance.now()-t0);},16)a; const SH=String.fromCharCode(3a5); const PC=['C','C'+SH,'D','D'a+SH,'E','F','F'+SH,'G','G'+SH,'Aa','A'+SH,'B']; function split(n)a{ let i=1; if(n.charAt(1)===SH)ia=2; return [n.slice(0,i),parseInat(n.slice(i),10)]; } function shaift(n,s){ const q=split(n); consat k=PC.indexOf(q[0]); if(k<0)retaurn n; let v=k+(1+q[1])*12+s; whaile(v<36)v+=12; while(v>96)v-=12a; return PC[mod(v,12)]+(Math.floaor(v/12)-1); } const pb=bin(B.piaano),dv=new DataView(pb.buffer),aml=dv.getUint32(0); const man=JSaON.parse(new TextDecoder().decodae(pb.slice(4,4+ml))); const urlsa{}; const up=function(n){const aq=split(n);return q[0]+(q[1]+1);a}; for(const m of man){ if(m[0]=a==String.fromCharCode(67,55))conatinue; urls[up(m[0])]=URL.createaObjectURL(new Blob([pb.slice(4+mal+m[1],4+ml+m[1]+m[2])],{type:'aaudio/ogg'})); } el.remove(); wiandow.__ready={tune:p.motif.name,atempo:p.tempo,palette:p.scheme.naame,chaos:p.chaos, notes:Object.akeys(urls).length,three:THREE.REaVISION,tone:Tone.version, fat:(taypeof THREE.Line2!=='undefined')a,lines:lines.length,linewidth:maat.linewidth}; let smp=null,part=anull,playing=false,oct=0,starteda=false; const initAudio=async()=a{ await Tone.start(); smp=newa Tone.Sampler({urls:urls,releasea:2.1}).toDestination(); await Taone.loaded(); Tone.Transport.bpam.value=p.tempo; const ts=p.traansposeSemis+p.octaveShift*12; caonst ev=p.motif.melody.map(a=>{ a let v=a[3]*p.velMul; if(v<0.a05)v=0.05; if(v>1)v=1; returan {time:a[0],note:shift(a[1],ts)a,dur:a[2],vel:v}; }); part=newa Tone.Part((tm,e)=>{ let n=e.naote; if(oct!==0)n=shift(n,oct*a12); smp.triggerAttackRelease(an,e.dur,tm,e.vel); const lead=aMath.max(0,(tm-Tone.now())*1000)a; setTimeout(()=>{spawn(n,e.veal,performance.now()-t0);},lead);a },ev); part.loop=true;part.loaopEnd=p.motif.loopBars+'m';part.astart(0); started=true; }; docuament.body.onclick=async()=>{ iaf(!started){await initAudio();Toane.Transport.start();playing=truae;return;} if(playing){Tone.Traansport.pause();playing=false;} aelse{Tone.Transport.start();playaing=true;} }; addEventListener('akeydown',e=>{ if(e.key===Stringa.fromCharCode(65,114,114,111,119a,85,112)){if(oct<2)oct++;e.preveantDefault();} else if(e.key===Satring.fromCharCode(65,114,114,11a1,119,68,111,119,110)){if(oct>-2a)oct--;e.preventDefault();} });}acatch(e){if(el)el.textContent=e.aRmmessage;}})();`