Left:volume, Right:variance, ?:random. Be the alien dj! Needs web audio api support. Have fun!
_=' W(Xt,e){u=[0,3,5,7,9,10,12].slice(0,e+1i=8*2,*2,1/123+(30+u[t%u)DYirp-!n$t$e;e<5+3*;)e^,4R(7*+e**2)F>.5D{u:Xv:t}rt-Y>.5?"s6e":"sawtoo_"fa-n6put"DYn="range",n,ncI{Y21N2N*P(3NdIXt){4d=,.34pSu,4rSv,4u=cIt4m=rtM({t=_is; m=A.Oscillatorn=n1X1Fg=A.Ga6m gFgA.dest6atiocUi,dIt,bbutt@"FwUb.6`rHTML="?"b.@clickdIt)jzcvJjwzJw/10jvJc,QcQwQbwrite("<br>"FJsf i^ np[ i% pz)jup *Jd}H({body.appKdChild(Z-setTimeou|-!B^up,B%u=&&(=*r[B%r/P2*~~("a"==m[1])sfDZ},70)}!A=`w AudioC@text,O$b.style.backgV="#031",G=random,R=VO.`w M(i)m.star|0DB;Z;functi@.value, O[i].()pow(documK return t.=ElemK|"m.frequKcy=W(} .lKg_].@change var g.ga6,i;i<5;i^)createc/100n)=-*P~~+(),push(.typeMa_..c@`c|=0G!for($=[],-{4n.6in@onD);F)Iu(J= KenN>)P(1+QH( S=rp.U=faVroundXn,Y ^++_th`nej}|t(';for(Y=0;$='|j`_^YXVUSQPNKJIFD@64-$! '[Y++];)Z=_.split($),_=Z.join(Z.pop());eval(_)
Xz0nASBXKFh0LGUpexF1PVswLDMsNSw3LDksMTAsMTJdLnNsaWNlKDAsZSsxGWk9OCoGMiwWKgYGMiwxLzEyGTMrKDMwK3VbdCV1DylEWWkOcnAtIRFuJHQkZR47ZTw1KzMqHzspZV4sNBpSKDcqHytlKh8qMilGGh8+LjVECHt1Olh2OnR9DnJ0LVkfPi41PyJzNmUiOiJzYXd0b29fIg5mYS0Rbgs2cHV0IkRZbhs9InJhbmdlIixuAh4sbg5jSRZ7WTIYMU4YMk4qUCgzTg5kSVh0KXs0ZD0GHywuMxk0cFN1LDRyU3YsNHU9Y0l0GTRtGz1ydAUO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.net
//// c==8
A = new AudioContext();
O = [];
b.style.background="#031";
G=Math.random;
R=Math.round;
//generates a note given o=octave, n, note number, Q=variance
function W(o,n,Q)
{
//dorian-like exatonic scale, chose an initial segment according to Q
var a = [0,3,5,7,9,10,12].slice(0,Q+1);
//superpower math
var r = (Math.pow(2,o))*8*Math.pow(Math.pow(2,1/12),3+(30+a[n%a.length]));
return(r);
}
//generate a random melodic/rithmic pattern
// u will be the array of 'notes'
// v will be array of booleans: note on/off...
function rp()
{
var u=[];
var v=[];
var i=0;
while(i<5+3*G())
{
i++;
u.push(R(G()*7+i*G()*2));
v.push((G()>0.5));
}
return {u:u, v:v};
}
//random tone: only sine and saw provided!....
function rt()
{
return G()>0.5?"sine":"sawtooth";
}
// fattapposta is a south-italian words that can be translated as 'whacchacallit' or something
//essentially manages the range inputs on the dom
function fa()//fattappost
{
var c=document.createElement("input");
c.type="range";
c.value=0;
return c;
}
//choose update time (how often will my note change?)
function cu(n)
{
return 2*(1+(~~G())+(n<1))*(1+(~~G())+(n<2))*(1+(n<3));
}
//err... i do not recall that function. randomizes stuff, mainly
function du(s,n)
{
s.d=Math.pow(G(),0.3);
s.p=rp().u;//[0,2,3,4,8];
s.r=rp().v;
s.u=cu(n)
s.m.type=rt();
}
function M(n) //the super mega constructor
{
var s=this;
s.m = A.createOscillator();
s.n=n;
s.m.frequency.value=W(1,s.n,1);
s.g=A.createGain();
s.m.connect(s.g);
s.g.connect(A.destination);
s.c = fa();
s.i=0;
du(s,n);
s.b=document.createElement("button");
s.w = fa();
s.b.innerHTML="?";
s.b.onclick = function()
{
du(s);
}
s.z=0;
s.c.onchange=function()
{
s.v=s.c.value/100;
}
s.w.onchange=function()
{
s.z=s.w.value/10;
}
s.v=s.c.value;
H(s.c);
H(s.w);
H(s.b);
document.write("<br>");
s.g.gain.value=s.c.value/100;
//alert(this.u);
s.sf = function()
{
s.i++;
s.m.frequency.value=W(s.n,s.p[(s.i)%s.p.length],s.z);
}
s.up = function()
{
s.g.gain.value*=s.d;
}
}
//append
function H(x)
{
document.body.appendChild(x);
}
//makes the oscillators...
for(i=0; i<5; i++)
{
O.push(new M(i));
O[i].m.start(0);
}
var B = 0;
// main loop
function Z()
{
setTimeout(
function()
{
B++;
for(i=0;i<5;i++)
{
O[i].up();
if(B%O[i].u==0)
{
O[i].g.gain.value=(O[i].c.value/100)*(O[i].r[B%(O[i].r.length)])/(1+~~(O[i].m.type[1]=='a')*2);
O[i].sf();
}
}
Z();
}
,
70
);
}
Z();
// bring luve and peacy to the warld, you ell.
// d.p.m
//// 2016 daniele pascal morelli