GithubHelp home page GithubHelp logo

stephenroddy / audiocontext-monkeypatch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cwilso/audiocontext-monkeypatch

0.0 1.0 0.0 155 KB

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

JavaScript 93.98% HTML 6.02%

audiocontext-monkeypatch's Introduction

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.

audiocontext-monkeypatch's People

Contributors

andrewmalone avatar cwilso avatar jipodine avatar kirbysayshi avatar stuartmemo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.