Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luciferous/Sound
Partial JS interface to ActionScript's Sound class
https://github.com/luciferous/Sound
Last synced: 3 months ago
JSON representation
Partial JS interface to ActionScript's Sound class
- Host: GitHub
- URL: https://github.com/luciferous/Sound
- Owner: luciferous
- License: bsd-3-clause
- Created: 2011-07-20T06:07:35.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-01-26T20:48:34.000Z (almost 13 years ago)
- Last Synced: 2024-06-23T19:33:52.978Z (5 months ago)
- Language: ActionScript
- Homepage:
- Size: 117 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-actionscript-sorted - Sound - Partial JS interface to ActionScript's Sound class (Multimedia / Sound)
README
Sound
A Javascript wrapper around AS3 Sound.
## Usage
Load a sound file and play it.
Sound.initialize();
var s = new Sound();
s.load("testsound.mp3");
s.play();
Stream dynamically generated audio.
Sound.initialize();
var s = new Sound();
var factor = (2 * Math.PI) / 44100.0;
var feed = function() {
var samples = [];
for (var i = 0; i < 2048; i++) {
var sample = 1 + Math.sin(i * factor) * 32767;
samples.push(String.fromCharCode(sample));
}
s.buffer(samples.join(""));
setTimeout(feed, 200);
};
feed();