As with Meshes or Textures, the workflow for Audio File assets is designed to be smooth and simple. Unity can import almost every common file format, but there are a few details that are useful to be aware of when you work with audio files.
For a list of the audio formats Unity supports, refer to Supported audio file formats.
For an extensive description of the compressionA method of storing data that reduces the amount of storage space it requires. See Texture Compression, Animation Compression, Audio Compression, Build Compression.
See in Glossary formats and other options available for encoding audio data, refer to AudioClip.
Unity audio data is separate from the actual AudioClips. Audio data is the raw information about an audio file. It contains information such as length, channel count, sample rate, and compression format.
AudioClips are assets that contain the audio data and processes the audio data for use with Unity Engine.
To import an audio file to Unity, click and drag your file into your project. Unity imports the audio file as an AudioClip.
Use the settings in the AudioClip importer to determine how the clips will load at runtime. These settings let you decide which audio assets will stay in memory. This is ideal for frequent or unpredictable sounds like footsteps, weapons, or impacts.
For other assets, such as speech, background music, or ambient loops, you can set them to load on-demand or as the player progresses. This approach optimizes memory usage and improves performance.
When Unity encodes audio, the main compression formats for how Unity stores the audio on disk are the following: * PCM * ADPCM * Compressed.
Additionally there are a few platform-specific formats but they work in similar ways. The default mode is Compressed, where Unity compresses the audio data with either the Vorbis or MP3 format for standalone and mobile platforms.
Any audio file imported into Unity is available from scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary as an AudioClip instance. This provides a way for the game runtime of the audio system to access the encoded audio data. The game might access meta-information about the audio data via the AudioClip even before the actual audio data loads.
The import process extracts information such as length, channel count and sample rate from the encoded audio data and stores these details in the AudioClip. This information can be useful for automatic dialog or music sequencing systems, because the music engine can use the length to schedule music playback before the data loads. It also helps to reduce memory usage because it only keeps the audio clipsA container for audio data in Unity. Unity supports mono, stereo and multichannel audio assets (up to eight channels). Unity can import .aif, .wav, .mp3, and .ogg audio file format, and .xm, .mod, .it, and .s3m tracker module formats. More info
See in Glossary in memory the application needs at a certain time.
Unity supports the following audio file formats.
Format | Extensions |
---|---|
MPEG layer 3 | .mp3 |
Ogg Vorbis | .ogg |
Microsoft Wave | .wav |
Free Lossless Audio Codec (FLAC) | .flac |
Audio Interchange File Format | .aiff / .aif |
Ultimate Soundtracker module | .mod |
Impulse Tracker module | .it |
Scream Tracker module | .s3m |
FastTracker 2 module | .xm |
For more information about how to use sound in Unity, refer to Audio Overview.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.