Search Unity

Question How to get playback at different locations in the world?

Discussion in 'Audio & Video' started by TYTY_S, Jan 30, 2024.

  1. TYTY_S

    TYTY_S

    Joined:
    Jan 30, 2024
    Posts:
    2
    Hello Unity Community!
    I'm very new to working with Unity, so I am sorry if I reiterate some basic concepts – I'm aiming for clarity in explaining my questions.

    In my current project, I've placed multiple 3D sound sources at different locations within my game world. The idea is for the player to experience varying audio dynamics based on their proximity to these sources. For instance, if the player is near sound source A but far from sound source B, they would hear A loudly and B faintly. As the player moves around, these audio experiences change.

    Here are my questions:

    (1) How can I get the playback of each sound source and the combined playback of all the sources as heard by the player at any given location in the game world?
    (2) In the Unity setting, are there interactions between different sound sources? Specifically, will source A distort the signal transmission of source B? In real life, when two sound waves meet, they combine through a process called interference, which can result in constructive (amplifying) or destructive (diminishing) interference. This can change the perceived loudness or even create new sounds (like beats). Does this also happen in Unity?

    I greatly appreciate any insights or resources you can share on this topic. Thank you in advance for your help!
     
  2. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    407
    Hi @TYTY_S

    What you are looking for is the AudioSource's Spatial Blend slider. At 0, this makes an AudioSource "2D" in the sense that the file is played as-is, without any computed panning or spatialization magic. Sliding all the way to 1 gives you a "3D" source which will consider its distance and orientation delta from the AudioListener to add the "spatial" sauce :D.

    Anything between 0 and 1 is the mix ratio of the 2D/3D resulting sound.

    Short answer: no. Each sound is processed individually and then all mixed together.

    Cheers!
     
    TYTY_S likes this.
  3. TYTY_S

    TYTY_S

    Joined:
    Jan 30, 2024
    Posts:
    2
    Thank you very much for your reply!
     
    SeventhString likes this.