Wow. UNCOMPRESSED SOUND dramatically increases APP speed

Wow.

We just made an APP over from scratch three different times in three different ways over a couple of months to try and maximize the speed at which the APP runs on the iPhone 3G.

Merely out of curiosity, we just switched the initial action sound from MP3 to UNCOMPRESSED.

HOLY COW.

All our speed problems disappeared immediately along with the split second lag in the animations when we jump from one sound to another.

I mean… I am floored. I cannot believe the jump in button press recognition speed just from ditching the COMPRESSED sound.

I had no idea DECOMPRESSING MP3 on the iPhone was so processor intensive.

But… WOO-HOO!.. this thing is flying now!

That stroke of curiosity paid off ten fold. :smile:

Just a tip for you all seeking speed.

Thanks.

By the way… is there a way to load an MP3, decompress, store, then play later as decompressed?

That would be very useful to us.

Thanks.

decompressing of MP3 actually is a 0% cpu operation as it happens on the dedicated decompressor chip.
But its a matter of facts that you likely care far less about the amount of data you push through in an MP3 than you would in a wav, not considering the length of the sound. compressed are primarily usefull for one thing and thats the bg music, which is just impossible with wav due to the memory hunger.

Huh?

What am I missing here?

I can clearly see the jump in speed going from MP3 to WAV.

I could maybe get in 1.5 - 2 button presses per second using MP3. Now I can get like 10 per second using WAV.

Actually, I think I know what it might be. It might not be the processing of the MP3… but the loading of the MP3 sound compared to loading the WAV sound.

When I hit the button over and over or going from one button to another, it must have been choking on the loading of the sound not the processing of it.

Thanks for informing me of the mode of sound processing. Useful information.

Thanks.

In my experience with every version of unity iphone, placing a mp3 or mp4 sound file causes a slowdown of 5-10 fps.
So how can it be that it takes 0% of cpu?
Just guessing, if cpu usage is really 0% for decompressing and playing, maybe it “uncompresses” it into memory? (sounds strange) So that that a 1mb mp3 becomes 10mb in memory? That would explain the giagantic slowdowns.

Surely something that takes way more that 0% cpu or memory is happening.

Since when I discovered this I completely ditched the idea of having background music (I already use all the memory and power I can for graphics, physics etc…).

There’s not enough memory (on pre-3GS devices anyway) to decompress to RAM; it’s all streaming. It’s possible, depending on the audio session you’re using, to either use software decompression (can also have multiple compressed sounds simultaneously) or hardware decompression (can only have one compressed sound at a time), the latter of which is naturally faster.

–Eric

Eric5h5: Thanks. If you had not mentioned this I probably would have invested a lot of time researching this, but as you have indicated I would have come up empty handed.

You should use compressed sound only for things such as background music. Even if you’re using hardware decompression (which is the case by default with the current version of Unity), there’s still noticeable lag when you first play the sound, since it seems there’s quite some overhead for submitting the compressed sound for playback. This is no particular problem for music, but makes compression a poor choice for sound effects.

–Eric

Though compressed sounds are played by hardware, CPU is involved in this task as well. The higher the bitrate is, the more CPU is used. Also add all memory operations required to maintain MP3 file, what can also cause slow-downs.

And Eric5h5 is right.