Sound Spectrogram to Text File

A simple Flash tool for video creators working with mp3 files.

// This is a little quick and dirty free tool to get a complete spectrogram of an mp3 song in a // form that's easy to import into other programs. It is for those who are doing non-realtime // video animation synchronized to music who need spectral data for an entire song in an easy to // read and use, video-friendly form. // This application plays back an mp3 audio file while sampling the Flash computeSpectrum() // function once for every frame of video (you can select your own frame rate). Since it gets // its spectrograms in real time it's only really useful and accurate for this purpose if your // computer can keep up. If it can't keep up, it will do its best to fill in the blanks with // the most recent successful spectrum reading. // After the audio playback is complete, the entire spectrogram is written out to a comma-delimited // plain text file where each line in the text file is a list of the power levels in each of 256 // bands for a single video frame. The power levels are floating-point values between 0 and 1. // The line number in the text file corresponds to the frame number in the video. The text file is // named "MP3_Spectrum.csv" and is stored in the users "Desktop" directory. // On my graphics card and PC, I'm able to draw the spectrogram for each frame without missing // frames, but if you have a slower graphics card or computer, you may want to disable the drawing // of the spectrum by clicking on the black "Show Spectrum: Yes/No" button in the middle. // When I get a little more time and experience I'll do a non-real time version of this that is // guaranteed to sample every frame without worrying about the constraints of keeping up with // real-time sampling. For now, I'm just really thankful that Adobe added the computeSpectrum() // function to Flash 10 and above so the not so mathematically inclined among us can finally have // access to this very interesting data. I hope this little utility helps in your music video // creations! // The compiled application is the file that ends in ".air" and can be played back when you install // the Adobe AIR player, which can be downloaded here: http://get.adobe.com/air/ // Ken Meyering, April 4, 2010 // 2/22/2011 Updated to plot average amplitude and put data into a format with column headers that // can be imported into databases such as MySQL. Also added SQL script to load data into multiple // MySQL tables.

Index of /spectrogram