Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

3D Sound - Spread and Pan

Discussion in 'Scripting' started by malcolmr, Jan 5, 2011.

  1. malcolmr


    Feb 18, 2010
    Can anyone please point me to a detailed description of what "Spread" and "Pan" do on a 3D AudioSource in Unity? The AudioSource documentation is very terse on this question:

    What does this mean?
    impurekind likes this.
  2. soren


    Feb 18, 2008
    Yeah, the documentation here is not very clear.

    // Spread
    Sets the spread angle of a 3d stereo or multichannel sound in speaker space.
    0° = all sound channels are located at the same speaker location and is 'mono'.
    360° = all subchannels are located at the opposite speaker location to the speaker location that it should be according to 3D position.
    Default = 0.

    // Pan Level
    Sets how much the 3d engine has an effect on the audio source (or how much it's panned). Meaning: if it's 0.0 the sound is playing 100% in 2D (omnipresent). if it's 1.0 the sound is positioned 100% in 3D (will pan according to it's position). Use this (with the curves) to give the effect of walking into a sound . I.e. a waterfall: On a distance you want the sound of it to be positioned (panLevel == 1.0), but as you walk close to (or into) it you want it to be all around you (panLevel == 0.0)

    Hope this is clearer?

    liju likes this.
  3. malcolmr


    Feb 18, 2010
    I'm not sure I get the spread idea entirely. A diagram would help, I think, but this isn't an easy medium for that.

    So, I have a particular question: when I move a sound from left to right it shifts very quickly from being entirely in the left speaker to being entirely in the right. Is there any way for me to adjust the range in which "close" sounds are heard in both speakers? Would reducing the Pan curve be the right way to achieve than?
  4. soren


    Feb 18, 2008
    yes, pan level (and curve) is your friend here.
  5. theotherstudio13


    Oct 8, 2009
    I just tested PAN LEVEL using custom curves on an audio source set to 3D looping. The current description for PAN LEVEL is misleading. Currently a PAN LEVEL setting below 1 results in sounds persisting, continuing to play no matter how far away the listener is from the audio source essentially ignoring the Audio Source's Max Distance setting. This isn't clear based on the description and in direct conflict with Volume curve settings.

    In the description of PAN LEVEL I think what you are trying to say is that the 3D engine is making calculations based on the audio listeners position relative to the audio source. It is confusing to use the word PAN to describe this case.

    PAN normally describes a sounds position in the stereo or surround sound field (or panorama) not its VOLUME. From this perspective, where pan and volume are considered separate, the current description of PAN LEVEL ignores the fact that VOLUME is also affected making the current description misleading / wrong. The updated description should read

    In my opinion the current implementation of PAN LEVEL has very limited applications and should be changed / fixed. I cannot imagine more than 1 specific use for PAN LEVEL in its current state. Please consider changing (fixing) this feature so it controls PAN only then add a button to enable latching VOLUME as an option. Here is my suggestion for improving this feature.

    Last edited: Jul 30, 2011
  6. theropodx


    May 1, 2011
    Ok, so I read through this thread and the Unity docs a couple times and didn't get it...until I experimented a bit. Just in case this may help somebody else:

    If you want a sound to attenuate (get quieter) with distance, but NOT pan left/right based on it's location, just set the SPREAD to 180. Again, the volume (loud or soft) will be equal in both L/R speakers...but still get louder/softer with distance.

    I agree the Pan feature seems not very useful. I expected it to do something like what Spread does...
  7. Adrian


    Apr 5, 2008
    These settings also confused me so I did some experiments and here's my take on the two:

    Pan Level:
    The pan level allows you to mix the 3D (positioned) with the 2D (omnipresent) aspect of a sound. 1 means the sound is fully 3D, panned and attenuated based on its position. 0 means it's fully 2D, audible everywhere and unaffected by its position.

    Without a custom rolloff curve, this doesn't make much sense as the sound will be audible in the whole level if the level is < 1. You could use it to position a sound that is audible everywhere but gets louder at a specific location.

    It makes more sense when used with a custom rolloff curve. The curve should be 1 at the max distance to ensure the sound will go silent if the listener is too far away. Closer to the source the level can be < 1 to reduce the 3D effect when being close (like in soren's waterfall example).

    The spread allows you to control how much the 3D positioning affects the panning of the sound. 0 means the panning is fully determined by the 3D position, effectively removing the sound's original panning. 180 means the sound uses the original panning and the 3D position only affects the volume of the sound. Values > 180 reverse the panning with 360 being equal to 0 but having the channels flipped (i.e. a sound positioned on the right will be played on the left channel).

    This is most useful for ambient sounds you don't want to be directionally panned but still fade in and out based on the distance to a specific location in your level.
  8. ChrisPolus


    Sep 27, 2011
    Thankfully I found this post! You guys are great. Reading the doc and looking at the settings in Unity I think there is not a single audio guy in the Unity team. Audio functionality is veeery very basic, no metering, I have NO idea what goes out the speakers. The sparse documentation only shows that there is little attention paid to audio. It's all about shiny features like DirectX11, Mecanim and such things. Would be nice if they really put some effort into sound finally!

    The way PAN and SPREAD settings work is ridiculous.

    THANKS people for experimenting and helping me out here. This is exactly what I looked for.
    liju likes this.
  9. jakehawken


    Mar 2, 2014
    Wow, this thread was incredibly useful. Thanks a ton, guys!
  10. KeithKong


    May 31, 2015
    Great thread, one note I don't see here:

    The base Pan and Spread settings are not really for the editor, but play a really powerful role in coding. You can have something in an update loop do custom logic that determines the volume, pitch, pan, spread, etc. These settings work on top of the distance curve settings. If your sound is meant to be 3D in any way you need to make those adjustments in the curve settings.

    For example, in a flying game I've calculated the distance of my plane to the ground. I programmatically set the wind noise volume higher as the plane gets close to the ground. When playing you will hear the wind increase when flying close to the ground, but if the camera stops and the plane flies away the wind noise will fade (even if the plane is still close to the ground).

    It's true sound settings are not as robust as they could be, but with the programming side you can still create some cool sound effects.
  11. SashaMartysh


    Dec 13, 2015
    Thank you very much! it is really clear for me now, after your description.
  12. liju


    Apr 4, 2014
    Thank you
  13. bdotalex


    Nov 15, 2012
    ... spread... on a 2d project...

    0 = fades in and out of the correct left or right stereo channel or "speaker" that it should based on the audio source's relative position to the audio listener.
    360 = fades in and out of the opposite left or right stereo channel or "speaker" that it should based on the audio source's relative position to the audio listener.
    180 = fades in and out of both speakers equally. This effectively makes you able to fade in and out of a sound based on distance, while maintaining the illusion of mono fairly well. (same volume in both channels, all the time.)


    ...You're welcome.
    JoeStrout and glenneroo like this.
  14. ReaktorDave


    May 8, 2014
    This is a very old thread but its one of the first to pop up and some info in here does not seem to be what is going on. We researched how the spread slider works when using different input material (2.0, 7.1, ambisonics) and how that is being translated to 7.1 and stereo output configuration.

    The results of our findings are in the document attached.

    Testing was done with Unity 2018.4. Here are some bottom lines:
    • No effect of the spread slider in 2D mode.
    • Spread generally moves the input signal from Front/PointSource (spread=0) to the Sides (spread=180) and to the Back (spread=360).
    • When using a 7.1 input signal, 360° is not a point source behind you, just the surround channels become a point source. The remaining channels are distributed between front and side speakers.
    • We found that spread=270 comes closest to intended signals on the input channels correctly mapped to output channels.
    • Whatever is being set to the spread parameter, the orientation of the AudioListener to the AudioSource will be taken into account in 3D mode and rotated accordingly.
    • Using a spread value of 90 will roughly expand the input signal to 90° width so this parameter can be tied to an appropriate distance curve to mimick a sound being thin at a distance but having certain width when being close.
    I think the manual would be much more understandable if there were some graphic files depicting input channel positions and how they are moved around the listener (or rather the listener's orientation to the audio source) with different spread values.

    Attached Files:

    glenneroo and suda_syng like this.
  15. ashishpatel2016


    Jul 2, 2020
    I agree with the above. Many techniques to fade in and fade out. If you can automate the spread value to oscillate +2 and -2, then you get a more natural 3d sound. If you want, you can check out this 3d sample pack for environment sounds: