swfmill
swfmill copied to clipboard
Import MP3s gaplessly
When importing MP3s, read encoder delay and padding information from Xing/Info tag (and equivalents for other encoders) in order to embed the MP3 gaplessly. It will also be necessary to discard broken MP3 frames, ID3 tags and other junk data.
- The
samplesattribute ofDefineSoundneeds to be set to the length of the original audio, which can be calculated asframes * frame_length - encoder_delay - padding. - The first two bytes of sound data (
SeekSamples) form a 16-bit signed integer, which is currently always0. Instead, it should be set toencoder_delay + decoder_delay.
Flash uses the Fraunhofer decoder internally, so decoder_delay is 529 samples.
I’ve written some code to do this in the Flex compiler, which can be adapted: https://github.com/djcsdy/flex-extensions/blob/master/src/net/noiseinstitute/flexextensions/compiler/media/mp3/MP3TranscodeJob.java