StandingWave is an AS3 code library designed for high level control of Flash Player 10’s SampleDataEvent API for streaming audio output. It is based on a subset of the audio engine used by the Noteflight Score Editor.
The goal of StandingWave is to encapsulate the following kinds of objects, permitting them to be easily chained together and combined to produce complex, dynamic audio output:
- audio sources (MP3 or WAV files, algorithmic sound generators…)
- audio filters (echo, envelope shaping, equalization…)
- timed sequences of audio sources, which may be hierarchically composed
For example, the following code snippet plays a synthesized sine wave with a calculated amplitude envelope:
123 <span class="pln"> </span><span class="kwd">var</span><span class="pln"> source</span><span class="pun">:</span><span class="typ">IAudioSource</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">SineSource</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">AudioDescriptor</span><span class="pun">(),</span><span class="pln"> duration</span><span class="pun">,</span><span class="pln"> freq</span><span class="pun">);</span><span class="pln">source </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">EnvelopeFilter</span><span class="pun">(</span><span class="pln">source</span><span class="pun">,</span><span class="pln"> attack</span><span class="pun">,</span><span class="pln"> decay</span><span class="pun">,</span><span class="pln"> sustain</span><span class="pun">,</span><span class="pln"> hold</span><span class="pun">,</span><span class="pln"> release</span><span class="pun">);</span><span class="pln"></span><span class="kwd">new</span><span class="pln"> </span><span class="typ">AudioPlayer</span><span class="pun">().</span><span class="pln">play</span><span class="pun">(</span><span class="pln">source</span><span class="pun">);</span>There are no fundamental musical concepts embodied in StandingWave, but it may be straightforwardly extended with such, for instance by reading MIDI files or by writing utility classes to manage tones, scales, instruments, and so forth.
Mark一下: http://code.google.com/p/standingwave/
本文对您有用吗? 何不留下评论继续交流?