Yesterday I wanted to try the Sound.extract() method added in Flash Player 10, I came to this (Flash Player 10 only) little test, where a simple waveform of an external mp3 is rendered.

The power of Sound.extract() is that you can render a waveform of a sound before playing it, which was not the case of SoundMixer.computeSpectrum(). More than that, Sound.extract() is more precise than computeSpectrum().

As you can imagine, you have millions of samples in a usual sound, so if you want to render it you would normally need a huge bitmap that we could scroll.

In fact there are different approaches for handling this, mine was very simple, trick on x-axis and jump some values to get an average wave which is enough here. Just to play with it, you can select an area to loop.

Well in fact this is the kind of thing where we could never stop adding stuff :)

Sources (saved for Flash CS3 but to be compiled with Flash CS4)