PDA

View Full Version : Compute Spectrum Experiment - Advice Needed


equinas
05-19-2008, 05:37 AM
Hi,

I am very much new to AS 3.0 but I have used AS 2.0 for around a year or so.

I have been playing around with a Flash visualization using the soundMixer.computeSpecrtum feature which I found on the web http://www.communitymx.com/content/article.cfm?page=1&cid=8E9A0

I have tried to create a single-line spectrum but have only managed to do this with the lowest frequency so only the leftmost line/bar is drawn.

Is there a way that I could somehow compress entire spectrum into one line/bar?

I have attached my fla and some an mp3 containing percussion samples so you can see how the spectrum is drawn for the lower frequencies.

Any advice on this would really be appreciated.

Thanks for reading,

equinas

helpNeeded=true
05-19-2008, 08:38 AM
The size of the ByteArray object created is fixed to 512 floating-point valuesSo, it's going to be something like:var t:Number = 0; for (var j=0; j<512; j++) t= Math.max (ba.readFloat(), t);

equinas
05-19-2008, 01:55 PM
Thank you very much. That is exactly what I was looking for.

I read around on these forums prior to posting and it seemed that a few people were having trouble creating a similar effect which can only be likened to the Myspace mp3 player which fakes the audio bars. This is absolutely brilliant.

helpNeeded=true
05-19-2008, 02:28 PM
youre welcome, but read the docs prior to searching on the web. also, I think values can be negative too, so do t= Math.max (Math.abs (ba.readFloat()), t);to be sure.