GithubHelp home page GithubHelp logo

waapisim's Introduction

WAAPISim : Web Audio API Simulator

WAAPISim is a 'WebAudioAPI' polyfill fallbacking to the 'Audio Data API', or Flash.
In addition, even in WebAudio API ready browsers, add some latest method name for node-creation and start/stop if the browser does not support these method name.

WAAPISim automatically check the availability of APIs:
WebAudioAPI => AudioDataAPI => Flash

  • Chrome : WebAudioAPI is supported. WAAPISim do nothing.
  • Safari (include iOS) : WebAudioAPI is supported but old method name is used. WAAPISim add new method name for node-creation, start/stop and setTargetAtTime.
  • Firefox : Simulate using AudioDataAPI
  • Opera : Simulate using Flash
  • MSIE : Simulate using Flash. Float32Array is assigned to normal Array(IE9).

For more detail: http://www.g200kg.com/docs/waapisim/

WebAudioSynth running on MSIE

Some Links of Test-pages

Try these pages with Firefox/Opera or MSIE.

Node test (Oscillator/ScriptProcessor/BiquadFilter/WaveShaper/Panner/Analyser)
Compressor test
AudioParam Automation test
ChannelSplitter/ChannelMerger test
Oscillator custom waveform test

Shiny Happy MIDI Drum Machine (MIDIDrums) (by Chris Wilson + (Chris Rogers and Ken Moore)) with WAAPISim
http://g200kg.github.com/MIDIDrums/ forked from https://github.com/cwilso/MIDIDrums

WebAudioSynth (by aike) with WAAPISim
http://g200kg.github.com/webaudiosynth/ forked from https://github.com/aike/webaudiosynth

Current Status

  • Support : OscillatorNode / ChannelSplitterNode / ChannelMergerNode / AudioBufferSourceNode / WaveShaperNode / AnalyserNode / GainNode / BiquadFilterNode / DelayNode / DynamicsCompressorNode / PannerNode / ScriptProcessorNode / ConvolverNode

  • Not Support : MediaElementAudioSourceNode / MediaStreamAudioSourceNode / MediaStreamAudioDestinationNode / OfflineAudioCOntext

  • ConvolverNode : By performance reason, convolution is executed for only IR's first 1000 samples. Sebsequent part will be replaced as simple delays.

  • PannerNode : Simplified. Listener position should stay default. Source positions are interpreted as x-z 2d coordinate.

  • ScriptProcessorNode : Input buffer size should be 1024 and under (No limitation if use output only)

  • DynamicsCompressorNode : A little different characteristics from Chrome's implements.

  • Number of channels in each nodes should be 1 (mono) or 2(stereo)

  • createBuffer from ArrayBuffer and decodeAudioData supports only wav format.

  • k-rate AudioParam controls are executed only per 1024 samples frequency. a-rate AudioParams are controlled by sample.

Usage

Load the 'waapisim.js' before using the Web Audio API functions in your script.

<script type="text/javascript" src="waapisim.js"></script> or <script type="text/javascript" src="waapisim.min.js"></script>

To enable fallbacking to Flash, place the 'waapisim.swf' file to same folder as 'waapisim.js'.

Options

These lines should be specified before loading the 'waapisim.js'

<script type="text/javascript">waapisimLogEnable=1;</script>
Enable internal log info to console.

<script type="text/javascript">waapisimForceSim=1;</script>
Enable WAAPISim even if native WebAudioAPI is available.

<script type="text/javascript">waapisimForceSimWhenNotWebkit=1;</script>
Force enable WAAPISim when non-webkit browser.

  • some versions of Firefox have WebAudioAPI interfaces but not implemented completely (e.g. custom waveforms). Some apps may work better on Firefox with this flag.

<script type="text/javascript">waapisimForceSimWhenLackOsc=0;</script>
Disable WAAPISim if native WebAudioAPI is available even lacking oscillator function (means Firefox 23). This flag is default on (=1).

  • FIrefox 23 or ealier 's WebAudioAPI (need about:config flag setting) is very tentative. In default, WAAPISim ignore this version of WebAudoAPI.

License

