HTML5 AAC Audio Playback Tests - Experimental
Fraunhofer Institute for Integrated Circuits
Gapless Playback
When playing back files with normal fade-in and fade-out, the frame structure of the AAC codec is not noticed. However, if it is desired to loop content or to play files with no silence between them, two issues must be resolved.
First, since AAC uses overlapped windowed transforms to convert the input signal to the frequency domain, the encoding process needs to begin with a frame of silence so the first samples of the content are windowed properly. Encoders insert this frame automatically. The second issue is that the decoder must work with entire frames of data, and the input signal may not end on a frame boundary. Thus, the decoder may output silence at the end of the last frame after the last samples of the content.
Both these issues may be solved by inserting two values as metadata into the bitstream file. One is the start-up delay of the encoder (it could be longer than just the frame needed for windowing) and the other is the length of the original file. With more advanced versions of AAC, such as HE-AAC and Extended HE-AAC, the frame lengths and start-up delay of the encoder may be longer due to the additional processing and transforms needed, and additional adjustments for decoder delays are needed. This metadata may be encoded in the MP4 file according to the MPEG Edit List standard, or for content encoded in iTunes, may appear as metadata in Apple proprietary atoms.
As shown in the diagram below, a player that supports gapless playback can then use two decoders with this metadata to remove the extra samples at the beginning and end of each file, and combine them.
For consumers, gapless playback is only an issue for seque-ed album content where it is desired to access tracks randomly. . Otherwise, the entire album can be encoded as one file. Early MP3 players did not support gapless playback and also could stall when reading album-length files. The Beatles' Abbey Road and Pink Floyd's The Wall are examples of rock albums that benefit from gapless playback.
Today, iTunes/iPod, Windows Media Player, Winamp, and other popular player applications and devices provide gapless playback. However, gapless playback is often overlooked by programmers blindly implementing an audio player, so gapless playback support on early devices (for example Android 2.2) or ones where audio playback is a secondary feature is sometimes missing.
The following files test for proper implementation of gapless playback using metadata according to the MPEG standards. They consist of a sweep signal divided into two segments and encoded seperately. Load them into a player application as part of a playlist. The sweep should be heard as a continuous signal with no interruption or transients at the transition between the two segments.
Gapless Playback Test: first segment second segment (AAC-LC, 44.1 kHz)
Note that HTML 5 support for gapless playback is still under development.