- Home /
memory usage of compressed audio playerback iphone
I apparently made the wrong assumption that compressed audio playback on iPhone would be streamed from 'disk' (okay, flash). Testing showed memory usage of is quite heavy (we have a long music track in our game). Is it possible to play .mp3 or .m4a audio files on iPhone without Unity loading it into memory first?
Answer by Jaap Kreijkamp · Feb 21, 2010 at 10:35 AM
The problem seems to be related to mp3 format, recompressing it from 3MB .mp3 to 900KB High Efficiency AAC .m4a solves it: Memory usage jumps back from 39.8MB to 20.6MB! Also binary is around 20MB or so smaller! It looks like Unity decided to store the mp3 as uncompressed (and thus loading it in memory). The mp3 was a 200kbps stereo track. Has anybody else have similar experiences?
It has possibly to do with that the asset is imported from Unity Pro, when I try to recreate the bug as stand-alone project it doesn't trigger the problem but seem to stream correctly. So, possibly a reimport of the asset or deleting the file and dropping again could have worked as well. Most important thing is, game is working and a step closer to release! (being excited starts to look really cool, warning, this youtube link is self-promotion, but just being happy this bug is solved that really made it difficult to run the app on a iPhone 3G).
Your answer
Follow this Question
Related Questions
Calculating BPM (beats per minute) using InvokeRepeating() - Issue 2 Answers
iPhone pitch not working? 1 Answer
how to use ipodlibrary? 0 Answers
How to allow the user to choose a song from his/her own library to play in game? 2 Answers
Music resumes between levels on iPhone ( and not on android) 0 Answers