Looping Music in Aleph One pre-1.7
For the record, I’m not talking about the music restarting after it fades out – Aleph One does that by default. I’m talking about seamless loops, where the ending leads straight back into the beginning. Aleph One could do this before version 1.7, but it was very finicky and dependent upon a few things:
- It didn’t work with MP3 files, only Ogg Vorbis, WAV, AIFF, and (in Aleph One 1.6.1) FLAC. The reason for this is that MP3 inserts junk samples at the start and end of a track, and Aleph One’s music player didn’t know enough to skip these. Transcoding directly from MP3 to one of these other formats wouldn’t help; you’d need to edit the junk samples out and save as another format. If you plan to save an edited MP3 as Ogg Vorbis, I recommend following my procedure for upmastering audio to mitigate generation loss. (To be clear, upmastering can’t produce perfect repliche of the sounds MP3 compression stripped out – that’s impossible. You should definitely use lossless audio sources if suitable ones are available.)
- By default, Aleph One parses audio files in 1,024-sample chunks (roughly 23 milliseconds with a 44.1 kHz sample rate) and won’t reload the audio file (or load the next file) until it’s in the final sample block. Annoyingly, the chunk size can vary based on a setting in the preferences file (and you must actually load the preferences in a text editor to see the setting), but it’s usually 1,024 or 512 (thus, I’m oversimplifying here and assuming 1,024-sample blocks).
Thus, in this case, the number of samples modulo 1024 should be as close to 1023 as possible. (You can find out how many samples your music file has in any audio editor worth its salt.) In other words, the ideal number of samples for a loop is (1024 × n) − 1, where n is some integer. It’s acceptable for it to be (1024 × n) − 2, (1024 × n) − 8, (1024 × n) − 4, and so on, but the more the distance increases, the longer and more perceptible the delay gets. The longest delay results from 1024 × n samples.
Manipulating your song’s length by fewer than 23 milliseconds probably won’t audibly affect the rhythm if you’re careful to fill up the space you add with audio information that isn’t out of place, or to trim audio congruously. (iZotope RX’s Interpolate function can help to generate audio that will fit.) If silence ends up getting tossed into there, though, you’ve got a problem. - Songs must start and end at zero crossings – in both channels, for stereo audio. A zero crossing is a point where the waveform crosses the midpoint (i.e., −∞ dB). Here’s an example in iZotope RX (zoomed in quite a lot both vertically and horizontally to make it clearly visible).
- Even this may be insufficient to get a seamless loop, so I recommend avoiding especially loud starting points. A cymbal crash, for example, is far from ideal. An acoustic guitar strum is better.