PDA

View Full Version : spectrum analyzer



sparkdemon
May 22nd, 2007, 02:58 AM
I have to very urgently create a spectrum analyser in flash. i have to show the animation using a total of 6 bars. flash computespectrum generates values -1 to +1. so how do i create a bar visualization which can have values within 0 to 100, with these values. i am not a physics guy. please help....

note: i dont want to use bitmapData class. only values for normal scaling in y axis

gvozden
May 22nd, 2007, 05:35 AM
I can see (guess) you took a look at my example, Bitmapdata things can be removed results put in 6 bars...

if you can't hendle it I will do it tonite but I would really appriciate if you would try it first
also search google for computeSpectrum example there are bunch of good ones

basic idea is that computeSpectrum returns ByteArray var with 512 values,
256 for left and 256 for right chanell
so if you want to have 6 bars you would have to use arithmetic mean of values 0-41, 42-83 ... and so on (256/6 is 42.667)
and then use createRectangle for displaying bars

dthought
May 22nd, 2007, 06:31 AM
Sounds like someone's having trouble with homework and wants someone else to solve it... amirite? ;)

sparkdemon
May 22nd, 2007, 07:07 AM
you see i am trying to make a application like flashamp. my aim is to process the audio in flash 9.. then take usable values... (not all 512 values) from it into a text file with mdm zinc.

this text file will supplement flash 8 to be able to do sound-animation synchonization in flash 8 or lower.

i am trying on my own with god's grace but cant quiet get it.

//-------------------------------------------------------------------------------
i have done that mean thing with 256 values... i get values like..


14,3,7,12,23,12,29,2,2,7,14,9
-----------------------------
----------------------------
49,9,7,5,12,13,60,15,4,1,8,5
-----------------------------
----------------------------
86,40,32,30,19,21,79,38,25,30,16,12
-----------------------------
----------------------------
36,4,4,8,11,11,46,4,2,3,7,8
-----------------------------
----------------------------
20,0,0,0,0,0,32,1,0,0,0,0
-----------------------------
----------------------------
60,8,8,13,18,11,53,11,8,9,10,6
-----------------------------
----------------------------
33,0,2,5,8,8,32,0,0,0,2,3

//-------------------------------------------------------------------
6 bars each for left and right channels.

is it ok?? the problem is thatspectrum values are like..0.122313 et:- i do i map them between a scale of 0 to 100. i multiplied each value by 200 then took to the mean method... am i going right??