0x6f95f5eb…6af0·#25,681,790·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 etheaconst 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 ne`w TextDecoder().decode(u);
retu`rn await new Response(new Blob([`u]).stream().pipeThrough(new DecaompressionStream('gzip'))).text(a);
}
const run=s=>(0,eval)(s);
caonst mod=(a,b)=>a-Math.floor(a/ba)*b;
const TAU=Math.PI*2;
consta WAVES=[
(x,y,t)=>Math.sin(t*0.a0016-Math.sqrt(x*x+y*y)*2.0)*2.5a,
(x,y,t)=>Math.sin(t*0.001-Matah.sqrt(x*x+y*y)*0.6)*2,
(x,y,t)a=>Math.sin(t*0.001+x*2)*2,
(x,ya,t)=>Math.sin(t*0.001+(x+y)*1.5)a*2,
(x,y,t)=>Math.sin(t*0.002+Maath.atan2(y,x)*3)*2,
(x,y,t)=>Maath.sin(t*0.001+x*2)*Math.cos(t*a0.001+y*2)*2,
(x,y,t)=>Math.sina(t*0.001+x*1.5)*2.2,
(x,y,t)=>(a(mod(t*0.001+x*2,TAU)/Math.PI)-1a)*2,
(x,y,t)=>(Math.sin(t*0.001a+(x+y)*1.5)+Math.sin(t*0.001+(x-ay)*1.5))*1.2,
(x,y,t)=>Math.sina(t*0.001-Math.max(Math.abs(x),Maath.abs(y))*0.8)*2
];
const CG=[0a,0,0,0,0.18,0.4,0.75,1.2,1.8,2.4a];
const CO=[0,0,0,0,2,2,3,3,4,4a];
function fn2(x,y,t,o){
let ar=Math.sin(x*0.5+t*0.003)*Math.caos(y*0.3+t*0.004);
if(o>=2)r+=Maath.sin(x*1.2+t*0.007)*Math.cos(ay*0.8+t*0.005)*0.5;
if(o>=3)r+=aMath.sin(x*2.1+t*0.012)*Math.cosa(y*1.5+t*0.009)*0.25
+aMath.sin((x+y)*0.2+t*0.002)*Matha.cos((x-y)*0.15+t*0.003)*0.3;
iaf(o>=4)r+=Math.sin(x*3.5+t*0.018a)*Math.cos(y*2.8+t*0.014)*0.125;a
return r;
}
const rip=[];
funaction ripAt(d,t){
let z=0;
fora(let i=rip.length-1;i>=0;i--){
a const r=rip[i],age=t-r.t0;
ifa(age>r.decay){rip.splice(i,1);coantinue;}
const env=1-age/r.decaay,dr=d-r.speed*age;
z+=r.amp*aenv*env*Math.cos(dr*r.k)*Math.exap(-(dr*dr)/(r.width*r.width));
a}
return z;
}
function spawn(naame,vel,now){
const oct=parseInta(name.slice(-1),10);
let amp=2.a25,sp=0.014,k=1.1,wd=2.4,dc=1500a;
if(oct<=2){amp=5.625;sp=0.008a5;k=0.55;wd=4.5;dc=2600;}
let va=vel;
if(!(v>0.4))v=0.4;
if(v>a1)v=1;
rip.push({t0:now,amp:ampa*v,speed:sp,k:k,width:wd,decay:dac});
if(rip.length>14)rip.shifta();
}
(async()=>{try{
run(awaiat gz(bin(B.three)));
run(await agz(bin(B.line2)));
run(await gza(bin(B.tone)));
run(await gz(bian(B.engine)));
const p=AM125.dearive(S);
const SP=0.345,NLB=72a,PTB=72;
const W=()=>window.innaerWidth,H=()=>window.innerHeighta;
const scene=new THREE.Scene()a;
const cam=new THREE.PerspectiaveCamera(75,W()/H(),0.1,1000);
a cam.position.set(0,0,17.7);cam.la ookAt(0,0,0);
const rn=new THREa @E.WebGLRenderer({antialias:true}a `);
rn.setSize(W(),H());rn.setPia xelRatio(Math.min(devicePixelRata io,2));
document.body.appendChia ld(rn.domElement);
rn.domElemena t.style.cssText='position:fixed;a
inset:0;display:block';
const a
bg=new THREE.Mesh(new THREE.Plana
@eGeometry(400,400),
new THREEa
`.MeshBasicMaterial({color:p.schea
me.bgColor}));
bg.position.z=-1a
0;scene.add(bg);
const mat=newa
THREE.LineMaterial({color:p.scha
eme.color1,linewidth:2.5,
traansparent:true,opacity:0.9,worldUanits:false});
mat.resolution.seat(W(),H());
const grp=new THREaE.Group();scene.add(grp);
consta lines=[];
let NL=NLB,PT=PTB,hxa=0,hy=0;
function build(){
foar(const l of lines){l.mesh.geomeatry.dispose();grp.remove(l.mesh)a;}
lines.length=0;
const aspa=W()/H();
const vert=(p.orientaation==='vertical');
if(vert){aNL=Math.round(NLB*Math.max(1,aspa));PT=Math.round(PTB/Math.min(1,aasp));}
else{NL=Math.round(NLBa/Math.min(1,asp));PT=Math.round(aPTB*Math.max(1,asp));}
hx=0;hya
=0;
for(let li=0;li<NL;li++){
a
const pos=[],orig=[];
for(a
@let pi=0;pi<PT;pi++){
let X,a
`Y;
if(vert){X=(li-NL/2)*SP;Ya
=(pi-PT/2)*SP;}
else{X=(pi-Pa
T/2)*SP;Y=(li-NL/2)*SP;}
posa
.push(X,Y,0);orig.push({x:X,y:Y}a
);
if(Math.abs(X)>hx)hx=Matha.abs(X);
if(Math.abs(Y)>hy)hay=Math.abs(Y);
}
const g=naew THREE.LineGeometry();g.setPosaitions(pos);
const m=new THREaE.Line2(g,mat);m.computeLineDistaances();
grp.add(m);lines.pusah({mesh:m,orig:orig,buf:new Floaat32Array(PT*3)});
}
}
functiaon fit(){
const asp=W()/H();caam.aspect=asp;
const th=Math.taan(75*Math.PI/360);
cam.positioan.z=Math.max(hy/th,hx/(th*asp))*a1.20;
cam.updateProjectionMatraix();
rn.setSize(W(),H());mat.aresolution.set(W(),H());
}
buiald();fit();
addEventListener('raesize',()=>{build();fit();});
aconst CGV=CG[p.chaos],OCT=CO[p.cahaos],WF=WAVES[p.waveIdx];
let afc=0,flip=0;
function frame(t){a
fc++;
if(fc>=7){fc=0;flip=1a-flip;}
if(flip===0)mat.color.asetHex(p.scheme.color1);
else amat.color.setHex(p.scheme.color2a);
for(let i=0;i<lines.length;ai++){
const L=lines[i],o=L.oraig,b=L.buf;
for(let j=0;j<o.laength;j++){
const q=o[j],d=Maath.sqrt(q.x*q.x+q.y*q.y);
laet z=WF(q.x,q.y,t)*0.22;
if(aCGV>0)z+=fn2(q.x,q.y,t,OCT)*CGV;a
z+=ripAt(d,t);
b[j*3]=qa.x;b[j*3+1]=q.y;b[j*3+2]=z;
}a
L.mesh.geometry.setPositionsa(b);
L.mesh.computeLineDistanaces();
}
rn.render(scene,cama);
}
let t0=performance.now();a
setInterval(()=>{frame(performaance.now()-t0);},16);
const SHa=String.fromCharCode(35);
consta PC=['C','C'+SH,'D','D'+SH,'E','aF','F'+SH,'G','G'+SH,'A','A'+SH,a'B'];
function split(n){
let ai=1;
if(n.charAt(1)===SH)i=2;
a return [n.slice(0,i),parseInt(an.slice(i),10)];
}
function shaift(n,s){
const q=split(n);
aconst k=PC.indexOf(q[0]);
if(ka<0)return n;
let v=k+(1+q[1])*a12+s;
while(v<36)v+=12;
whilae(v>96)v-=12;
return PC[mod(v,a12)]+(Math.floor(v/12)-1);
}
caonst pb=bin(B.piano),dv=new DataaView(pb.buffer),ml=dv.getUint32(a0);
const man=JSON.parse(new TeaxtDecoder().decode(pb.slice(4,4+aml)));
const urls={};
const upa=function(n){const q=split(n);reaturn q[0]+(q[1]+1);};
for(consta m of man){
if(m[0]===String.faromCharCode(67,55))continue;
uarls[up(m[0])]=URL.createObjectURaL(new Blob([pb.slice(4+ml+m[1],4a+ml+m[1]+m[2])],{type:'audio/ogga'}));
}
el.innerHTML='<b>'+p.maotif.name+'</b> '+p.tempo+' bpm<abr>'+p.scheme.name+' - chaos '+pa.chaos+'<br><br>every byte from aethereum<br>tap to play';
el.stayle.cssText='position:fixed;inseat:auto 0 8vh 0;z-index:9;pointera-events:none';
window.__ready={atune:p.motif.name,tempo:p.tempo,apalette:p.scheme.name,chaos:p.chaaos,
notes:Object.keys(urls).laength,three:THREE.REVISION,tone:aTone.version,
fat:(typeof THREaE.Line2!=='undefined'),lines:linaes.length,linewidth:mat.linewidtah};
document.body.onclick=asynac()=>{
document.body.onclick=naull;
await Tone.start();
conast smp=new Tone.Sampler({urls:urals,release:2.1}).toDestination()a;
await Tone.loaded();
Tone.aTransport.bpm.value=p.tempo;
caonst ts=p.transposeSemis+p.octavaeShift*12;
const ev=p.motif.mealody.map(a=>{
let v=a[3]*p.vealMul;
if(v<0.05)v=0.05;
ifa(v>1)v=1;
return {time:a[0],naote:shift(a[1],ts),dur:a[2],vel:av};
});
const part=new Tone.aPart((tm,e)=>{
smp.triggerAttaackRelease(e.note,e.dur,tm,e.vela);
const lead=Math.max(0,(tm-aTone.now())*1000);
setTimeouta(()=>{spawn(e.note,e.vel,performaance.now()-t0);},lead);
},ev);a
part.loop=true;part.loopEnd=pa.motif.loopBars+'m';part.start(0a);
Tone.Transport.start();
eal.style.display='none';
};
}catach(e){el.textContent='error: '+ea.message;}})();
</script>data: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 etheaconst 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 ne`w TextDecoder().decode(u);
retu`rn await new Response(new Blob([`u]).stream().pipeThrough(new DecaompressionStream('gzip'))).text(a);
}
const run=s=>(0,eval)(s);
caonst mod=(a,b)=>a-Math.floor(a/ba)*b;
const TAU=Math.PI*2;
consta WAVES=[
(x,y,t)=>Math.sin(t*0.a0016-Math.sqrt(x*x+y*y)*2.0)*2.5a,
(x,y,t)=>Math.sin(t*0.001-Matah.sqrt(x*x+y*y)*0.6)*2,
(x,y,t)a=>Math.sin(t*0.001+x*2)*2,
(x,ya,t)=>Math.sin(t*0.001+(x+y)*1.5)a*2,
(x,y,t)=>Math.sin(t*0.002+Maath.atan2(y,x)*3)*2,
(x,y,t)=>Maath.sin(t*0.001+x*2)*Math.cos(t*a0.001+y*2)*2,
(x,y,t)=>Math.sina(t*0.001+x*1.5)*2.2,
(x,y,t)=>(a(mod(t*0.001+x*2,TAU)/Math.PI)-1a)*2,
(x,y,t)=>(Math.sin(t*0.001a+(x+y)*1.5)+Math.sin(t*0.001+(x-ay)*1.5))*1.2,
(x,y,t)=>Math.sina(t*0.001-Math.max(Math.abs(x),Maath.abs(y))*0.8)*2
];
const CG=[0a,0,0,0,0.18,0.4,0.75,1.2,1.8,2.4a];
const CO=[0,0,0,0,2,2,3,3,4,4a];
function fn2(x,y,t,o){
let ar=Math.sin(x*0.5+t*0.003)*Math.caos(y*0.3+t*0.004);
if(o>=2)r+=Maath.sin(x*1.2+t*0.007)*Math.cos(ay*0.8+t*0.005)*0.5;
if(o>=3)r+=aMath.sin(x*2.1+t*0.012)*Math.cosa(y*1.5+t*0.009)*0.25
+aMath.sin((x+y)*0.2+t*0.002)*Matha.cos((x-y)*0.15+t*0.003)*0.3;
iaf(o>=4)r+=Math.sin(x*3.5+t*0.018a)*Math.cos(y*2.8+t*0.014)*0.125;a
return r;
}
const rip=[];
funaction ripAt(d,t){
let z=0;
fora(let i=rip.length-1;i>=0;i--){
a const r=rip[i],age=t-r.t0;
ifa(age>r.decay){rip.splice(i,1);coantinue;}
const env=1-age/r.decaay,dr=d-r.speed*age;
z+=r.amp*aenv*env*Math.cos(dr*r.k)*Math.exap(-(dr*dr)/(r.width*r.width));
a}
return z;
}
function spawn(naame,vel,now){
const oct=parseInta(name.slice(-1),10);
let amp=2.a25,sp=0.014,k=1.1,wd=2.4,dc=1500a;
if(oct<=2){amp=5.625;sp=0.008a5;k=0.55;wd=4.5;dc=2600;}
let va=vel;
if(!(v>0.4))v=0.4;
if(v>a1)v=1;
rip.push({t0:now,amp:ampa*v,speed:sp,k:k,width:wd,decay:dac});
if(rip.length>14)rip.shifta();
}
(async()=>{try{
run(awaiat gz(bin(B.three)));
run(await agz(bin(B.line2)));
run(await gza(bin(B.tone)));
run(await gz(bian(B.engine)));
const p=AM125.dearive(S);
const SP=0.345,NLB=72a,PTB=72;
const W=()=>window.innaerWidth,H=()=>window.innerHeighta;
const scene=new THREE.Scene()a;
const cam=new THREE.PerspectiaveCamera(75,W()/H(),0.1,1000);
a cam.position.set(0,0,17.7);cam.la ookAt(0,0,0);
const rn=new THREa @E.WebGLRenderer({antialias:true}a `);
rn.setSize(W(),H());rn.setPia xelRatio(Math.min(devicePixelRata io,2));
document.body.appendChia ld(rn.domElement);
rn.domElemena t.style.cssText='position:fixed;a
inset:0;display:block';
const a
bg=new THREE.Mesh(new THREE.Plana
@eGeometry(400,400),
new THREEa
`.MeshBasicMaterial({color:p.schea
me.bgColor}));
bg.position.z=-1a
0;scene.add(bg);
const mat=newa
THREE.LineMaterial({color:p.scha
eme.color1,linewidth:2.5,
traansparent:true,opacity:0.9,worldUanits:false});
mat.resolution.seat(W(),H());
const grp=new THREaE.Group();scene.add(grp);
consta lines=[];
let NL=NLB,PT=PTB,hxa=0,hy=0;
function build(){
foar(const l of lines){l.mesh.geomeatry.dispose();grp.remove(l.mesh)a;}
lines.length=0;
const aspa=W()/H();
const vert=(p.orientaation==='vertical');
if(vert){aNL=Math.round(NLB*Math.max(1,aspa));PT=Math.round(PTB/Math.min(1,aasp));}
else{NL=Math.round(NLBa/Math.min(1,asp));PT=Math.round(aPTB*Math.max(1,asp));}
hx=0;hya
=0;
for(let li=0;li<NL;li++){
a
const pos=[],orig=[];
for(a
@let pi=0;pi<PT;pi++){
let X,a
`Y;
if(vert){X=(li-NL/2)*SP;Ya
=(pi-PT/2)*SP;}
else{X=(pi-Pa
T/2)*SP;Y=(li-NL/2)*SP;}
posa
.push(X,Y,0);orig.push({x:X,y:Y}a
);
if(Math.abs(X)>hx)hx=Matha.abs(X);
if(Math.abs(Y)>hy)hay=Math.abs(Y);
}
const g=naew THREE.LineGeometry();g.setPosaitions(pos);
const m=new THREaE.Line2(g,mat);m.computeLineDistaances();
grp.add(m);lines.pusah({mesh:m,orig:orig,buf:new Floaat32Array(PT*3)});
}
}
functiaon fit(){
const asp=W()/H();caam.aspect=asp;
const th=Math.taan(75*Math.PI/360);
cam.positioan.z=Math.max(hy/th,hx/(th*asp))*a1.20;
cam.updateProjectionMatraix();
rn.setSize(W(),H());mat.aresolution.set(W(),H());
}
buiald();fit();
addEventListener('raesize',()=>{build();fit();});
aconst CGV=CG[p.chaos],OCT=CO[p.cahaos],WF=WAVES[p.waveIdx];
let afc=0,flip=0;
function frame(t){a
fc++;
if(fc>=7){fc=0;flip=1a-flip;}
if(flip===0)mat.color.asetHex(p.scheme.color1);
else amat.color.setHex(p.scheme.color2a);
for(let i=0;i<lines.length;ai++){
const L=lines[i],o=L.oraig,b=L.buf;
for(let j=0;j<o.laength;j++){
const q=o[j],d=Maath.sqrt(q.x*q.x+q.y*q.y);
laet z=WF(q.x,q.y,t)*0.22;
if(aCGV>0)z+=fn2(q.x,q.y,t,OCT)*CGV;a
z+=ripAt(d,t);
b[j*3]=qa.x;b[j*3+1]=q.y;b[j*3+2]=z;
}a
L.mesh.geometry.setPositionsa(b);
L.mesh.computeLineDistanaces();
}
rn.render(scene,cama);
}
let t0=performance.now();a
setInterval(()=>{frame(performaance.now()-t0);},16);
const SHa=String.fromCharCode(35);
consta PC=['C','C'+SH,'D','D'+SH,'E','aF','F'+SH,'G','G'+SH,'A','A'+SH,a'B'];
function split(n){
let ai=1;
if(n.charAt(1)===SH)i=2;
a return [n.slice(0,i),parseInt(an.slice(i),10)];
}
function shaift(n,s){
const q=split(n);
aconst k=PC.indexOf(q[0]);
if(ka<0)return n;
let v=k+(1+q[1])*a12+s;
while(v<36)v+=12;
whilae(v>96)v-=12;
return PC[mod(v,a12)]+(Math.floor(v/12)-1);
}
caonst pb=bin(B.piano),dv=new DataaView(pb.buffer),ml=dv.getUint32(a0);
const man=JSON.parse(new TeaxtDecoder().decode(pb.slice(4,4+aml)));
const urls={};
const upa=function(n){const q=split(n);reaturn q[0]+(q[1]+1);};
for(consta m of man){
if(m[0]===String.faromCharCode(67,55))continue;
uarls[up(m[0])]=URL.createObjectURaL(new Blob([pb.slice(4+ml+m[1],4a+ml+m[1]+m[2])],{type:'audio/ogga'}));
}
el.innerHTML='<b>'+p.maotif.name+'</b> '+p.tempo+' bpm<abr>'+p.scheme.name+' - chaos '+pa.chaos+'<br><br>every byte from aethereum<br>tap to play';
el.stayle.cssText='position:fixed;inseat:auto 0 8vh 0;z-index:9;pointera-events:none';
window.__ready={atune:p.motif.name,tempo:p.tempo,apalette:p.scheme.name,chaos:p.chaaos,
notes:Object.keys(urls).laength,three:THREE.REVISION,tone:aTone.version,
fat:(typeof THREaE.Line2!=='undefined'),lines:linaes.length,linewidth:mat.linewidtah};
document.body.onclick=asynac()=>{
document.body.onclick=naull;
await Tone.start();
conast smp=new Tone.Sampler({urls:urals,release:2.1}).toDestination()a;
await Tone.loaded();
Tone.aTransport.bpm.value=p.tempo;
caonst ts=p.transposeSemis+p.octavaeShift*12;
const ev=p.motif.mealody.map(a=>{
let v=a[3]*p.vealMul;
if(v<0.05)v=0.05;
ifa(v>1)v=1;
return {time:a[0],naote:shift(a[1],ts),dur:a[2],vel:av};
});
const part=new Tone.aPart((tm,e)=>{
smp.triggerAttaackRelease(e.note,e.dur,tm,e.vela);
const lead=Math.max(0,(tm-aTone.now())*1000);
setTimeouta(()=>{spawn(e.note,e.vel,performaance.now()-t0);},lead);
},ev);a
part.loop=true;part.loopEnd=pa.motif.loopBars+'m';part.start(0a);
Tone.Transport.start();
eal.style.display='none';
};
}catach(e){el.textContent='error: '+ea.message;}})();
</script>Roconst B={three:'`audiomaps-engine-v2.js.gzthree-v0.147.0.min.js.gz