Skip to content
gh-pages
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

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.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published