  | | Re: [FlashComm] R: [FlashComm] Media Player-style Visualisations
in Flash ? | Re: [FlashComm] R: [FlashComm] Media Player-style Visualisations
in Flash ? 2004-03-05 - By Jim Cheng
Back Ben Silburn wrote:
> I'm trying to put this into the context of using with FlashComm, which will > be streaming mp3 audio. > > There could be two methods of getting the spectrum data: > > 1. The Flash movie does all the work direct from the mp3 stream > + easiest to implement on the server side (ie no work at all) > - from what I've heard on this thread its not possible (a Flash/FlashComm > limitation) > - might be CPU intensive when the client will be busy enough drawing the > visualisation > > 2. The server does the work (off-line or in real-time) > + no pressure on the client CPU > + only done once for each track regardless of number of clients connected > - additional bandwidth to send extra data on top of the mp3 audio > > > sounds like 2 is the best option.
Method 2 is superior by far. Flash is dog-slow when it comes to doing the trigonometric calculations you'll need for FFT (Fast Fourier Transform, the mathematical operation needed to generate frequency spectrum data for an EQ display). Believe me, you don't want to be doing *many* trigonometric calculations with Flash.
Like you've said, you'll also run into problems with Flash not having direct access to the byte stream due to the limitations of the base Flash Player. You could probably use Screenweaver or something similar and proxy and save the byte stream in C++ or something so that Flash can read from it, but now you're limited to a standalone player and for what it's worth you might as well do the FFTs in native code on the client machine).
If you're looking for a free (as in beer *and* speech), consider using sox and python (with the numerical modules) to do it. You can decompose a MP3 to a text file describing the samples, pass segments (say, every 1/12th of a second to match the frame rate) through the FFT to get spectrum data and write it back to a text file. This can be cached for each subsequent request for a MP3's spectrum data and can be progressively downloaded even without Flashcom. Say, with a server-side script that sends portions of the spectrum data at a time delimited by null bytes and XMLSocket on the Flash end to process and/or save the data. If you're truly brave or crazy, you can probably even stream it (though you will probably need to write a custom HTTP server so to monitor the TCP/IP data transmission rate and adjust your data packet sizes accordingly).
See: http://www.acronymchile.com/sigproc.html
Jim
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Supported by Fig Leaf Software -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Lower Prices for Certified Training! Check out new lower prices for Certified Macromedia Training from Fig Leaf Software. Expand your skill set with courses in ColdFusion, Flash, Rich Internet Applications and .NET in the new year. Fig Leaf Software provides the highest caliber instruction at our training centers in Washington D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location.
Get the details at http://training.figleaf.com/ -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: flashcomm-unsubscribe@(protected) For additional commands, e-mail: flashcomm-help@(protected)
|
|
 |