Slide 1

Slide 1 text

WEBAUDIO

Slide 2

Slide 2 text

WebAudio !=

Slide 3

Slide 3 text

// create new var audioElement = new Audio();

Slide 4

Slide 4 text

// create new WebAudio Context var context = new audioContext();

Slide 5

Slide 5 text

// create new WebAudio Context var context = new webkitAudioContext();

Slide 6

Slide 6 text

WICKED WEBAUDIO DEMOS http://chromium.googlecode.com/svn/trunk/samples/audio/samples.html

Slide 7

Slide 7 text

PLAY

Slide 8

Slide 8 text

audioElement.src = path // check/wait until you can play audioElement.play();

Slide 9

Slide 9 text

var source = context.createBufferSource(); source.buffer = buffer; source.connect(context.destination); source.noteOn(at); // PLAY

Slide 10

Slide 10 text

var source = context.createBufferSource(); source.buffer = buffer; source.connect(context.destination); source.noteOn(at); // PLAY

Slide 11

Slide 11 text

var source = context.createBufferSource(); source.buffer = buffer; source.connect(context.destination); source.noteOn(at); // PLAY

Slide 12

Slide 12 text

$.ajax({ url: "/path/to/my/sound/file", success: decodeAudioData, requestType: "arraybuffer" });

Slide 13

Slide 13 text

$.ajax({ url: "/path/to/my/sound/file", success: decodeAudioData, requestType: "arraybuffer" }); NOPE

Slide 14

Slide 14 text

var request = new XMLHttpRequest(); request.open("GET", "/path/to/sound"); request.responseType = "arraybuffer"; request.onload = decodeAudioData; request.send();

Slide 15

Slide 15 text

var request = new XMLHttpRequest(); request.open("GET", "/path/to/sound"); request.responseType = "arraybuffer"; request.onload = decodeAudioData; request.send();

Slide 16

Slide 16 text

var decodeAudioData = function() { context.decodeAudioData( request.response, decodeSuccess); };

Slide 17

Slide 17 text

var decodeSuccess = function(buffer) { doSomething(buffer); };

Slide 18

Slide 18 text

var decodeSuccess = function(buffer) { doSomething(buffer); };

Slide 19

Slide 19 text

var decodeSuccess = function(buffer) { doSomething(buffer); };

Slide 20

Slide 20 text

I MADE SOME FUNCTIONS github.com/theophani/load-sounds

Slide 21

Slide 21 text

var loadSound = function(path, callback) { // load the sound sorta like I showed before };

Slide 22

Slide 22 text

var loadSounds = function(paths, callback) { // load a bunch of sounds };

Slide 23

Slide 23 text

var playSound = function(buffer) { // stuff with source and context };

Slide 24

Slide 24 text

Tiffany Conroy github.com/theophani/load-sounds @theophani