How Do I Use Photon Voice 2 with Bolt?

I'm developing a multiplayer VR app in Unity 2019.4.4f1 in the Android platform for the Oculus Quest. I haven't been able to find any tutorials or other guidance for setting up Photon Voice 2 with Bolt. I reviewed the documentation for Voice 2 and see a page called "Voice for PUN 2" as well as "PUN Voice Demo" tutorial, but no guidance specifically for Voice 2 and Bolt. And I couldn't find any applicable demo scenes in the Photon assets installed in my Unity project.

Can anyone provide guidance? Thanks!

Best Answers

Answers

  • Thanks, @ramonmelo! I'll try this out. Do you have any further guidance for making the voice chat positional? In other words, I'd like the voice chat volume to drop off as the players get farther away from each other.
  • Thanks so much! I'll let you know if I need further assistance.
  • I can't get the voice chat to be positional. I added a "Voice Connection and Recorder" game object from the "DemoVoiceMinimal-Scene" scene to my scene. I didn't add a Speaker prefab to the Voice Connection component, but added Speaker/Audio Source components to the player prefab which gets instantiated for each player over Photon Bolt. The players can hear each other but not positionally even though I've tried a variety of settings relating to 3D sound, etc., in the Audio Source component on the player prefab. Do you have any idea why the voice chat still isn't positional?
  • I think I found out how to set up Photon Voice 2 with Bolt in my project so that it works positionally:

    1. Unlike in my last post, I didn't add Speaker/Audio Source components to the player prefab which Bolt instantiates. Instead, I added a Speaker prefab with those components to the Voice Connection component (dragged it into the slot).

    2. I added a script to the Speaker prefab so that, when it's instantiated, it attaches itself to the remote player prefab, specifically to an empty game object child called "Speaker Target Location". Here's my script (in theory this will work with more than 2 players, i.e., so the right Speaker prefabs get attached to the right player prefabs):

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class SpeakerPrefabManagerVoice2BoltTest : MonoBehaviour
    {
    GameObject targetLocation;

    void Start()
    {
    Invoke("RelocateSpeaker", 3);

    }

    /*void Update()
    {

    }*/

    void RelocateSpeaker()
    {
    targetLocation = GameObject.FindWithTag("Speaker Target Location");
    transform.parent = targetLocation.transform;
    targetLocation.tag = "Untagged";
    }
    }

    3. I added an Audio Listener to the local player (but only to the local player).

    4. In the Audio Source component of the Speaker prefab I set Spatial Blend to full 3D. I believe this is necessary for the sound to attenuate as the players get farther away from each other. Other Audio Source settings can also be tweaked.

    The positional voice chat now works fine. Photon developer support told me they're "building a full integration of Bolt with Voice that will include a sample for spatial audio". But until that's available maybe my approach will be of assistance to someone.
Sign In or Register to comment.