Created
May 15, 2014 17:03
-
-
Save diegogurgel/cb422091de2698dab492 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.onload = function() | |
| { | |
| var type = 0; | |
| var contex = new webkitAudioContext(); | |
| var oscillator; | |
| playWave(); | |
| function playWave(){ | |
| oscillator = contex.createOscillator(); | |
| oscillator.type = type; | |
| oscillator.connect(contex.destination); | |
| oscillator.noteOn(0); | |
| } | |
| function addOscillator(){ | |
| var osc = contex.createOscillator(); | |
| osc.type = osc.SQUARE; | |
| osc.connect(contex.destination); | |
| osc.noteOn(0); | |
| return osc; | |
| } | |
| var osc2 = addOscillator(); | |
| var $oscilator = document.getElementsByTagName('body')[0]; | |
| $oscilator.onmousemove = function(event){ | |
| osc2.frequency.value=event.y*5; | |
| oscillator.frequency.value=event.x*5; | |
| }; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment