function audio(p,a) {
var i,t,w = "5249464668ac000057415645666d742010000000010002002256000044ac0000020008006461746144ac0000";
a=a*0.2;
for (i=0,l=22050;i<l;++i) {
t=Math.round(a*Math.sin(i/22050*2*Math.PI*p)+127);
w+=t.toString(16)+t.toString(16);
d.fillRect(i,400-t,1,1);
}
window.a && a.pause();
a = document.createElement('audio');
a.src = "data:audio/x-wav," + w.replace(/(\w\w)/g, '%$1');
document.body.appendChild(a);
//a.addEventListener('ended', function() {c.onmousemove = foo;}, 1);
a.play();
c.onmousemove = foo;
}
z = document.createElement('input');
document.body.appendChild(z);
c = document.getElementById('c');
d = c.getContext('2d');
c.width=800;
c.height=400;
function foo(e) {
c.onmousemove = null;
var x=e.pageX-c.offsetLeft,y=400-e.pageY-c.offsetTop;
z.value = x+' '+y;
setTimeout(function () {audio(x,y)}, 20);
}
c.onmousemove = foo;
ZnVuY3Rpb24gYXVkaW8ocCxhKSB7DQogIHZhciBpLHQsdyA9ICI1MjQ5NDY0NjY4YWMwMDAwNTc0MTU2NDU2NjZkNzQyMDEwMDAwMDAwMDEwMDAyMDAyMjU2MDAwMDQ0YWMwMDAwMDIwMDA4MDA2NDYxNzQ2MTQ0YWMwMDAwIjsNCiAgYT1hKjAuMjsNCiAgZm9yIChpPTAsbD0yMjA1MDtpPGw7KytpKSB7DQogICAgdD1NYXRoLnJvdW5kKGEqTWF0aC5zaW4oaS8yMjA1MCoyKk1hdGguUEkqcCkrMTI3KTsNCiAgICB3Kz10LnRvU3RyaW5nKDE2KSt0LnRvU3RyaW5nKDE2KTsNCiAgICBkLmZpbGxSZWN0KGksNDAwLXQsMSwxKTsNCiAgfQ0KICB3aW5kb3cuYSAmJiBhLnBhdXNlKCk7DQogIGEgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdhdWRpbycpOw0KICBhLnNyYyA9ICJkYXRhOmF1ZGlvL3gtd2F2LCIgKyB3LnJlcGxhY2UoLyhcd1x3KS9nLCAnJSQxJyk7DQogIGRvY3VtZW50Lm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