graham
New Member
Posts: 6
Posts: 6
|
Post by graham on Apr 28, 2015 17:51:21 GMT
Before Unity 5, there were 2 basic ways to set your audio import settings for iOS: - For sound effects you generally used Native (WAV) uncompressed set with Load Type = "Load into memory"
- For music you generally used MP3 compressed files
Since upgrading to Unity 5 those settings have changed and I don't understand how to properly set my audio file import settings so they are optimized for iOS.
None of the Unity documentation about these settings has been updated to reflect the changes since Unity 5. So these resources still talk about the "old" settings and offer no insight on the new stuff:
The new settings in Unity 5 that have left me confused for iOS are:
- "Load in Background" checkbox (what does this mean, when should I use it?)
- "Preload Audio Data: checkbox (what does this smean, when should I use it?)
- "Load Type" is now "Decompress on Load", "Compressed in memory", or "Streaming" (I have no idea what my WAV sound effects should use as these all seem to force compression?)
- "Compression Format" is now forced to either "PCM", "Vorbis" or "ADPCM" (again I have no idea how to set my WAV sound effects to NOT use compression based on this?)
What are the recommended settings for iOS audio files with Master Audio now? How should I setup my WAV sound effects vs my MP3 music files?
So far the things I have tried have resulted in very slow delays before playing sounds and even blocking loads to get the music playing.
Also, when I do an iOS build and check the editor log I do not see my WAV files listed in the used assets, yet they still still work in game (although they are delayed). Previously they were included in the build. I am confused how this is even possible. Is Master Audio doing something funky regarding this?
Thanks,
|
|
|
Post by DarkTonic Dev on Apr 29, 2015 0:19:14 GMT
There are some answers in this thread here: forum.unity3d.com/threads/trying-to-get-clear-on-unity-5-audio-basics-for-audio-clip-and-audio-source.314772/I believe "Preload Audio Data" is the same as the old "Load into memory". Obviously since the official Unity pages haven't been updated, we can't know for sure what the new settings do. As far as Master Audio doing something funky on export: absolutely not. Master Audio does not touch import or export settings except on the Master Audio Clip Manager, which does not exist in Unity 5+. I'll read that thread again and update the Master Audio best practices section in the readme accordingly shortly.
|
|
graham
New Member
Posts: 6
Posts: 6
|
Post by graham on Apr 29, 2015 16:20:29 GMT
Thanks for the info. That forum post provides a bit more insight, but I'm still having trouble with a serious issue since upgrading. Perhaps you can help me with the issue I am trying to resolve.
In Unity 4.6.4 and using MasterAudio v3.5 we had a setup of mp3 files playing music with a playlist and WAV files being used for sound effects. This worked great. Each scene has a group with all the sounds needed for that scene and they would be loaded as needed. In our "battle" scene we setup 2 buses each with 5 and 15 max voices. Battles in our game involve a lot of sword, arrow and clanging type sounds that use the 15 voice bus, and the more important sounds were played on the 5 voice bus. By default if those buses reached their max then any new sounds would just be ignored and this suited our needs perfectly.
However, after updating to Unity 5 and MasterAudio v. 3.5.7.7 we are noticing a serious problem when played on an iOS device. In the battle scene things start off fine but after a short time the sounds start falling behind the action. It's like they get queued up or something and can't keep up with what is going on. Eventually when the battle ends, the sounds are still playing from things that happened 2 minutes ago. Normally at the end of a battle we click a button to load the next scene. However this scene load gets blocked and doesn't do anything until all the remaining sounds finish playing, at which point Unity then decides it can load the next scene.
I am not sure if the way buses handle overflow has changed, or if this is a problem with how my WAV import settings are configured or something else. Do you have any ideas what might be going on here? I have tried changing the import settings to all sorts of variations with no luck in fixing this issue. I've also tried setting the bus controls to "stop oldest" and that didn't fix the issue either.
Another piece of information that may be related is what I mentioned in my post above: the Unity editor log that shows all the "Used Assets, sorted by uncompressed size" when you do an iOS build used to show all the WAV files in our Resources folders listed here. However now they are not listed at all (which is baffling since they still work on device so they must exist somewhere). I'm not sure if this is related or not but it seems odd.
Any ideas?
|
|
|
Post by DarkTonic Dev on Apr 29, 2015 16:39:11 GMT
That's truly puzzling. I believe it's probably some sort of Unity iOS bug. We dont have any platform specific code running. Let me know if you are able to reproduce that on a different platform or in the editor.
It's possible that your import settings could cause this. Try setting them differently and see if things change. If so, let us know.
Bus logic has not changed in a long time.
|
|
graham
New Member
Posts: 6
Posts: 6
|
Post by graham on Apr 30, 2015 1:17:55 GMT
So the problem is that all our Dynamic Sound Groups are configured in each scene with Audio Origin set to "Resource File" so that they aren't all in memory at once, instead they are meant to get loaded and unloaded in memory as needed. This worked great in Unity 4.6.4 and before.
However, now it seems these audio files take a long time to load into memory every time they play. The result is that all the sound gets backed up and out of sync with the game.
If I change these to Audio Origin "clip" they all play instantly and there is no synching problem. However, this means they are all in memory at all times and take up way too much memory on iOS device.
So, is there anything you can do to fix this? I am not sure what Unity or your plugin has changed that affects this, but something has clearly changed.
Please advise.
|
|
|
Post by DarkTonic Dev on Apr 30, 2015 1:55:19 GMT
Our plugin has not changed in this regard in over a year. Resource files do in fact take various amounts of time to load (longer for larger files) and cannot play until they are loaded. If you also have turned on the "Always Load Resources Async." option (which may default to on) in Advanced Settings, that does take longer to load each Resource file (6 frames for tiny sounds on my tests), but it is a lot better at avoiding frame stutters.
You definitely shouldn't put *all* Sound Groups as Resource files. That's too much of a load on the background thread. Put only the sounds that aren't played very frequently as Resource files and I'm sure you'll have better results.
If the performance is worse with Unity 5, rest assured that Master Audio performs the same on both. So it may be some additional overhead by Unity for Unity 5 and/or new Unity to iOS compatibility.
|
|
graham
New Member
Posts: 6
Posts: 6
|
Post by graham on Apr 30, 2015 15:27:14 GMT
Out of curiosity, did your plugin change in this regard anytime after 3.5.0? We hadn't updated it in over a year until we upgraded to Unity 5 so we were still using v3.5.0 up until this change.
It does seem likely that the cause is related to Unity 5 audio changes, but I'm trying to narrow down all the possibilities as we figure out how to fix our problem. I will follow up in the Unity forums to see if I can shed any more light on the changes they made that might affect this.
Thanks,
|
|
|
Post by DarkTonic Dev on Apr 30, 2015 16:11:14 GMT
You'd have to scan the release notes, I dont remember that far back. I would lean toward saying no. I think we ironed out the resource loading over a year ago. And then Unity added the async load option that we quickly implemented.
No issues have ever been reported except yours.
|
|