当前位置:网站首页>Introduction to Audio Types and Encoding Formats in Unity
Introduction to Audio Types and Encoding Formats in Unity
2022-07-31 18:32:00 【Chen's words must be done】
Introduction to Audio Types and Encoding Formats in Unity
The Inspector window displays several import settings.These settings determine: loading behavior, compression behavior, quality, sample rate, and whether binaural audio is supported.
One, load the audio file
Unity can specify how audio files are loaded through the following 3 settings:
- Preload Audio Data: On to automatically load audio data during scene initialization, off to defer key loading until the audio file is needed.
- Load In Background (loading in the background): On, the main thread is blocked until the background loading is completed, and when off, the background is asynchronously loaded.
- Load Type: The loading of audio files is further controlled by the load type, which will be described in detail later.
Second, Load Type: Load Type
Decompress On Load: This setting compresses files on disk to save space and decompresses them into memory on first load.This is the standard way to load audio files and should be used in most cases.
It takes a while to decompress the file, which causes additional overhead in the loading process, but reduces the amount of work required to play the audio file.
Compressed In Memory: This setting simply copies audio from disk into memory when it loads.Audio files are only decompressed during runtime when they are played.
This will sacrifice runtime CPU while playing audio clips, but will increase acceleration and reduce runtime memory consumption while audio clips remain asleep.
Therefore, this option is best for large audio files that are used frequently, or are stunned with incredible bottlenecks on memory, and are willing to sacrifice CPU cycles to play audio clips
Streaming: This setting will load, encrypt and play the file at runtime by gradually pushing the file through a small buffer where only a small portion of the entire file exists at a time.
This method uses the least amount of memory for a specific audio clip, but the most memory used by the CPU at runtime.Since each playback instance of the file requires its own buffer, this setup has the unfortunate downside of referencing an audio clip multiple times, resulting in multiple copies of the same audio clip in memory that must be processed separately, which if used haphazardlyCauses the runtime CPU to document.So this option is last for single-instance audio clips that play periodically, which don't need to overlap other instances of themselves or even other streaming audio clips.For example, this setting ends up being used with background music and ambient sound effects that need to be played most of the time in the scene.
Summary: By default, Preload Audio Data is deprecated, Load In Background is disabled, and Decompress On Load is usedThe loading type of code> will cause the scene to take too long to load, but it will ensure that every audio clip in the scene is understood when needed.When an audio clip is required, there will be no loading delay, the audio clip will be played when Play() is called.A good compromise to improve scene load time is to deprecate Load In Background for audio clips that are only needed later, but this should not be used for audio clips that are required shortly after scene initialization.Then manually control the audio data loading time through AudioClip.LoadAudioData() and AudioClip.UnloadAudioData().All methods can be used in one scene, and the best performance has been achieved.
Three, encoding format and quality level
Unity supports 3 audio clip encoding formats. You can view the audio clip properties in the Inspector panel summary. Which format is determined by the Compression Format option:
Compressed: The compression algorithm depends on the target platform used
- Vorbis: Lossy compression.Ogg's full name should be OGG Vorbis is a new audio compression format, similar to existing music formats such as MP3.But one difference is that it is completely free, open and patent-free
- MP3: Lossy compression.The same bit rate (Bit Rate) encoded OGG sounds better than MP3.The MP3 format is patent protected.
- PCM: Lossless uncompressed, providing near-analog audio effects.It trades a larger file size for higher audio quality and is suitable for extremely short and high-definition applications.
- ADPCM: Lossy compression, this format is much more efficient than PCM in terms of size and CPU consumption, but the compression can be quite noisy.For explosion, impact sound, you can ignore the noise.

边栏推荐
- 【Yugong Series】July 2022 Go Teaching Course 023-List of Go Containers
- cas与自旋锁(轻量级锁就是自旋锁吗)
- 杰理语音芯片ic玩具芯片ic的介绍_AD14NAD15N全系列开发
- MySQL---operator
- Golang go-redis cluster模式下不断创建新连接,效率下降问题解决
- 多主复制下处理写冲突(3)-收敛至一致的状态及自定义冲突解决逻辑
- 给定一个ip地址,子网掩码怎么算网络号(如何获取ip地址和子网掩码)
- All-platform GPU general AI video supplementary frame super-score tutorial
- Bika LIMS open source LIMS set - use of SENAITE (detection process)
- [Source code analysis] BeanFactory and FactoryBean
猜你喜欢

【NLP】什么是模型的记忆力!

TestCafe之如何进行调试

这位985教授火了!当了10年博导,竟无一博士毕业!

AcWing 1282. Search Keyword Problem Solution ((AC Automata) Trie+KMP)+bfs)

Three.js入门

All-platform GPU general AI video supplementary frame super-score tutorial

认识异常 (看完这篇你就懂了)

ECCV 2022 华科&ETH提出首个用于伪装实例分割的一阶段Transformer的框架OSFormer!代码已开源!...

Chinese encoding Settings and action methods return values

Flex布局详解
随机推荐
Unity 之 音频类型和编码格式介绍
1161. Maximum Sum of Elements in Layer: Hierarchical Traversal Application Problems
MySQL---排序与分页
flowable工作流所有业务概念
【NLP】什么是模型的记忆力!
手把手教你学会部署Nestjs项目
[TypeScript] OOP
go基础部分学习笔记记录
20.支持向量机—数学原理知识
IP protocol from 0 to 1
Golang——从入门到放弃
每日练习------随机产生一个1-100之间的整数,看能几次猜中。要求:猜的次数不能超过7次,每次猜完之后都要提示“大了”或者“小了”。
UVM RAL模型和内置seq
useragent怎么获取
并发性,时间和相对性
抖音根据关键词取视频列表 API
How can we improve the real yourself, become an excellent architect?
Three. Introduction to js
MySQL common statements
Bika LIMS 开源LIMS集—— SENAITE的使用(检测流程)