Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more work

  • Loading branch information...
commit cf8c6fc3c2c2485969eab956f261d677481f1525 1 parent ac7e12e
@jeromeetienne authored
View
2  build/webaudio.js
@@ -472,7 +472,7 @@ WebAudio.Sound.prototype.tone = function(hertz, seconds){
fArray[i] = Math.sin(angle)*amplitude;
}
// set the buffer
- this.buffer(buffer).loop(true);
+ this.buffer(buffer);
return this; // for chained API
}
View
21 examples/dev.html
@@ -14,26 +14,7 @@
//var buffer = generateSin(200, 2);
//console.log("buffer", buffer);
//sound.buffer(buffer).loop(true).play();
- //sound.tone(350, 4).loop(true).volume(0.9);
+ sound.tone(350, 4).loop(true).volume(0.9);
//var playingSound= sound.play();
- // load sound.wav and play it
- //sound.load('sounds/techno.mp3', function(sound){
- // //sound.play();
- //});
- // load sound.wav and play it
- var playingSound;
- var engine = webaudio.createSound();
- engine.load('sounds/triggerrally/engine1.wav', function(sound){
- playingSound = sound.loop(true).play();
- });
-
-
- document.addEventListener('mousemove', function(event){
- // get mouse coordinate in [-1, +1]
- var mouseX = (event.clientX / window.innerWidth )*2 - 1;
- var mouseY = (event.clientY / window.innerHeight)*2 - 1;
-
- playingSound.node.playbackRate.value = mouseX+1;
- })
</script></body>
View
23 examples/granularsound.html
@@ -0,0 +1,23 @@
+<!doctype html><title>webaudio.js basic</title>
+<script src="../build/webaudio.js"></script>
+<body><script>
+ // init the library
+ var webaudio = new WebAudio();
+
+ // load sound and play it
+ var playingSound;
+ var engine = webaudio.createSound();
+ engine.load('sounds/triggerrally/engine1.wav', function(sound){
+ playingSound = sound.loop(true).play();
+ });
+
+ // bind the mouse position to the sound
+ document.addEventListener('mousemove', function(event){
+ // get mouse coordinate in [0, +1]
+ var mouseX = event.clientX / window.innerWidth ;
+ var mouseY = event.clientY / window.innerHeight;
+
+ playingSound.node.playbackRate.value = mouseX*2;
+ playingSound.node.gain.value = mouseY*2;
+ })
+</script></body>
Please sign in to comment.
Something went wrong with that request. Please try again.