Audio Source
Reference Manual > Components > Audio Components > Audio Source

Audio Source

The Audio Source takes an Audio Clip and plays it from a position in the world.


The Audio Source in the Scene View and Inspector

Properties

Audio ClipReference to the sound clip file that will be played
Play On AwakeIf enabled, the sound will start playing the moment the scene launches. If disabled, you need to start it using the Play() command from scripting.
VolumeHow loud the sound is at a distance of 1 world unit (1 meter) from the Audio Listener.
PitchAmount of change in pitch due to slowdown/speed up of the Audio Clip. Value 1 is normal playback speed.
Min VolumeThe minimum value of the sound. No matter how far away you get, the sound will not get softer than this value.
Max VolumeHow loud the sound gets at the loudest. No matter how close you get, the sound will never get louder than this value.
Rolloff FactorHow fast the sound fades. The higher the value, the closer the Listener has to be before hearing the sound.
LoopEnable this to make the Audio Clip loop when it reaches the end.

Creating Audio Sources

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:

  1. Import your audio files into your Unity Project. These are now Audio Clips.
  2. Go to GameObject->Create Empty from the menubar.
  3. With the new GameObject selected, select Component->Audio->Audio Source.
  4. Assign the Audio Clip property of the Audio Source Component in the Inspector.

Hints