- Home /
Concern about Audio Performance
Hi people! Hope everyone is doing fine today =) I have two questions:
1) When should I play an Audio streaming it from the Disk, and when to do the same thing playing the audio directly from the compressed memory? For instance, I have ambient sounds and event sounds, what is the better way (performance wise) to play them?
2) Where can I found information regarding the number of sounds that can be played at the same time? Is this somehow related to the number of Channels of my Audio Processor?
Thanks in advance!
Answer by fifthknotch · Mar 08, 2014 at 05:53 PM
Check this out. I took it straight for the documentation:
The method Unity uses to load audio assets at runtime.
Decompress on load
Audio files will be decompressed as soon as they are loaded. Use this option for smaller compressed sounds to avoid the performance overhead of decompressing on the fly. Be aware that decompressing sounds on load will use about ten times more memory than keeping them compressed, so don't use this option for large files.
Compressed in memory
Keep sounds compressed in memory and decompress while playing. This option has a slight performance overhead (especially for Ogg/Vorbis compressed files) so only use it for bigger files where decompression on load would use a prohibitive amount of memory. Note that, due to technical limitations, this option will silently switch to Stream From Disc (see below) for Ogg Vorbis assets on platforms that use FMOD audio.
Stream from disc
Stream audio data directly from disc. The memory used by this option is typically a small fraction of the file size, so it is very useful for music or other very long tracks. For performance reasons, it is usually advisable to stream only one or two files from disc at a time but the number of streams that can comfortably be handled depends on the hardware.
Compression
Amount of Compression to be applied to a Compressed clip. Statistics about the file size can be seen under the slider. A good approach to tuning this value is to drag the slider to a place that leaves the playback "good enough" while keeping the file small enough for your distribution requirements.
Hi! Thanks for the reply! I am still trying to figure out if Unity uses $$anonymous$$ultiplexing to enconde many audios into one single channel, this is my main concern for the moment! Anyway, thanks man!! Cheers!
Don't forget to mark it as answered, and good luck with your game! :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613135723im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
When is audio file loaded to memory 0 Answers
What does Audio CPU Usage mean in the Profiler? 1 Answer
Poor performance when using AudioSource.Play 0 Answers
AudioManager.Update & EditorOverhead taking CPU 1 Answer
I need a way to run code much more frequently than update. Ideally, every 3 milliseconds 2 Answers