- Home /
iOS: Compressed audio not affecting memory?
Hello all,
I am experimenting with audio compression in our iOS game and the problem I am running into is that the profiler shows no difference whether files are compressed or uncompressed. Where am I going wrong/not understanding!? Details below...
Profiling
I am connecting via Wifi and profiling straight from the iPad using Unity's Profiler in the editor. When I reduce the sample rate, the amount of memory loaded decreases so I know that the profiler is at least registering differences in the builds.
I am looking at the "Audio" and "Memory" tabs in the profiler for information.
Audio is showing "Audio Memory: 5.7MB", which is close enough to what it should be uncompressed by my calculations.
Memory is showing "Audio Clips: 28/1.3MB", which I don't understand what the 1.3MB is referring too. This isn't in the docs from what I can find.
The above values never change no matter what my settings are in Unity, only if I adjust the source files.
Compression Settings
The following is applied to my SFX. Music is streamed and uncompressed (Native).
Audio Format: Compressed (MPEG)
Load type: Compressed in Memory
Hardware decoding: (unchecked since I read only one of these works at a time)
Compression (kbps): 156
It is applied and I see the new file size in the Preview window. I have also tried "Decompress on Load" which is supposed to give me a memory spike but again there is no change in the values.
Am I looking in the wrong place to see the changes? Am I misunderstanding a fundamental fact about mobile audio? Any help would be appreciated.
Thanks!
Answer by AdbC99 · Aug 25, 2012 at 04:26 PM
I've had loads of problems here, I found sometimes unity wasn't actually compressing the file at all, look at the size of the application. Whilst the file size changed in Unity, the conversion didn't take place, when you switch to compressed then there should be a progress bar appear while it does the conversion, if not then experiment with deleting a re-importing the samples and you should get there. There is one fundamental fact that you are missing about Unity iPhone audio, it is very very buggy.
Answer by XeviaN360 · Sep 12, 2012 at 03:01 PM
I really do not understand things here. If i set an mp3 to "stream from disc", according to profiler, is using much more memory than having it in ram.
And, i found that on my android device, 33% of the cpu is used to play music (a single mp3). Why? Didn't have the android phones an hardware decoder? (i have a samsung galaxy note)
And, cpu usage in the audio section of the profiler is totally apart from the cpu usage... i mean, if i sum all the cpu usage %, and the cpu usage % of audio profiler track, i have a nice 130%.
Your answer
Follow this Question
Related Questions
What is the unit of measurement for memory usage in the Unity internal iOS profiler? 0 Answers
why are all my app icons and splashscreens loaded in memory? 1 Answer
Memory usage in xcode does not equal to the number in unity profiler 0 Answers
"stream from disc" WAV/AIFF file allocates tons of memory 0 Answers