The Audio Source plays back an Audio Clip in the sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary. The clip can be played to an audio listener or through an audio mixer. The audio source can play any type of Audio Clip and can be configured to play these as 2D, 3D, or as a mixture (SpatialBlend). The audio can be spread out between speakers (stereo to 7.1) (Spread) and morphed between 3D and 2D (SpatialBlend). This can be controlled over distance with falloff curves. Also, if the listener is within one or multiple Reverb Zones, reverberation is applied to the source. Individual filters can be applied to each audio source for an even richer audio experience. See Audio EffectsAny effect that can modify the output of Audio Mixer components, such as filtering frequency ranges of a sound or applying reverb. More info
See in Glossary for more details.
Property | Description |
---|---|
Audio ClipA 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 |
Reference to the sound clip file that will be played. |
Output | By default, the clip is output directly to the Audio Listener in the Scene. Use this property to output the clip to an Audio Mixer instead. |
Mute | If enabled the sound will be playing but muted. |
Spatialize | Enables or disables custom spatialization for the Audio Source. This property is only available if you have installed an audio spatializer SDK, and selected it in your project’s global audio settings. |
Spatialize Post Effect | Determines whether the custom spatializer is applied before or after other effects attached to the Audio Source. Enable this property to apply the custom spatializer after other effects attached to the Audio Source. This property is only available if you have enabled the Spatialize property for the Audio Source. |
Bypass Effects | This is to quickly “by-pass” filter effects applied to the audio source. An easy way to turn all effects on/off. |
Bypass Listener Effects | This is to quickly turn all Listener effects on/off. |
Bypass Reverb Zones | This is to quickly turn all Reverb Zones on/off. |
Play On AwakeSet this to true to make an Audio Source start playing on awake More info See in Glossary |
If enabled, the sound will start playing the moment the scene launches. If disabled, you need to start it using the Play() command from scripting. |
Loop | Enable this to make the Audio Clip loop when it reaches the end. |
Priority | Determines the priority of this audio source among all the ones that coexist in the scene. (Priority: 0 = most important. 256 = least important. Default = 128.). Use 0 for music tracks to avoid it getting occasionally swapped out. |
Volume | How loud the sound is at a distance of one world unit (one meter) from the Audio ListenerA component that acts like a microphone, receiving sound from Audio Sources in the scene and outputting to the computer speakers. More info See in Glossary. |
Pitch | Amount of change in pitch due to slowdown/speed up of the Audio Clip. Value 1 is normal playback speed. |
Stereo Pan | Sets the position in the stereo field of 2D sounds. |
Spatial Blend | Sets how much the 3D engine has an effect on the audio source. |
Reverb Zone Mix | Sets the amount of the output signal that gets routed to the reverb zones. The amount is linear in the (0 - 1) range, but allows for a 10 dB amplification in the (1 - 1.1) range which can be useful to achieve the effect of near-field and distant sounds. |
3D Sound Settings | Settings that are applied proportionally to the Spatial Blend parameter. |
Doppler Level | Determines how much doppler effect will be applied to this audio source (if is set to 0, then no effect is applied). |
Spread | Sets the spread angle to 3D stereo or multichannel sound in speaker space. |
Min Distance | Within the MinDistance, the sound will stay at loudest possible. Outside MinDistance it will begin to attenuate. Increase the MinDistance of a sound to make it ‘louder’ in a 3d world, and decrease it to make it ‘quieter’ in a 3d world. |
Max Distance | The distance where the sound stops attenuating at. Beyond this point it will stay at the volume it would be at MaxDistance units from the listener and will not attenuate any more. |
Rolloff Mode | How fast the sound fades. The higher the value, the closer the Listener has to be before hearing the sound. (This is determined by a Graph). |
- Logarithmic Rolloff | The sound is loud when you are close to the audio source, but when you get away from the object it decreases significantly fast. |
- Linear Rolloff | The further away from the audio source you go, the less you can hear it. |
- Custom Rolloff | The sound from the audio source behaves accordingly to how you set the graph of roll offs. |
There are three Rolloff modes: Logarithmic, Linear and Custom Rolloff. The Custom Rolloff can be modified by modifying the volume distance curve as described below. If you try to modify the volume distance function when it is set to Logarithmic or Linear, the type will automatically change to Custom Rolloff.
There are several properties of the audio that can be modified as a function of the distance between the audio source and the audio listener.
Volume: Amplitude(0.0 - 1.0) over distance.
Spatial Blend: 2D (original channel mapping) to 3D (all channels downmixed to mono and attenuated according to distance and direction).
Spread: Angle (degrees 0.0 - 360.0) over distance.
Low-Pass (only if LowPassFilter is attached to the AudioSource): Cutoff Frequency (22000.0–10.0) over distance.
Reverb Zone: Amount of signal routed to the reverb zones. Note that the volume property and distance and directional attenuation are applied to the signal first and therefore affect both the direct and reverberated signals.
To modify the distance functions, you can edit the curves directly. For more information, see the guide to Editing Curves.
Audio Sources don’t do anything without an assigned Audio Clip. The Clip is the actual sound file that will be played back. The Source is like a controller for starting and stopping playback of that clip, and modifying other audio properties.
To create a new Audio Source:
Assets
folder (Project tab) More info
Note: If you want to create an Audio Source just for one Audio Clip that you have in the Assets folder then you can just drag that clip to the scene viewAn interactive view into the world you are creating. You use the Scene View to select and position scenery, characters, cameras, lights, and all other types of Game Object. More info
See in Glossary - a GameObject with an Audio Source component will be created automatically for it. Dragging a clip onto on existing GameObject will attach the clip along with a new Audio Source if there isn’t one already there. If the object does already have an Audio Source then the newly dragged clip will replace the one that the source currently uses.
AudioSource
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.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising. Some 3rd party video providers do not allow video views without targeting cookies. If you are experiencing difficulty viewing a video, you will need to set your cookie preferences for targeting to yes if you wish to view videos from these providers. Unity does not control this.
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.