Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/korilakkuma/actionaudioapi
ActionScript 3.0 Library like Web Audio API
https://github.com/korilakkuma/actionaudioapi
Last synced: 20 days ago
JSON representation
ActionScript 3.0 Library like Web Audio API
- Host: GitHub
- URL: https://github.com/korilakkuma/actionaudioapi
- Owner: Korilakkuma
- License: other
- Created: 2015-01-29T08:51:44.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-19T05:38:31.000Z (about 9 years ago)
- Last Synced: 2023-07-31T12:57:49.912Z (over 1 year ago)
- Language: ActionScript
- Size: 258 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Action Audio API
=========
ActionScript 3.0 Library like [Web Audio API](http://webaudio.github.io/web-audio-api/)
## API### AudioContext
* [AudioContext](http://webaudio.github.io/web-audio-api/#the-audiocontext-interface)
The 1st, it is required the instance of AudioContext is created.
import audioapi.AudioContext;var context:AudioContext = new AudioContext(stage.frameRate);
trace(context.sampleRate); // 44100 Hz
trace(context.currentTime); // http://webaudio.github.io/web-audio-api/#the-audiocontext-interface
trace(context.destination); // the instance of AudioDestinationNode (http://webaudio.github.io/web-audio-api/#the-audiodestinationnode-interface)
### OscillatorNode
* [OscillatorNode](http://webaudio.github.io/web-audio-api/#the-oscillatornode-interface)
The instance of OscillatorNode is created by createOscillator method.
import audioapi.AudioContext;
import audioapi.audionodes.OscillatorNode;var context:AudioContext = new AudioContext(stage.frameRate);
var oscillator:OscillatorNode = context.createOscillator();
oscillator.connect(context.destination);
oscillator.start();
### GainNode
* [GainNode](http://webaudio.github.io/web-audio-api/#the-gainnode-interface)
The instance of GainNode is created by createGain method.
import audioapi.AudioContext;
import audioapi.audionodes.OscillatorNode;
import audioapi.audionodes.GainNode;var context:AudioContext = new AudioContext(stage.frameRate);
var oscillator:OscillatorNode = context.createOscillator();
var gain:GainNode = context.createGain();oscillator.connect(gain);
gain.connect(context.destination);oscillator.start();
### AudioBuffer / AudioBufferSourceNode
* [AudioBuffer](http://webaudio.github.io/web-audio-api/#the-audiobuffer-interface)
* [AudioBufferSourceNode](http://webaudio.github.io/web-audio-api/#the-audiobuffersourcenode-interface)
The instance of AudioBuffer is created by decodeAudioData method.
The instance of AudioBufferSourceNode is created by createBufferSource method.
import audioapi.AudioContext;
import audioapi.AudioBuffer;
import audioapi.audionodes.AudioBufferSourceNode;import flash.events.Event;
import flash.media.Sound;
import flash.net.URLRequest;var context:AudioContext = new AudioContext(stage.frameRate);
var sound:Sound = new Sound();
sound.addEventListener(Event.COMPLETE, function(event:Event):void {
context.decodeAudioData(sound, function(audioBuffer:AudioBuffer):void {
var source:AudioBufferSourceNode = context.createBufferSource();source.buffer = audioBuffer;
source.connect(context.destination);
source.start();
}, function():void {
});
}, false, 0, true);sound.load(new URLRequest('sample.mp3'));
## License
Copyright (c) 2014 Tomohiro IKEDA (Korilakkuma)
Released under the MIT license