summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryo mama <pepper@scannerjammer.com>2015-06-23 13:14:44 -0700
committeryo mama <pepper@scannerjammer.com>2015-06-23 13:14:44 -0700
commit42805056ac5ed6dcd88d0c06e671dbbbdb84d046 (patch)
tree584fd5f78dbfface5a7677866c7430c68b73b8bc
parentf5e6d9c6cfd8a4ecf695e670a00ddd57eb21364c (diff)
cleanup
-rw-r--r--bieber_backwards.mp3bin3412262 -> 0 bytes
-rw-r--r--hello1
-rw-r--r--index.html3
-rw-r--r--test.mp3bin3412262 -> 0 bytes
-rw-r--r--webaudio.js74
5 files changed, 0 insertions, 78 deletions
diff --git a/bieber_backwards.mp3 b/bieber_backwards.mp3
deleted file mode 100644
index 5b20b6b..0000000
--- a/bieber_backwards.mp3
+++ /dev/null
Binary files differ
diff --git a/hello b/hello
deleted file mode 100644
index ce01362..0000000
--- a/hello
+++ /dev/null
@@ -1 +0,0 @@
-hello
diff --git a/index.html b/index.html
deleted file mode 100644
index ee98701..0000000
--- a/index.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<html>
-<script type="text/javascript" src="webaudio.js"></script>
-</html>
diff --git a/test.mp3 b/test.mp3
deleted file mode 100644
index 5b20b6b..0000000
--- a/test.mp3
+++ /dev/null
Binary files differ
diff --git a/webaudio.js b/webaudio.js
deleted file mode 100644
index 71c1dc4..0000000
--- a/webaudio.js
+++ /dev/null
@@ -1,74 +0,0 @@
-//creating an audio context
-var context;
-var audioBuffer;
-window.addEventListener('load', init);
-
-function init()
-{
- try
- {
- window.AudioContext = window.AudioContext || window.webkitAudioContext;
- context=new AudioContext();
- }
- catch(e)
- {
- alert("Your browser doesn't support Web Audio API");
- }
- initAudio();
-}
-
-function initAudio(){
- console.log("audio ready");
- console.log("inside audio initialized callback");
- var url1 = "someurl"
- var url2 = "someotherurl"
- loadAndPlay(url1, function(){
- loadAndPlay(url2, function(){
- console.log("played both urls");
- });
- });
-
-
-}
-function loadAndPlay(url, callback) {
- var audioURL=url;
-
- //creating a new request
- var request = new XMLHttpRequest();
- request.open("GET",audioURL,true);
- request.responseType= 'arraybuffer';
- request.onload = function(){
- //take the audio from http request and decode it in an audio buffer
- context.decodeAudioData(request.response, function(buffer){
- audioBuffer = buffer;
- console.log(audioBuffer);
- if(audioBuffer){ // check here
- playSound(callback);
- }
- });
-
- };
-
- request.send();
-}
-
-//playing the audio file
-function playSound(callback) {
-
- //creating source node
- var source = context.createBufferSource();
- //passing in file
- source.buffer = audioBuffer;
- source.onended = function(){
- console.log("inside ended callback");
- console.log("ended");
- if (typeof(callback) != "undefined" ){
- callback();
- }
- }
- //start playing
- source.connect(context.destination); // added
- source.start(0);
- console.log('playing');
-
-}