Photon Voice Based On Distance (3D Audio)

Hello,

Note: I understand versions of the following question have been asked on this forum, but the answers provided were not a solution.

Question:
How do I make it so the microphone recorder audio volume distributed within an interest group is louder or softer based on the distance from the user who is talking?

Scenario:
Client 1 and Client 2 are in interest group 1
Client 1 talks
Client 2 is next to Client 1 and hears Client 1 loudly
Client 2 walks far away from Client 1
Client 1 talks
Client 2 barely hears Client 1


Details:
Each scene has a "Voice Connection and Recorder" and an "Audio Listener" all attached to the camera Object. Other threads mention using Unity's "Audio Source" to accomplish 3D audio.There is no Unity "Audio Source" Object that is catching and distributing the mic audio coming through the interest group.

https://ibb.co/sg1TF64
https://ibb.co/GRmwssK

Thank you so much in advance for any feedback.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    hi @BisuDagger,

    Thank you for choosing Photon!

    interest groups should be unrelated to 3D sounds; using interest group means you choose what streams to listen to or not and to which groups you transmit to. so it's either you receive or not AND the target group (and indirectly, clients) you transmit to.
    Other threads mention using Unity's "Audio Source" to accomplish 3D audio.There is no Unity "Audio Source" Object that is catching and distributing the mic audio coming through the interest group.
    Photon Voice positional audio or 3D sound is done via PUN integration. Each client has a Speaker attached to a character/avatar and the audio will be played using AudioSource on that GameObject and its position will be taken into consideration if AudioSource uses 3D settings (e.g. spatialBlend = 1).

    If you don't use PUN integration, just make sure to move the Speaker component's GameObject's position in world space to have the distance effect and the 3D sound behaviour you want.
    We only support this out of the box using the PUN integration.