Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

mp3 or wav file for sound effects? (for mobile devices)

Discussion in 'Audio & Video' started by whistler, Dec 17, 2014.

  1. whistler

    whistler

    Joined:
    Apr 15, 2013
    Posts:
    15
    Hi,

    I've a question for the experienced game makers. I'm not sure which sound type to use.

    I believe using wav files is better since it has no compression, cpu on the mobile device dont need to use cpu cycles to decompress the file to use it. But I'm not sure.

    On the other hand, using wav files takes up much space so there will be a memory issue.

    So which sound format should I use for sound effects? Wav files (22hz is enough for my game) or mp3 files?

    I know for iphones it does not matter but I 'm developing for androids. So if you know anything about this issue, please do share.

    Thanks in adv.
     
  2. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Your source assets should all be uncompressed in the project (i.e. wav, aiff, etc). For mobile, you generally want shorter, SFX like sounds to be ADPCM compressed (somewhat compressed, but cheap on the CPU) and long, music like sounds to be aggressively compressed with MP3 or OGG.
     
  3. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    PS - This is a good pattern for iOS, too.
     
  4. drudiverse

    drudiverse

    Joined:
    May 16, 2013
    Posts:
    218
    on iOS for example, the sound gets all uncompressed for playback on the native sound. so it's about download size, memory is the same. native ios is 24khz i beleive?

    After that, if you have a 160 kbps mp3 and you apply echo to it, it shouldnt sound different to uncompressed, not much i dont think. however the more you send it through sound processing the more the original fine quality , bit rate and depth 16 bit 32 bit impacts the sound. for 1-2 effects compressed is fine, test it you wouldnt hear practically any difference. but through FFT or vocoder or some effects it could need hifi base sound.
     
  5. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    I don't believe that is correct. Most iOS devices have a single hardware decoder that can handle one MP3 track. Everything else has to be decompressed on the CPU. This can happen at load time or on the fly depending on the Load In Memory/Decompress in Memory/Stream settings.
     
  6. Tazman

    Tazman

    Joined:
    Sep 27, 2011
    Posts:
    94
    MakeCodeNow is right .... older versions of Unity used to lock the software mixer on mobile devices at 24Khz but that's no longer the case.

    I agree as well that the best method is to have your audio assets uncompressed in your project and then choose which one Unity should compress according to their length/quality etc and always trying to balance memory vs CPU usage (using the audio profiler is a must).... as far as I know Unity 4.x doesn't support ADPCM but it is in 5.0 which is great.