SoundChannel position doesn’t = Sound length

So I recently made an AIR app at work that we use for finding cue points in an mp3 file. It loads an mp3 file, creates the sound wave spectrum for said file and then allows the user to target different locations in the file and output them as cue points. While working on this project I noticed that I was getting weird results on the the location of the play head in the audio file. It was really noticeable at the end of the file. The position property of the SoundChannel object at the end of the file didn’t equal the length property of the Sound object. It was a variable amount of milliseconds behind it. After a beating my head for a while and doing some searching online I realized what the problem was. It was all due to the bit rate at which the mp3 was saved. Anything below 128 was causing it to be off and the amount that it was off varied depending on the bit rate. If it was saved above 128 it was fine, but below caused problems. So if you are playing mp3 files in the Flash Player the ideal settings are 44100 Hz with a bit rate of 128 Kbps or higher. Also just as a side note if you don’t sample it at 44100 Hz the audio actually sounds bad as well. Hope this helps. Flash Player is still the best way to play audio files on the web.

Leave a Reply

Your email address will not be published. Required fields are marked *