Need help with AudioContext-MonkeyPatch?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

cwilso
136 Stars 31 Forks 20 Commits 4 Opened issues

Description

Monkeypatch to use proper AudioContext naming on prefixed/deprecated named systems.

Services available

!
?

Need anything else?

Contributors list

# 59,704
HTML
JavaScr...
webrtc
webrtc-...
5 commits
# 377,442
Shell
CSS
c-plus-...
astrono...
2 commits
# 224,368
HTML
CSS
Shell
1 commit
# 26,257
Node.js
node
CSS
isometr...
1 commit
# 663,026
JavaScr...
HTML
1 commit

AudioContext monkeypatch

This monkeypatch library is intended to be included in projects that are written to the proper AudioContext spec (instead of webkitAudioContext), and that use the new naming and proper bits of the Web Audio API (e.g. using BufferSourceNode.start() instead of BufferSourceNode.noteOn()), but may have to run on systems that only support the deprecated bits.

This library should be harmless to include if the browser supports unprefixed "AudioContext", and/or if it supports the new names.

The patches this library handles:

if window.AudioContext is unsupported, it will be aliased to webkitAudioContext(). if AudioBufferSourceNode.start() is unimplemented, it will be routed to noteOn() or noteGrainOn(), depending on parameters.

The following aliases only take effect if the new names are not already in place:

  • AudioBufferSourceNode.stop() is aliased to noteOff()
  • AudioContext.createGain() is aliased to createGainNode()
  • AudioContext.createDelay() is aliased to createDelayNode()
  • AudioContext.createScriptProcessor() is aliased to createJavaScriptNode()
  • AudioContext.createPeriodicWave() is aliased to createWaveTable()
  • OscillatorNode.start() is aliased to noteOn()
  • OscillatorNode.stop() is aliased to noteOff()
  • AudioParam.setTargetAtTime() is aliased to setTargetValueAtTime()
  • OscillatorNode.setPeriodicWave() is aliased to setWaveTable()

This library does NOT patch the enumerated type changes, as it is recommended in the specification that implementations support both integer and string types for AudioPannerNode.panningModel, AudioPannerNode.distanceModel BiquadFilterNode.type and OscillatorNode.type.

You can copy the AudioContextMonkeyPatch.js into your project if you like, or include it as http://cwilso.github.com/AudioContext-MonkeyPatch/AudioContextMonkeyPatch.js.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.