Monkeypatch to use proper AudioContext naming on prefixed/deprecated named systems.
JavaScript HTML
Latest commit 40566e8 Sep 23, 2015 @cwilso Merge pull request #16 from kirbysayshi/ksh/ios9
Fix .start for iOS9. #15
Failed to load latest commit information.
AudioContextMonkeyPatch.js Fix .start for iOS9. #15 Sep 23, 2015 Updated the README Aug 29, 2014
index.html Initial Commit Mar 27, 2013

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