1

I am trying to create an M4A (MP3) audio track which must loop without audible gap.

I've heard that compressed audio is padded with silence at the end to fill up missing samples in a block of compression. In order to loop perfectly the file must have a multiple of 1024 samples before it gets compressed.

Which program for the Mac supports making audio loop perfectly?

4 Answers 4

1

You can use the LAME MP3 encoding, which supports seamless looping
http://lame.sourceforge.net/index.php
(LAME has to be supported by the playback software though for this to work)

Or given that MP3 is not a must, you could also use Ogg Vorbis.

1
  • Yea, jumping in on what @Internet Human said, you have to check what your playback capabilities are on all of these. Ogg does have the ability to loop seamlessly, but it may not work out of the box on whatever your system is.
    – Dave
    Apr 26, 2013 at 3:37
1

http://www.compuphase.com/mp3/mp3loops.htm

1
  • this! part 2 especially.
    – georgi
    Apr 26, 2013 at 15:05
0

Most compressed audio codecs (for listening anyway) I don't think will. MP3 probably supports that in game engines or something though.

Can you give an example of whaty ou're trying to do? Maybe there may be a better answer.

0

Supposedly LAME has a seamless looping feature using the "--nogap" command, but I haven't had much success with it in the past. Here's some additional info on it:

http://www.rockbox.org/wiki/GaplessHowTo

From what I've gathered the "--nogap" command was intended to take a set of multiple files (i.e. a CD album) and encode each one while taking into account the beginning frames of the subsequent file, providing overlap data that should make the transition seamless. So the trick is rather than using multiple different tracks, you make a COPY of the seamless looping file, and specify both of those so that the overlap data from the start of the second track happens to be identical to the start of the looping track.

The command line call you would use to perform this looks something like:

lame -v --nogapout output --nogap loop.wav loopcopy.wav

Which would create loop.mp3 and loopcopy.mp3, and you would simply discard loopcopy.mp3 (I've also tried this using three copies, keeping only the middle MP3, with no difference in result).

While I will say this command seems to work better for looping than the standard encoding of MP3, I find there's usually still a slight pop at the loop point and it's rarely truly seamless.

Really the only times MP3 looping is consistently successful, is when the playback platform supports seamless looping and applies the MP3 conversion itself. In other words even if you were to convert a looped audio file to a "gapless" MP3 yourself and load it into these platforms, the seamless looping likely wouldn't work. For example both FMOD and Unity (powered by FMOD) have the ability to provide seamless looping using the MP3 format, however in order for this to work you must still use the uncompressed asset (WAV/AIF) in the build, and let the platform create the MP3 itself in the build process (in Unity you have to additionally enable the Gapless MP3 algorithm for each individual asset). In Adobe Flash, importing the looped WAV file and using the publish settings to compress it to MP3 gives a much more successful result than loading and looping an MP3 file externally. In all of these cases the length/samples of the looped file has never made a difference in my experience, as a loop capable platform usually employs a special compression algorithm that accounts the frame size and encoding delay issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.