Sound heavily distorted with conferencing mic-speaker

Hello everyone,
I have implemented PhotonVoice in my game. It works great, except one thing. Anytime I try to use ANY conferencing mic-speaker the sound gets heavily distorted. I tried several conferencing mic-speaks (Jabra, Plantronics) I also tried SoliCall software solution. It's always the same. It only happens with PhotonVoice sounds. Any other sounds in the game are just fine. The problem disappears if I use any other speaker than conferencing (jack, usb, bluetooth, hdmi are all fine).

I have tried this on two machines. One with Win7 (64b), second Win10 (64b). Drivers are up to date. It's the same problem everywhere.

I tried to mess around with bitrate, sampling rate,... it's always the same. May Opus codec cause this problem? Any idea on how to fix this would be much appreciated. I have already spend so many hours on this.

Thanks a lot

Comments

  • Hi,
    Can you please describe more precise what kind of distortion you experience? Is it echo or something like stuttering? Maybe you can share an audio sample?
  • Hi vadim,
    thank you for replying. Here's the sample of my friends voice transfered over the PUN and played on Jabra conference speaker.

    https://clyp.it/3qtf0zfd#
  • Hi,

    Can you please test latest Photon Voice release? We can't reproduce the issue but maybe other fixes affect it somehow. If the problem still persists, please create new project, import photon voice, set PUN Logging to Full in Photon settings, run TestVoice scene, send us full logs from both sending and receiving clients.
  • Hello,
    sorry for the delay I've been really busy last days. I updated the PUNVoice to the latest version. The problem persisted. I than created a new project, imported latest PUNVoice and tried TestVoice. The problem disappeared! So far I have no idea what kind of incompatibility created this very wierd issue in the last project, but I'll try to identify that and post it here if anybody else runs into the same kind of problems.

    Thank you a lot for your support and help.
  • OK. I found the solution in case somebody else runs into the same issue. The sound distortion was caused by OVRLipSync plugin. I also found out how to fix this. So here comes the detailed solution for those who want to fix this in their projects.

    It's the OVR Lip Sync Context script on the object with Audio Source that causes the distortion. It behaves like a audio effect and uses OnAudioFilterRead function to read the data from the AudioSource. But for some reason it also modifies the output data. The output data are perfectly fine until you try to play them on conference mic-speak device. I am not sure why. Obviously the Lip Sync won't work without it but here's the simple workaround.

    In OVRLipSyncContext.cs find the OnAudioFilterRead method. Copy the sample array into a new separate array and at the end of the method, copy the saved array back to the sample array.

    New class variable:
    private float[] originalData = new float[256];

    Method:
    void OnAudioFilterRead(float[] data, int channels) {
    int len = data.Length;
    for(int i = 0; i < len; ++i) {
    originalData [i] = data [i];
    }

    /*
    ... original function ...
    */

    for(int i = 0; i < len; ++i) {
    data [i] = originalData [i];
    }

    I know this makes LipSync a bit more CPU demanding, but I couldn't find a better solution.

    PS: I know copying the sample array into a new separate array and performing lipsync on the new one would be less demanding but it gave me some wierd noises as well.
  • Hi!

    We are also experiencing audio stuttering but only when more than two players joined a room.
    In our case we use the OVRPlugin but it does not seem to influence PUNVoice.
    Could some other VR-related Unity-plugin cause the problem?

    Thanks!