Finally Flash will have built in ability to access the sound output buffer when using FlashPlayer 10 that just has been released.
Tinic Uro have posted a little information about the implementation.
So no more relying on complicated hacks, this is all the code you will need to generate a sine wave (snipped from Tinics post):

var sound:Sound = new Sound();
function sineWavGenerator(event:SamplesCallbackEvent):void {
for ( var c:int=0; c<1234; c++ ) {
var sample:Number = Math.sin(
(Number(c+event.position)/Math.PI/2))*0.25;
sound.samplesCallbackData.writeFloat(sample);
sound.samplesCallbackData.writeFloat(sample);
}
}
sound.addEventListener(“samplesCallback”,sineWavGenerator);
sound.play();

Related posts:

  1. Random thoughts on Vectors and samplesCallbackData
  2. Flash Player 10 Sound API changes, SampleData and SampleDataEvent
  3. PixelBender audio mixer with dynamic track count
  4. Tweaking the samplesCallbackEvent loop
  5. FlashPlayer 10 support in FlashDevelop

One Response to “Sound generation in FlashPlayer 10”

Comments (1)
  1. I posted a dynamic piano with the new SampleDataEvent: http://tinyurl.com/65bzmx

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2011 BlixtSystems Suffusion theme by Sayontan Sinha

Switch to our mobile site