I'm a music composer and I have to give my first job for a game. They are working in Objective C in Xcode, it's a game for iPhone/iPad.

I need to know the proper audio format to give programmers since .mp3 or .aac make gaps at the start and end of the loop and .Wav or .Aiff are too heavy.

I'm working in Windows7 with Sony Sound Forge and Audacity.

  • \$\begingroup\$ Would require more details to be answered. You could have a look at this link bobulous.org.uk/misc/lossless_audio_2006.html \$\endgroup\$ – Ubermensch Jan 18 '12 at 14:53
  • 4
    \$\begingroup\$ Piluso we can't guess what format the programmers are expecting, there are many valid options. Did you try asking them? \$\endgroup\$ – Zaphod Beeblebrox Jan 18 '12 at 15:09
  • 1
    \$\begingroup\$ They are working in Objective C in Xcode. \$\endgroup\$ – Piluso Jan 18 '12 at 15:23
  • 1
    \$\begingroup\$ I'm pretty sure that mp3 can be made to loop without gaps. Try stripping out all ID3 / ID3v2 tags or any other metadata which your software is adding. \$\endgroup\$ – Peter Taylor Jan 18 '12 at 15:46
  • 1
    \$\begingroup\$ As @PeterTaylor said, usually the gaps are because people are either not properly buffering the data or are buffering the header. Compensate for those and the format should not really matter as long as its supported by the hardware. \$\endgroup\$ – James Jan 18 '12 at 21:00

This is up to your programmers. If they don't know, they are confused. The programmers decide what type of compression is acceptable and you decide within that compression what the sample rate will be.

For instance.

  • WAV is never used by a sane person in IPhones because of their uncompressed size. Though it is never in a final game, some programmers will compress themselves so this is a possible format.
  • MP3 is a likely candidate if they are ok with slightly larger files than what is possible but require instant loading of music. So no runtime decompressing is allowed.
  • OGG is what I prefer but it has some overhead if you want to decompress it on load. A lot of IPhone developers will prefer this because a general goal is to get your file size under 20MB if possible. In my case, 18 of that is reserved for everything besides music. The problem with OGG is the decompression time can take a little bit. So for this you generally have a MP3 file of a short loop to play until the main loop is decompressed.

All of these possibilities require some knowledge of audio on their parts. If they don't understand that, it's your job unfortunately to explain the differences. Otherwise, give them a lossless clip and have them figure it out.

NOTE: Keep in mind a lot of audio software adds gaps on purpose. These gaps are to zero out the wave on the clip. If you had the amplitude at anything over zero when your clip starts, the speakers will pop. Sometimes the software overcompensates and adds an unloopable gap. Open the clip in a raw wave editor like audacity and cut out the extra space and make sure you still start and end at zero amplitude.

  • \$\begingroup\$ Opened the .mp3 clip in a raw wave editor, cut out the extra space. Saved. When i open again the gap is still there! \$\endgroup\$ – Piluso Jan 18 '12 at 17:47
  • \$\begingroup\$ Did you fade the beginning to 0? I know audacity will save the wave exactly as you edit it so I would advise using that if you still have the issue. Otherwise I don't know. I've experienced the issues you are talking about with one of my audio guys before and the above solved the issue. \$\endgroup\$ – brandon Jan 18 '12 at 18:40
  • \$\begingroup\$ Pretty sure MP3 as a standard is hard to get gapless due to the way the encoding works. Something about having to have a certain multiple of blocks. Getting gapless playback with that format is dependent on the player itself either supporting meta data or cutting playback of dead sound, or something. \$\endgroup\$ – Tetrad Jan 18 '12 at 22:06
  • \$\begingroup\$ @Tetrad, good point, as a note we fixed this by using timing for playback of loops which was painful but worked \$\endgroup\$ – brandon Jan 18 '12 at 23:37
  • \$\begingroup\$ First of all @brandon i'll take "This is up to your programmers". Whether I can know which format is appropriate, and i'm learning about it, they should know in order to insert it into their working platform. And what do you mean with "zero amplitude"? \$\endgroup\$ – Piluso Jan 19 '12 at 21:05

Unless they have requested otherwise the proper format to give to the programmers is lossless at the sampling rate and bit depth you have used for composition. Choosing a format and making it play properly is not your job. You could do the encoding, but only if the receiver know what he wants.

This is pretty global for all game content, you don't ship jpegs around internally either.

  • \$\begingroup\$ Thank you. Your words are constructive for me. I think the best way is give them .wav files and they decide. I have reported it to them and found it a good idea. \$\endgroup\$ – Piluso Jan 19 '12 at 21:15

I suggest giving them lossless. It should be up to the developers to convert to the format they need.

FYI, in iOS, AC3 doesn't have gaps during looped playback, and I believe MP3 no longer does either. (Source: game I'm working on w/CocosDenshion as my audio engine.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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