2

I have a project that requires me to display the waveform for a uploaded sound. The sound is always an MP3, most of the time 22.05 kHz mono, with speech only. The project are written with Flex/ActionScript 3. It's meant to run in the browser, but might also consider converting to AIR if that can help.

All examples I've found and looked at for generating a wave, are either doing some visualization in real time as the sound is playing, or, the most promising, as3soundeditorlib, keeps the wave already generated, but does it very slowly, seemingly using as long time as playing through the audio would've taken.

Is there any way to generate the wave faster than real time?

PerfectlyNormal
  • 4,182
  • 2
  • 35
  • 47
  • You might want to edit your question a bit: I *think* you want to know how to draw a pre-existing MP3 onto the screen, but your title implies you want to know how to generate the waveform. – MusiGenesis Mar 14 '11 at 13:23
  • @MusiGenesis better now? I have the sound, and want to generate/calculate/display something like http://www.floom.com/images/waveform_eggs.gif – PerfectlyNormal Mar 14 '11 at 13:33

2 Answers2

2

Once you have a sound object, you can get the raw data into a byte array using the extract method. Then you use the values as your y values and time as your x value, and you have a graph for your wave form.

jswolf19
  • 2,303
  • 15
  • 16
1

I don't do Flex (yet), but here's a C# sample for doing this:

Open source C# code to present wave form?

If you know how to draw simple lines on a surface in Flex, you should be able to translate the C# method:

http://livedocs.adobe.com/flex/3/html/help.html?content=Drawing_Vector_Graphics_1.html

Community
  • 1
  • 1
MusiGenesis
  • 74,184
  • 40
  • 190
  • 334