Skip to content

Commit

Permalink
add support for safari 9
Browse files Browse the repository at this point in the history
fixes #7
  • Loading branch information
mmckegg committed Nov 21, 2015
1 parent b16994b commit 5baf362
Show file tree
Hide file tree
Showing 25 changed files with 24 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Now navigate to [localhost:9966](http://localhost:9966).

## Browser Support

Works in latest versions of Chrome and Firefox. Currently doesn't work in Safari.
Works in latest versions of Chrome, Firefox, Safari.

[Internet Explorer doesn't support the Web Audio API yet](https://status.modern.ie/webaudioapi).

Expand Down Expand Up @@ -107,4 +107,4 @@ MIT
- [Matt McKegg](https://github.com/mmckegg)
- [Jan Monschke](https://github.com/janmonschke)

This is an OPEN open source project. See [CONTRIBUTING.md](https://github.com/mmckegg/web-audio-school/blob/master/CONTRIBUTING.md) for details
This is an OPEN open source project. See [CONTRIBUTING.md](https://github.com/mmckegg/web-audio-school/blob/master/CONTRIBUTING.md) for details
3 changes: 2 additions & 1 deletion browser-entry.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// fix up in case of browser vendor prefixing
// safari support
require('stereo-panner-node').polyfill()
window.AudioContext = window.AudioContext || window.webkitAudioContext

var insertCss = require('insert-css')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var audioContext = new AudioContext()
// wait 100ms for sample to download/decode
var startTime = audioContext.currentTime + 0.2

getSample('zara1.ogg', function play (buffer) {
getSample('zara.wav', function play (buffer) {

This comment has been minimized.

Copy link
@adityasaxena

adityasaxena Nov 21, 2015

thanks @mmckegg. Had been wrestling with it for the past five minutes, saw a 404, went to Github, didn't find any open issues, went to lessons/ folder, when to working with samples section, saw this commit, refreshed the page, and, Boom!!!!

var player = audioContext.createBufferSource()
player.buffer = buffer
player.connect(audioContext.destination)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ var audioContext = new AudioContext()
// wait 100ms for sample to download/decode
var startTime = audioContext.currentTime + 0.2

getSample('zara1.ogg', function play (buffer) {})
getSample('zara.wav', function play (buffer) {

})

function getSample (url, cb) {
var request = new XMLHttpRequest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var audioContext = new AudioContext()
var startTime = audioContext.currentTime + 0.2

getSample('zara1.ogg', function play (buffer) {
getSample('zara.wav', function play (buffer) {
var player = audioContext.createBufferSource()
player.buffer = buffer
player.connect(audioContext.destination)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var audioContext = new AudioContext()
var startTime = audioContext.currentTime + 0.2

getSample('zara1.ogg', function play (buffer) {
getSample('zara.wav', function play (buffer) {
var player = audioContext.createBufferSource()
player.buffer = buffer
player.connect(audioContext.destination)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var audioContext = new AudioContext()
var startTime = audioContext.currentTime + 0.2

getSample('zara1.ogg', function play (buffer) {
getSample('zara.wav', function play (buffer) {
var player = audioContext.createBufferSource()
player.buffer = buffer
player.loop = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var audioContext = new AudioContext()
var startTime = audioContext.currentTime + 0.2

getSample('zara1.ogg', function play (buffer) {
getSample('zara.wav', function play (buffer) {
var player = audioContext.createBufferSource()
player.buffer = buffer
player.connect(audioContext.destination)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var audioContext = new AudioContext()
var startTime = audioContext.currentTime + 0.1

getSample('vox.ogg', function play (buffer) {
getSample('vox.wav', function play (buffer) {
var player = audioContext.createBufferSource()
player.buffer = buffer
player.playbackRate.value = 0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var audioContext = new AudioContext()
var startTime = audioContext.currentTime + 0.1

getSample('vox.ogg', function play (buffer) {
getSample('vox.wav', function play (buffer) {
var player = audioContext.createBufferSource()
player.buffer = buffer
player.connect(audioContext.destination)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var audioContext = new AudioContext()
var startTime = audioContext.currentTime + 0.1

getSample('vox.ogg', function (buffer) {
getSample('vox.wav', function (buffer) {
play(0, -12)
play(1, -5)
play(2, 0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var audioContext = new AudioContext()
var startTime = audioContext.currentTime + 0.1

getSample('vox.ogg', function (buffer) {
getSample('vox.wav', function (buffer) {
play(0, -12)
play(1, -5)
play(2, 0)
Expand Down
2 changes: 1 addition & 1 deletion lessons/3. Effects/15. Simple Overdrive/answer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ amp.gain.value = 20
amp.connect(shaper)
shaper.connect(audioContext.destination)

getSample('guitar.ogg', function play (buffer) {
getSample('guitar.wav', function play (buffer) {
var player = audioContext.createBufferSource()
player.buffer = buffer
player.connect(amp)
Expand Down
2 changes: 1 addition & 1 deletion lessons/3. Effects/15. Simple Overdrive/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var startTime = audioContext.currentTime + 0.2

// ^^^^^^^^^^^^^^^^^

getSample('guitar.ogg', function play (buffer) {
getSample('guitar.wav', function play (buffer) {
var player = audioContext.createBufferSource()
player.buffer = buffer
player.connect(audioContext.destination)
Expand Down
2 changes: 1 addition & 1 deletion lessons/3. Effects/16. Better Overdrive/answer.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ amp.gain.value = 20
amp.connect(bandpass)
shaper.connect(audioContext.destination)

getSample('guitar.ogg', function play (buffer) {
getSample('guitar.wav', function play (buffer) {
var player = audioContext.createBufferSource()
player.buffer = buffer
player.connect(amp)
Expand Down
2 changes: 1 addition & 1 deletion lessons/3. Effects/16. Better Overdrive/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ amp.gain.value = 20
amp.connect(shaper)
shaper.connect(audioContext.destination)

getSample('guitar.ogg', function play (buffer) {
getSample('guitar.wav', function play (buffer) {
var player = audioContext.createBufferSource()
player.buffer = buffer
player.connect(amp)
Expand Down
2 changes: 1 addition & 1 deletion lessons/3. Effects/19. Simple Reverb/answer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var audioContext = new AudioContext()
var startTime = audioContext.currentTime + 0.2

getSample('guitar.ogg', function play (buffer) {
getSample('guitar.wav', function play (buffer) {
getSample('spring.mp3', function play (impulseBuffer) {
var player = audioContext.createBufferSource()
player.buffer = buffer
Expand Down
2 changes: 1 addition & 1 deletion lessons/3. Effects/19. Simple Reverb/start.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var audioContext = new AudioContext()
var startTime = audioContext.currentTime + 0.2

getSample('guitar.ogg', function play (buffer) {
getSample('guitar.wav', function play (buffer) {
// Add reverb logic here
var player = audioContext.createBufferSource()
player.buffer = buffer
Expand Down
Binary file removed resources/guitar.ogg
Binary file not shown.
Binary file added resources/guitar.wav
Binary file not shown.
4 changes: 2 additions & 2 deletions resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<head>
<meta charset="UTF-8">
<title>Web Audio School</title>
<link rel='prefetch' href='vox.ogg'>
<link rel='prefetch' href='zara1.ogg'>
<link rel='prefetch' href='vox.wav'>
<link rel='prefetch' href='zara.wav'>
<link rel='prefetch' href='web-audio-api-flowchart.png'>
</head>
<body>
Expand Down
Binary file removed resources/vox.ogg
Binary file not shown.
Binary file added resources/vox.wav
Binary file not shown.
Binary file added resources/zara.wav
Binary file not shown.
Binary file removed resources/zara1.ogg
Binary file not shown.

0 comments on commit 5baf362

Please sign in to comment.