Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
WebAudio
Search
Tiffany Conroy
October 01, 2012
Programming
1
170
WebAudio
GET EXCITED AND PLAY!!
Tiffany Conroy
October 01, 2012
Tweet
Share
More Decks by Tiffany Conroy
See All by Tiffany Conroy
Beautiful Authentication: Tear down the barbed wire
theophani
3
830
Lions and tigers and handling user capabilities
theophani
1
680
What about the CSSOM?
theophani
3
500
Cutting the fat
theophani
4
600
When to use Ajax and when to reload
theophani
6
1.8k
Version Control All The Codes
theophani
12
1.2k
Design Processes, Not Interfaces
theophani
5
1.8k
Other Decks in Programming
See All in Programming
KawaiiLT 登壇資料 キャリアとモチベーション
hiiragi
0
120
Unlock the Potential of Swift Code Generation
rockname
0
260
個人開発の学生アプリが企業譲渡されるまで
akidon0000
0
850
Building Scalable Mobile Projects: Fast Builds, High Reusability and Clear Ownership
cyrilmottier
2
300
Amazon CloudWatchの地味だけど強力な機能紹介!
itotsum
0
180
Chrome Extension Techniques from Hell
moznion
1
160
これだけは知っておきたいクラス設計の基礎知識 version 2
masuda220
PRO
24
6.5k
Memory API : Patterns, Performance et Cas d'Utilisation
josepaumard
0
140
状態と共に暮らす:ステートフルへの挑戦
ypresto
2
750
Fiber Scheduler vs. General-Purpose Parallel Client
hayaokimura
1
110
The Implementations of Advanced LR Parser Algorithm
junk0612
1
340
note の Elasticsearch 更新系を支える技術
tchov
0
110
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
33
6.5k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
Rebuilding a faster, lazier Slack
samanthasiow
80
8.9k
Bash Introduction
62gerente
611
210k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.2k
The World Runs on Bad Software
bkeepers
PRO
67
11k
Embracing the Ebb and Flow
colly
85
4.6k
Gamification - CAS2011
davidbonilla
81
5.2k
Practical Orchestrator
shlominoach
186
11k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Documentation Writing (for coders)
carmenintech
69
4.7k
Transcript
WEBAUDIO
WebAudio != <audio … >
// create new <audio> var audioElement = new Audio();
// create new WebAudio Context var context = new audioContext();
// create new WebAudio Context var context = new webkitAudioContext();
WICKED WEBAUDIO DEMOS http://chromium.googlecode.com/svn/trunk/samples/audio/samples.html
PLAY
audioElement.src = path // check/wait until you can play audioElement.play();
var source = context.createBufferSource(); source.buffer = buffer; source.connect(context.destination); source.noteOn(at); //
PLAY
var source = context.createBufferSource(); source.buffer = buffer; source.connect(context.destination); source.noteOn(at); //
PLAY
var source = context.createBufferSource(); source.buffer = buffer; source.connect(context.destination); source.noteOn(at); //
PLAY
$.ajax({ url: "/path/to/my/sound/file", success: decodeAudioData, requestType: "arraybuffer" });
$.ajax({ url: "/path/to/my/sound/file", success: decodeAudioData, requestType: "arraybuffer" }); NOPE
var request = new XMLHttpRequest(); request.open("GET", "/path/to/sound"); request.responseType = "arraybuffer";
request.onload = decodeAudioData; request.send();
var request = new XMLHttpRequest(); request.open("GET", "/path/to/sound"); request.responseType = "arraybuffer";
request.onload = decodeAudioData; request.send();
var decodeAudioData = function() { context.decodeAudioData( request.response, decodeSuccess); };
var decodeSuccess = function(buffer) { doSomething(buffer); };
var decodeSuccess = function(buffer) { doSomething(buffer); };
var decodeSuccess = function(buffer) { doSomething(buffer); };
I MADE SOME FUNCTIONS github.com/theophani/load-sounds
var loadSound = function(path, callback) { // load the sound
sorta like I showed before };
var loadSounds = function(paths, callback) { // load a bunch
of sounds };
var playSound = function(buffer) { // stuff with source and
context };
Tiffany Conroy github.com/theophani/load-sounds @theophani