The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Voice.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Photon Voice Based On Distance (3D Audio)

BisuDagger
2020-07-06 19:03:23

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
2020-07-07 16:10:55

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.

Back to top