Copyright (c) 2013 g200kg
http://www.g200kg.com/

Modified by Loguehttp://logue.be

Released under the MIT License

waapisim's People

Contributors

capnmidnight avatar g200kg avatar logue avatar signpostmarv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

waapisim's Issues

[enhancement] Add missing bower.json.

Hey, maintainer(s) of g200kg/WAAPISim!

We at VersionEye are working hard to keep up the quality of the bower's registry.

We just finished our initial analysis of the quality of the Bower.io registry:

7530 - registered packages, 224 of them doesnt exists anymore;

We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

Sadly, your library g200kg/WAAPISim is one of them.

Can you spare 15 minutes to help us to make Bower better?

Just add a new file bower.json and change attributes.

{
  "name": "g200kg/WAAPISim",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "description": "please add it",
  "license": "Eclipse",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<dependency_name>": "<semantic_version>",
    "<dependency_name>": "<Local_folder>",
    "<dependency_name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

NB! Please validate your bower.json with jsonlint before commiting your updates.

Thank you!

Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!

AudioBuffer の各 channel に直接値を代入すると鳴らないかノイズが走る

もう IE 以外のほとんどのブラウザで Web Audio API が使えるので、WAAPISim のサポートをされていないかもしれませんが、自分としては IE10~11 でも Web Audio API が使えるようになって欲しいと思っていますので報告させてください。

例えば以下の様なコードを書いた場合、IE10 では音がなりませんでした。

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <title>AudioBuffer Test</title>

    <script src="js/waapisim.js"></script>
</head>
<body>

    <button id="play">play</button>

    <script>
(function() {

    // make white noize buffer
    var ctx = new (window.AudioContext || window.webkitAudioContext)();
    var audioBuffer = ctx.createBuffer(2, ctx.sampleRate * 2, ctx.sampleRate);

    for(var c=0; c<2; ++c) {
        var buffering = audioBuffer.getChannelData(c);
        for(var i=0; i<ctx.sampleRate * 2; ++i) {
            buffering[i] = Math.random() * 2 -1;
        }
    }

    // play
    document.getElementById("play").onclick = function() {
        var source = ctx.createBufferSource();
        source.buffer = audioBuffer;
        source.connect(ctx.destination);
        source.start();
    };

})();
    </script>

</body>
</html>

もしよろしければ、修正をお願いします。

最新の Web Audio API に近づけてほしい

playbackState がなくなるなど、若干 Web Audio API の仕様が変わってきていると思います。
是非、WAAPISim での polyfill 対応を新しくしてほしいと思います。

Problem with the flash fallback (using IE11)

Hi,

I'm using the module, which is great - thanks alot for the work!
I have an issue using it in IE, while in chrome - the same code works perfect.
this is my code:

onMoreData(data) {
var typedArray = new Float32Array(data);
var myArrayBuffer = this.context.createBuffer(2, typedArray.length / 2, 44100);
var channel_1, channel_2;
if (typedArray.slice) {
channel_1 = typedArray.slice(0, typedArray.length / 2);
channel_2 = typedArray.slice(typedArray.length / 2);
} else {
channel_1 = typedArray.subarray(0, typedArray.length / 2);
channel_2 = typedArray.subarray(typedArray.length / 2);
}
myArrayBuffer.getChannelData(0).set(channel_1);
myArrayBuffer.getChannelData(1).set(channel_2);
const source = this.context.createBufferSource();
source.buffer = myArrayBuffer;
source.connect(this.context.destination);
source.start(this.startTime);
}

The input is received on the wire as a single buffer of floats, RRRRRRLLLLLLLL, sample rate of 44100, raw PCM data, 1024 sampled each time, 2 channels.

So as i said, when using the waapisim in IE - it sounds very bad... any idea what i'm doing wrong?

Thanks alot for your help

Chrome on Android 4.0

Tried to get this to work on android 4.0 using chrome but no dice. Any suggestions?

Not working for my site on IE

Hey,

I downloaded the files that you uploaded here. But when I include it in my JS, it doesn't work. It says WAAPISim.SWF loaded, but no sound comes. Are there any other dependencies to be added? Could you walk me through the process?

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.