Photon voice speaker has not correct signal

Hello.
I have application that use desktop version and vr version of the same app. I try to connect PC player voice chat with VR player voice chat. Steps i do:

1: create lobby by pc and room by pc
2: master disable scene synchronization flag (pc and vr has other scenes)
3: join lobby and room by vr
4: setup PhotonVoiceNetwork
5: create local recorder for pc
6: create local recorder for vr
7: send rpc for create speaker of pc in vr
8: send rpc for create speaker of vr in pc
9: IT WORKS!
10; now when they are connected in "lobby scene" i click play, then start new scene and both players change scene
11: wait for both players until changed scenes
12: PhotonVoiceNetwork is on scene because it is singleton
13: steps 5, 6, 7, 8
14: now when i talk from PC i can hear in vr and speaker curve is correct
15: when i transmit enable in vr then pc speaker draw curve but it is straight line (in vr debug it is correct)
16: i can't hear in PC nothing from VR

So i don't know what happend and why this is happend. Really even in documentation I can not find anything that could help me.
Please help me.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @PawelL,

    Thank you for choosing Photon!

    What Photon Voice version is this?
    Why do you create Recorder and Speaker via RPC? why not use PhotonVoiceView?
    When you change scenes does the Speaker and Recorder components remain/persist?
  • I updated PUN yesterday to "v2.16.1 (April 30th, 2020) PUN2: v2.18.1".
    PhotonVoiceView is needed to use recorder and speaker. I know I can use PhotonVoiceView or by prefab workflow. No one teach me so that my workflow that worked in PC - PC, and VR - VR.
    When i instantiate Players in scene, then i create voice chat.
    1: players on scene with viewID - 1000, 2000, 3000...
    2: everyone spawned then create PhotonVoiceView - that also gives me 3d sound near player
    3: if is owner then create recorder, but if is not owner create speaker
    It worked always but not now. I really don't know why.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @PawelL,
    I updated PUN yesterday to "v2.16.1 (April 30th, 2020) PUN2: v2.18.1".
    You copied this from changes-voice.txt right? I want to make sure as we got reports from users updating from asset store but package in project does not update properly due to Unity issue.
    PhotonVoiceView is needed to use recorder and speaker. I know I can use PhotonVoiceView or by prefab workflow. No one teach me so that my workflow that worked in PC - PC, and VR - VR.
    You can use Photon Voice without PhotonVoiceView, I was just curious why not have a prefab that has PhotonVoiceView and Recorder (local) or Speaker (remote).
    1: players on scene with viewID - 1000, 2000, 3000...
    You mean 1001, 2001, 3001 right?
    2: everyone spawned then create PhotonVoiceView - that also gives me 3D sound near player
    do you want 3D sound or not? this is done via AudioSource.spatialBlend. 0 is 'full' 2D, 1 is 'full' 3D. By default, if CreateSpeakerIfNotFound and we create one and we set AudioSource.spatialBlend to 1. This will change in the future.
    It worked always but not now. I really don't know why.
    You mean this stopped working after update to 2.16.1? or what? do you have different problem now after update or similar problem as the one mentioned in the original post?
  • Sorry i am little chaotic, because i fight with this 4 days now.

    changes-voice.txt :
    Photon Voice 2 Change Log

    v2.16.1 (April 30th, 2020)
    PUN2: v2.18.1 (624dae8c)
    PhotonVoiceApi: revision 5464
    You can use Photon Voice without PhotonVoiceView
    I didn't knowed
    I was just curious why not have a prefab that has PhotonVoiceView and Recorder (local) or Speaker (remote).
    

    I tried this to! really nothing helped me.
    You mean 1001, 2001, 3001 right?
    
    no... just 1000, 2000 and Unity show me that is first and second player. Also i tried to make other prefab in next try with 1001, 2001 and that not helped me.
    this is done via AudioSource.spatialBlend
    Yes i know it is not problem.
    You mean this stopped working after update to 2.16.1
    No. I mean it work when I play by 2 PC players, or 2 VR players. Not work when I play PC - VR.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @PawelL,

    How do you instantiate prefabs?
    Not work when I play PC - VR.
    Issue is: PC cannot hear VR.

    - It works in first scene both ways right? it stops working when you switch scenes?
    - or it does not work in any scene from the beginning?
  • It works in first scene both ways right? it stops working when you switch scenes?
    Yes.
    But now I changed something. I am not creating PhotonVoiceNetwork and not creating recorders or speaker in first scene.
    When new scene is loaded and i see in both PCs (Just PC, and PC with Oculus) that game is loaded, then i click "Create voice chat". I added that for test and that create localy PhotonVoiceView, and add recorder send rpc to second player that i clicked it and create PhotonVoiceView that create automaticly speaker in remote. In second PC i do the same.
    Now I have created automaticlly "PhotonVoiceNetwork singleton" and Cached Remote Voices' Info show

    in VR :
    voice# 1
    Player# 2
    Channel# 0
    UserData: 1001

    in PC:
    voice# 1
    Player# 1
    Channel# 0
    UserData: 2001

    I can see other player oculus avatar so it is the same room. Even Client Debug Info show the same _voice_ room and 2 players.

    I can hear PC, i can't hear VR (but speaker show straight line curve when start Transmit enabled)
  • public void VoiceChatIntance() //EDITOR CLICK
        {
            StartCoroutine(InitVoiceChat());
        }
    
        public IEnumerator InitVoiceChat()
        {
            int viewId = photonView.ViewID + 1; //photonView.ViewID = local player
            GameObject voiceController = new GameObject("voice " + viewId.ToString());
            voiceController.SetActive(false);
            PhotonVoiceView photonVoiceView = voiceController.AddComponent<PhotonVoiceView>();
            PhotonView pv = voiceController.GetComponent<PhotonView>();
            pv.ViewID = viewId;
            voiceController.SetActive(true);
            pv.RequestOwnership();
            yield return new WaitForEndOfFrame();
            Recorder recorder = voiceController.AddComponent<Recorder>();
            photonVoiceView.RecorderInUse = recorder;
            recorder.TransmitEnabled = true;
    
            photonView.RPC(nameof(PlayerVRRemoteController.RPCCreateSpeaker), RpcTarget.Others);
        }
    
    [PunRPC]
        public void RPCCreateSpeaker()
        {
            int viewId = photonView.ViewID + 1;
            GameObject voiceController = new GameObject("voice " + viewId.ToString());
            voiceController.SetActive(false);
            PhotonVoiceView photonVoiceView = voiceController.AddComponent<PhotonVoiceView>();
            PhotonView pv = voiceController.GetComponent<PhotonView>();
            pv.ViewID = viewId;
            voiceController.SetActive(true);
            voiceController.gameObject.GetComponent<AudioSource>().spatialBlend = 0;
        }
    
  • JohnTube
    JohnTube ✭✭✭✭✭
    If you increase log level of PhotonVoiceView to ALL and add a debug button that calls PhotonVoiceView.Init what happens?
  • Nothing.
    I debug this and
    this.photonView.ViewID > 0 is true in recorder and speaker.
    this.IsSetup is true in recorder and speaker.
    (this.IsSpeaker && !this.SpeakerInUse.IsLinked) is false because this.SpeakerInUse.IsLinked is true in speaker, this.IsSpeaker is false in recorder
  • JohnTube
    JohnTube ✭✭✭✭✭
    what happens if you restart recording?
    recorder.IsRecording = false;
    recorder.IsRecording = true;
    

    or
    recorder.StopRecording();
    recorder.StartRecording();
    
  • Recorder box : IsRecording call stop and start recording, so i click it and nothing happend, nothing changed and then i used Init again and nothing happend :<
  • JohnTube
    JohnTube ✭✭✭✭✭
    is this Oculus?
    did you take a look here and here?
    did you disable (set to false, uncheck, untick) recorder.VoiceDetection (VAD)?
    what's the value of recorder.IsCurrentlyTransmitting?
    do you use WebRtcAudioDsp? if yes remove it for now.
  • Oculus Rift S with OVR SDK. I will remove sdk in future but now i can't.
    did you take a look here and here?
    Yes and all is setted as in documentation.
    did you disable (set to false, uncheck, untick) recorder.VoiceDetection (VAD)?
    I have this disable, should not?
    what's the value of recorder.IsCurrentlyTransmitting?
    True, recorder.IsRecording = true && this.recorder.TransmitEnabled = true
    Also in local debug speaker i have normal signal (i can hear myself in debug echo)
    do you use WebRtcAudioDsp?
    No, I don't and i don't know what it is.
  • I made session with 1 PC and 2 VRs and vrs can hear each others but pc can't hear VRs
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @PawelL,
    I have this disable, should not?
    No this is fine, for testing leave VAD disabled.
    weird that recorder is transmitting, speaker is linked and yet it does not work!

    photonVoiceView.SpeakerInUse.IsPlaying is false?

    how do you connect the Photon Voice client?

    hmm since the way you instantiate and set ViewID is orthodox, I think it's better if you share a minimal repro project here or via private message or via developer@photonengine.com.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hey @PawelL,

    Photon Voice 2.17 is out.
    It would be nice to check it out and see if it helps you solve the issue or identify the cause.
    I suggest you set LogLevel to WARNING at least if not INFO/ALL for all Voice components (PhotonVoiceNetwork, PhotonVoiceVIew, Speaker, Recorder).
  • JohnTube
    JohnTube ✭✭✭✭✭
    hey @PawelL,

    You could make use of the script here and the PUN RPC "CantHearYou" to debug this.
    You could also set an AudioClip and transmit it to make sure the issue is not in the microphone.
  • Sorry i didn't answer, but i found solution and i had to work hard....
    as i said
    I made session with 1 PC and 2 VRs and vrs can hear each others but pc can't hear VRs

    Later after that i added to my pc-player: local avatar and ovr camera rig (oculus prefabs) and it worked. I couldn't do vr stufs in my pc version, but voice chat worked so i deleted local avatar and that worked... so i tried to delete more components, but if i deleted something from ovr camera rig then it not work.

    My solution is to instantiate hybrid of VR-PC player and then disable VR components and that work. I don't know why it work, and i really don't want to know... it is traumatic for me i spend for this all week.

    Thank you for help