Search Unity

MP3 audio looping glitch

Discussion in 'iOS and tvOS' started by Recluse, Jul 21, 2010.

  1. Recluse

    Recluse

    Joined:
    May 16, 2010
    Posts:
    485
    I find MP3 background music that loops seamlessly in iTunes, Ableton, etc. always glitches at the point of looping when played in Unity - both in the editor and on the iPhone. Anyone else have this problem and is there a way around it?
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Are you getting this problem with the 3.0 beta? This has been reported a few times (different file formats, etc) and we believe we've fixed the known instances of it. If it still happens with the beta, please can you file a bug report (menu: Help > Report A Problem).
     
  3. Recluse

    Recluse

    Joined:
    May 16, 2010
    Posts:
    485
    No, I'm using 1.7. (haven't had time to try out the Beta yet as I've been focusing on getting my app submitted).
     
  4. jtbentley

    jtbentley

    Joined:
    Jun 30, 2009
    Posts:
    1,397
    Depending on the device, an mp3 can take between 0.05 seconds and 0.2 seconds to re-trigger. (3GS and 3G comparisons, and a 2g is roughly halfway between).

    I figured this out when trying to seamlessly make joke setup and punchlines work in Al Lowe's Comedy Club :)

    If you've got something that requires absolute critical timing, you can't use a compressed format on the iDevices. So either work a way to avoid a seamless loop (perhaps trigger a one-shot sound to mask the loop, this might require a rethink of your music/sound) or find a way to crunch it down to a realistic size and use it uncompressed.. Typically this will mean 22khz mono, and trying to keep it short as possible.
     
  5. Recluse

    Recluse

    Joined:
    May 16, 2010
    Posts:
    485
    That figures. I only use MP3 audio where unavoidable - for background / title music. I can find a workaround - probably just arrange a 1-2 second pause in the composition, so there is no audible glitch.
     
  6. spentak

    spentak

    Joined:
    Feb 11, 2010
    Posts:
    246
    MP3 tracks will always have a small delay before it loops. That is just the way it is. There is no Unity work around for it is an MP3 problem.

    Do this:

    1) go to http://www.compuphase.com/mp3/mp3loops.htm

    2) Download "The MP3Loop utility"

    3) Create a folder on your desktop, unzip the downloaded file and place mp3loop.exe in that folder

    4) Go here: http://sourceforge.net/projects/lame/files/ and download the lame encoder

    5) Put the lame encoder in the SAME folder as the mp3loop.exe

    6) Be extra detailed in your looping of your mp3, make sure there are no gaps at all (zoom in to your track)

    7) Drag your .mp3 track onto mp3loop.exe

    8) A new .mp3 track will be created that eliminates the gap. Use the new mp3!!

    **Note: I have used this tool 20+ times and it works PERFECTLY every time. If you still have a VERY slight gap, it is because you have a gap in your track (that is not created by the mp3 format, but that is created by you). Zoom in on your audio program and remove that gap.[/url]
     
  7. Recluse

    Recluse

    Joined:
    May 16, 2010
    Posts:
    485
    @marklennartprice

    thanks for the link!
     
  8. TobiasW

    TobiasW

    Joined:
    Jun 18, 2011
    Posts:
    91
    For people like me, coming here years later in search* of the fitting LAME encoder for the MP3Loop utility: You'll want version 3.98.2, which you can find here (found on this page, which I found via this page - this was quite the experience). You'll only need the lame_enc.dll from the zip.

    *) It was the second search result for "mp3loop.exe lame". I hope that excuses me posting in a 7 year old thread...