Audio Source
Audio Source component reference

Introduction to the Audio Source component

Attach an Audio Source component to a GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
to control how and where sounds play in your 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
.

Audio sources are components that let you integrate sound effects, music, commentary, and other audio features into your application.

They interact with other audio components in Unity that allow you to edit, enhance, and output sound in your scene, including:

  • Audio Clips
  • Audio Listeners
  • Audio Mixers

This page covers how the audio source interacts with these audio components. For more information about the Audio Source component’s properties and how to set up the component, refer to Audio Source component reference and Set up an Audio Source component.

Audio clips

The Audio Source component requires an 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
to play sound in your scene. Audio clips are containers that hold the actual audio data, so you must assign one to the Audio Source component so it has audio data to edit and play. For instructions, refer to Assign an audio clip to your audio source.

Refer to those pages for more information about each type and for the types of audio files Unity supports.

Output method of the audio source

In the Audio Source component, the Output property specifies where the audio source will send the audio signal in the audio processing pipeline.

This property accepts an Audio Mixer Group. The Audio Mixer is a tool that lets you post-process the audio with effects. You can then assign your Audio Mixer to the property to make sure your audio source applies your effects to the audio.

If you set the property to None, the sound will bypass your mixer and the audio will play without your effects. This is the default behavior.

Then, any Audio Listener components in the scene detects the audio from nearby audio sources, and outputs the audio to the user so they can hear it. Audio listeners are usually found on camerasA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary
in the scene, but you can also assign them to other objects.

For more information about these components, refer to 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
and Audio Mixer.

Configure your audio source

You can configure the audio source to play the clip 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).

If you set SpatialBlend to 0.0f, then Unity will treat the audio clip as a 2D sound. If you set it to 1.0f, the clip is fully 3D. Anything in between is a blend of 2D and 3D.

Use falloff curves to control the spread over distance. Also, if the listener is within one or multiple Reverb Zones, this applies reverberation to the source. You can also apply individual filters to each audio source for an even richer audio experience. For more details, refer to 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 a list of Audio Source settings, refer to Audio Source component reference.

API resources

The following is a list of useful API for AudioSource and its related properties.

Additional resources


Did you find this page useful? Please give it a rating:

Audio Source
Audio Source component reference