Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- var audioCtx=new AudioContext();
- var oscillator = audioCtx.createOscillator();
- var gainNode = audioCtx.createGain();
- oscillator.connect(gainNode);
- gainNode.connect(audioCtx.destination);
- var WIDTH = window.innerWidth;
- var HEIGHT = window.innerHeight;
- var FreqMax = prompt('Enter Max Freq:');
- var VolMax = prompt("Enter Max Vol:");
- var Freq = prompt("Enter Freq");
- var Vol = 0.1;
- oscillator.type = 'sawtooth';
- oscillator.frequency.value = Freq;
- oscillator.start();
- gainNode.gain.value = Vol;
- var CurX;
- var CurY;
- document.onmousemove = updatePage;
- function updatePage(e) {
- CurX = (window.Event) ? e.pageX : event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
- CurY = (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
- oscillator.frequency.value = (CurX/WIDTH) * FreqMax;
- gainNode.gain.value = (CurY/HEIGHT) * VolMax;
- canvasDraw();
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement