Be a Supporter!

Seamless and loopable MP3's?

  • 417 Views
  • 8 Replies
New Topic Respond to this Topic
deadlyfishes
deadlyfishes
  • Member since: May. 15, 2011
  • Offline.
Forum Stats
Member
Level 05
Musician
Seamless and loopable MP3's? Jan. 11th, 2013 @ 10:11 PM Reply

Well I've spent about two days trying to figure something out when I was doing a soundtrack for an upcomming game on the Apple App/iTunes Store..

Apparently compressed files like .MP3 .ACC .m4a will create "data packages" or something like that in the beginning and the end of your tracks.

I had a seamlessly looping .wav that needed to be converted to a compressed format for the best quality/minimal filesize ratio.

Well, I tried converting it to all of the compressed formats supported by iOS development kits and they all added tiny gaps of silence in the beginning, making it not loop seamlessly.

I have found that .ogg will not do this, but iOS does not support this without some third party library/script that you have to implement into your game development engine.

Unity3D and some others can compensate for this gap, but most others don't.

We are programing in an iOS SDK that uses AVAudio Player for iOS.

iTunes and some media players will also adjust to seamlessly loop MP3's but when you put it into a real audio/game engine program you will find that it has that annoying little skip!

FMOD, Wwise, etc....

I did find a site that explains this:
http://www.compuphase.com/mp3/mp3loops.htm

I didn't get that converter to work sadly.

So all in all, I just decided to make some longer tracks that start and end without seeming like it's just a single song on repeat.

So does anyone else have some input on this? It was very frustrating when I created some AWESOME seamlessly looping tracks that were about 1-2 minutes long, but then I just had to throw that all out the window...

For iOS, it had to be under 40MB, and there's no way 25 minutes of music in an uncompressed format is going to work.

So if anyone has any input on this please share your thoughts and knowledge you may have on this frustrating issue!

Here's a graphic of what exporting a seamless loop looks like after it is compressed to .mp3/.aac (.ogg won't but like I said iOS won't support it right off the bat) --->

Seamless and loopable MP3's?


<Professional Composer> <AudioJungle Reviewer>
OFFICIAL MUSIC SITE!
Check out something I did for NATA 2013! Hikarian's winning NATA 2013 Entry

BBS Signature
Blackhole12
Blackhole12
  • Member since: Sep. 21, 2006
  • Online!
Forum Stats
Member
Level 15
Game Developer
Response to Seamless and loopable MP3's? Jan. 11th, 2013 @ 10:38 PM Reply

If the mp3loop program you used there didn't work, I don't know what to do, as that's the only program I've ever managed to yank loopable mp3s out of. If you absolutely positively must use mp3s, you need to construct your songs so that they have a quiet section somewhere that momentarily drops into silence, which you can then exploit by looping the track somewhere in the *middle* instead of where the track actually starts.

If you can't do that, stop using mp3, because mp3 is a terrible, horrible, no-good piece of shit and this is precisely one of the reasons why. OGG does not suffer from this problem and tends to sound better at higher bitrates anyway. If this requires a third-party script you implement in your game engine, so be it. Surely you guys have some decent programmers? I'm a programmer, I wrote my own audio engine that does seamless OGG looping, it's not that hard. I don't think I've tried it on iOS, though, but that shouldn't change anything because the hardware only understands decompressed audio data anyway, and the decompression is done by software. Any solution that works on the PC should work on iOS if it can compile on it.

deadlyfishes
deadlyfishes
  • Member since: May. 15, 2011
  • Offline.
Forum Stats
Member
Level 05
Musician
Response to Seamless and loopable MP3's? Jan. 11th, 2013 @ 11:35 PM Reply

At 1/11/13 10:38 PM, Blackhole12 wrote: If the mp3loop program you used there didn't work, I don't know what to do, as that's the only program I've ever managed to yank loopable mp3s out of. If you absolutely positively must use mp3s, you need to construct your songs so that they have a quiet section somewhere that momentarily drops into silence, which you can then exploit by looping the track somewhere in the *middle* instead of where the track actually starts.

If you can't do that, stop using mp3, because mp3 is a terrible, horrible, no-good piece of shit and this is precisely one of the reasons why. OGG does not suffer from this problem and tends to sound better at higher bitrates anyway. If this requires a third-party script you implement in your game engine, so be it. Surely you guys have some decent programmers? I'm a programmer, I wrote my own audio engine that does seamless OGG looping, it's not that hard. I don't think I've tried it on iOS, though, but that shouldn't change anything because the hardware only understands decompressed audio data anyway, and the decompression is done by software. Any solution that works on the PC should work on iOS if it can compile on it.

Well I've only came across this issue when working with a developer with many software limitations... I love OGG and have been using that format for a very long time.

In this case I actually ended up doing what you said and exploiting the silenced gap by incorporating it musically in the track.

Do you know how to get that mp3looper program to work? It always tell me there's some sort of input error -____-

Anyways, we're not actually using MP3 format, it's going to be one of the other iOS supported compressed audio file formats, but they do the same exact thing MP3 does.


<Professional Composer> <AudioJungle Reviewer>
OFFICIAL MUSIC SITE!
Check out something I did for NATA 2013! Hikarian's winning NATA 2013 Entry

BBS Signature
Blackhole12
Blackhole12
  • Member since: Sep. 21, 2006
  • Online!
Forum Stats
Member
Level 15
Game Developer
Response to Seamless and loopable MP3's? Jan. 12th, 2013 @ 12:09 AM Reply

The mp3loop works fine for me - are you sure you're giving it an uncompressed WAV file as input? It also requires that you have lame_enc.dll installed - you can just download it and drop the dll in the same folder as the exe, though. Either way, it will only output .mp3 files, so if you aren't using .mp3, you're screwed anyway.

deadlyfishes
deadlyfishes
  • Member since: May. 15, 2011
  • Offline.
Forum Stats
Member
Level 05
Musician
Response to Seamless and loopable MP3's? Jan. 12th, 2013 @ 02:09 AM Reply

At 1/12/13 12:09 AM, Blackhole12 wrote: The mp3loop works fine for me - are you sure you're giving it an uncompressed WAV file as input? It also requires that you have lame_enc.dll installed - you can just download it and drop the dll in the same folder as the exe, though. Either way, it will only output .mp3 files, so if you aren't using .mp3, you're screwed anyway.

UFF. I keep getting this error. Also, you can see the codec in the same directory. The codec installation came with a .exe but nothing happened when I opened it.

Seamless and loopable MP3's?


<Professional Composer> <AudioJungle Reviewer>
OFFICIAL MUSIC SITE!
Check out something I did for NATA 2013! Hikarian's winning NATA 2013 Entry

BBS Signature
Blackhole12
Blackhole12
  • Member since: Sep. 21, 2006
  • Online!
Forum Stats
Member
Level 15
Game Developer
Response to Seamless and loopable MP3's? Jan. 12th, 2013 @ 03:36 AM Reply

At 1/12/13 02:09 AM, deadlyfishes wrote:
At 1/12/13 12:09 AM, Blackhole12 wrote: The mp3loop works fine for me - are you sure you're giving it an uncompressed WAV file as input? It also requires that you have lame_enc.dll installed - you can just download it and drop the dll in the same folder as the exe, though. Either way, it will only output .mp3 files, so if you aren't using .mp3, you're screwed anyway.
UFF. I keep getting this error. Also, you can see the codec in the same directory. The codec installation came with a .exe but nothing happened when I opened it.

If I recall correctly the UI version is screwy. Drag and drop "Arcana Loop Best.wav" on to mp3loop.exe (NOT mp3loopui.exe). This should open up a command line window with a progress indicator and then magically fart out a seamless mp3 file.

samulis
samulis
  • Member since: Jan. 3, 2010
  • Offline.
Forum Stats
Supporter
Level 08
Musician
Response to Seamless and loopable MP3's? Jan. 12th, 2013 @ 12:48 PM Reply

I've always had luck putting the last measure before the first measure of the piece, and the first after the last (copying, that is), then cutting off the start and end, so that the reverb tail plays at the start and the end of the piece is clean to move into the start again. Even with the .mp3 issue, this seems to have very good results, although some developers have opted to have a programmatic fade in on the start of the piece so that the somewhat dissonant reverb tail is not the first thing the player hears... in most cases though, they seem to not mind.

The other option is to have the beginning and end as marcato hit sections, employing either stuccato or marcato articulations or just drums, and have an arc to the flow of your piece, so it rises up in the middle. These two options generally work very well if you try them out a few times and figure it out.

Note that pieces here on NG stated as loops have that tag section skipped if I remember correctly.

For Flash developers, looping is no problem. They can import a .wav as an asset, and flash will handle the conversion into a seamless .mp3 on export.

However, for other developers, I have tried out different filetypes and options. One of the ones I would recommend is .ogg. It's compression is much nicer than .mp3 (sounds better at smaller sizes) and although it is not accepted all over, a dev I have worked with outside of flash was willing to setup the import/playback system for his Java game after we discussed options and decided .ogg would help greatly, not only with looping, but with filesize (the game has a lot of sound and music).

At the end of the day, if you did a good job on the soundtrack, most players WON'T notice it... and won't even notice if it loops or not. Look at Louissi's "Age of War" franchise... he uses a non-looping Videogame song and guess what? No one complains that the song doesn't even loop, nor did people not love the game! When I first learned about the gap, I freaked out and started experimenting and trying to figure out a workaround. When everything is running, people don't really seem to notice, so don't worry too much about plugins and programs unless the music is the focus of the game or the developer you are working with has OCD.

Seamless and loopable MP3's?


My Music - Game Dev./Music Tutorials - Website
Orchestral/Cinematic Composer

BBS Signature
samulis
samulis
  • Member since: Jan. 3, 2010
  • Offline.
Forum Stats
Supporter
Level 08
Musician
Response to Seamless and loopable MP3's? Jan. 12th, 2013 @ 12:52 PM Reply

Oh, and you can also delete the delay and padding at the start and end for a bit closer. Although if you're not careful, you can generate a pop in your loop from the waves at the start and end not linking up... If you loop something mathematically correct in durration, you can also get a pop. I move it a few milliseconds on each end and that gets rid of the pop.


My Music - Game Dev./Music Tutorials - Website
Orchestral/Cinematic Composer

BBS Signature
MaestroRage
MaestroRage
  • Member since: Aug. 22, 2006
  • Offline.
Forum Stats
Member
Level 24
Musician
Response to Seamless and loopable MP3's? Jan. 12th, 2013 @ 06:08 PM Reply

I use mp3Trim myself. Fairly easy to work with.