Hey guys,
I'm just digging into the Sound.extract feature in FP10. I've been using code found at http://www.bytearray.org/?p=329 to learn from, but have a few questions. I'm able to create a waveform and draw to the stage, but want to take it beyond that.

Basically the code I have is this:

               var samples:ByteArray = new ByteArray();
var extract:Number = Math.floor ((_sound.length/1000)*44100); _sound.extract(samples, extract); var step:int = samples.length/4096;
               do step-- while ( step % 4 );

               samples.position = 0;
for (var c:int = 0; c < 4096; c++) {
                   left = samples.readFloat();
                   right = samples.readFloat();
                   samples.position = c*step;
               }

My questions are:

1. I understand incrementing the byteArray read position by a step amount. What I don't understand is why the step amount needs to be a multiple of four? I get some very wacky results from my readFloat() if I don't do this.

2. Anybody know why the number of samples we're taking is a power of two? Is this important, maybe just for graphic performance?

3. Here's the big one - is it possible to isolate amplitude at certain frequencies - to get something like you'd get from computeSpectrum? I guess I'm overly confused by the data I'm getting back from the byte array and how to dig deep with it. The way I imagine this byteArray in my head is that each position in the byteArray, one by one, would be a composite amplitude of all frequencies at a small point in time. I think I must be imagining this data wrong - and you'll probably cringe at my composite amplitude remark cause it'll probably make no sense.

Thanks - and again, I really think I have some huge knowledge gap in how sound data is used and read. Can anyone help?
ben
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to