AudioClip Stability on iPhone!?

I am loading and playing a bunch of different loops based on their duration:

track_duration = Time.time + audio.clip.length;

which works great in the editor but not on the iPhone. It plays them sometimes and sometimes not. I really need to avoid using a compressed .mp3 file for my audio since Time.timescale does not affect it.

Anyone have any ideas?

FYI - I was using LoadLevelAdditive() and thought that it might be causing a problem but I just put the GO in the scene and behaves exactly the same.

i have the same problem. it seems dependent to certain files. you could try changing the files which are affected, as in adding silence at the end, or cutting 2 or 3 frames away, anything which changes the file, even trying different formats, as in 44khz/22khz mono/stereo. sometimes it helps… unfortunately sometimes not.

Hi, Thought I’d chip in here with my ongoing audio iphone issue.
background similar to yours I was originally loading different clips into a single audio source depending on the SFX needed wasn’t too worried about playing >1 clip at a time so didn’t go the multiple audio source preset with a clip route.

I have been at this problem for like 2 days solid now, having tried a number of different approaches.
It just seems that the iphone is real picky about the wavs it can play, I have in particular 2 wavs which I’ve been trying to get this thing to play and it just doesn’t want to know (at least in a reliable sense, in some cases it occasionally plays them depending on how it feels)

both of these clips are extremely short chirps to represent a player taking a turn
I have tried a load of approaches and am resigning myself to the fact that the chirps I was going to use just aren’t going to work, I’m hoping that if I can find a 1/2 second clip or longer that they’ll work better.

/edit
btw the problematic sound effects (3 in total) were all v.v. short ie <.05 of a second long.
one which was .04 of a second was the least problematic
I’m going to dload audacity (if its available for mac try padding with silence before writing these particular sounds off.

Be careful on the format of your .wav too, there are many different types of wav, and not all are respecting the standard.

I can’t change the length of them because they are loops that I am putting together to sound like a custom track. All of my files are .aif 22khz stereo and they all play sometimes, just not every time that I call them.

I was leaning towards the fact that it may have already removed them from memory once it finishes playing it but they don’t start the first time they called either 50% of the time and I know for a fact they are loaded. Well the GO is loaded and they are all attached to the script on it. It isn’t firing any exceptions.

It really sounds like Unity needs to step up and fix these audio issues. It may be the iPhone hardware but I highly doubt it. It has a separate chip just for processing audio. Unity NEEDs to start releasing fixes for this software. Memory leaks and audio issues are killing my production cycle.

I have already programmed this audio system 3 different ways thinking that I was doing something wrong. Now I know for a fact it is broken. Unity, please give us some fixes!! The 3.0 SDK makes me feel like these fixes are going to take even longer now because they are going to hold off until they have included a bunch of new stuff that I really don’t need right now. I think we all need and expect things that are broken and already fixed to be released. The production cycle and competitive nature of the app store demands that we can make changes rapidly and keep up with competitor and user demands. This is bs.

I stripped the whole game down to just the Audio to make sure that it was in fact broken before I submitted a bug report. Hopefully they can solve this quickly or provide a beta build that fixes the problem as they have mentioned that they have done with other devs.

Case 168587

I just found this the other day…
http://appgamer.net/features/2009/mar/19/top-10-most-anticipated-iphone-games/

I don’t know how I am going to live up to these expectations… being listed with Assassins Creed, Res Evil, BioShock, Real Racing, etc. : ) Granted its just two guy’s opinions, maybe, but its pretty cool either way. Back to work ; )