Reputation: 75
I'm looking for PHP class which will take an audio file and them return an image file of the waveform - similar effect can be seen here http://soundcloud.com/rollin-fire-cru/sets/house-house-house-house/
It should run on a linux server and accept the following audio file formats: mp3, mp4, aac, wav
I found an example class, but it does a very basic job http://phpclasses.ca/package/482-PHP-Extracts-attributes-of-audio-files-Visualization.html
Any help will be highly appreciated!
Upvotes: 4
Views: 989
Reputation: 96258
All sane sites does this as a background job, preferably in a faster language (e.g.: C++).
You have to decode all the formats to raw audio (wav), then create an image from that. Preferably on the fly meaning as soon as you decode a chunk of audio you draw the image for that chunk. Most codecs compress the data to 5-20% of the original size, so if you have a 10M file you suddenly have 50-200M of raw data... and if you have a 100M DJ mix.. well.. you get the point.
After the background process finished, you can simply serve the generated image with your favorite web-server.
Although it's possible to do all of this in PHP I wouldn't recommend it.
Upvotes: 2