Error: Input sampling rate (24000) must be 8000, 16000, 32000 or 48000

Hi, I'm using Photon Voice 2.15, (Unity 2019.3.0b4) in my project and it works fine however,
I'm getting the following error when I run project inside unity:
Voice Connection and Recorder.WebRtcAudioDsp] WebRTCAudioProcessor: input sampling rate (24000) must be 8000, 16000, 32000 or 48000
If I change sampling rate to 48.000 and save then reload the scene, it reverts back to 24000.

I think I can attempt to set samplingRate at Setup() function, but I am not sure if its the good way of fixing this problem.

Recorder.cs or its meta is NOT read-only, why does its values reset?
private POpusCodec.Enums.SamplingRate samplingRate = POpusCodec.Enums.SamplingRate.Sampling48000; didn't work as well.

scene is DemoVoiceMinimal-Scene

I'm also getting the error of:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.EditorGUILayout.IsChildrenIncluded (UnityEditor.SerializedProperty prop) (at <5f8e991dd2bb44d6aaa5ce27d8f20777>:0)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUILayoutOption[] options) (at <5f8e991dd2bb44d6aaa5ce27d8f20777>:0)
Photon.Voice.Unity.UtilityScripts.Editor.ConnectAndJoinEditor.OnInspectorGUI () (at Assets/Photon/PhotonVoice/Code/UtilityScripts/Editor/ConnectAndJoinEditor.cs:30)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass53_0.b__0 () (at <5f8e991dd2bb44d6aaa5ce27d8f20777>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

whenever I select the Gameobject, the script is attached to.

Comments

  • Hi @Ergon,

    First of all, the Photon Voice 2 version should be 2.10 and not 2.15.
    2.15 is PUN2's version

    If I change sampling rate to 48.000 and save then reload the scene, it reverts back to 24000.
    I could not reproduce. If I change it and save the scene, the new value persists as expected. I tried with the different demo scenes.

    To fix this:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.EditorGUILayout.IsChildrenIncluded (UnityEditor.SerializedProperty prop) (at <5f8e991dd2bb44d6aaa5ce27d8f20777>:0)
    UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUILayoutOption[] options) (at <5f8e991dd2bb44d6aaa5ce27d8f20777>:0)
    Photon.Voice.Unity.UtilityScripts.Editor.ConnectAndJoinEditor.OnInspectorGUI () (at Assets/Photon/PhotonVoice/Code/UtilityScripts/Editor/ConnectAndJoinEditor.cs:30)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass53_0.b__0 () (at <5f8e991dd2bb44d6aaa5ce27d8f20777>:0)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)


    Replace the content of "Assets\Photon\PhotonVoice\Code\UtilityScripts\Editor\ConnectAndJoinEditor.cs" with this.
    This will be fixed in the next Photon Voice 2 version.
  • Hi John,
    Thanks for the answer.
    The problem also occurs with newly created projects with no other assets. I will upload a video reproducing the error.
    I couldn't download the https://hastebin.com/mafimacape.cs file, it seems empty.
    Thanks.
  • Hi again, here is the video:


    I sped up some parts of the video, I can upload the full video if you want.
    Thanks again.
  • JohnTubeJohnTube mod
    edited October 3
    Hi @Ergon,

    First of all, thanks for taking the time to record the video.
    I really appreciate quality reports.

    3 things:

    1. Not sure what is the issue with hastebin, this is the second time it happens to me, anyway here is the "ConnectAndJoin.cs" content (I think it may be the cause of the value changes not being persisted, due to an Editor GUI exception):

    namespace Photon.Voice.Unity.UtilityScripts.Editor
    {
        using UnityEditor;
        using UnityEngine;
    
        [CustomEditor(typeof(ConnectAndJoin))]
        public class ConnectAndJoinEditor : Editor
        {
            private ConnectAndJoin connectAndJoin;
            private SerializedProperty randomRoomSp;
            private SerializedProperty roomNameSp;
            private SerializedProperty autoConnectSp;
            private SerializedProperty autoTransmitSp;
    
            private void OnEnable()
            {
                connectAndJoin = target as ConnectAndJoin;
                randomRoomSp = serializedObject.FindProperty("RandomRoom");
                roomNameSp = serializedObject.FindProperty("RoomName");
                autoConnectSp = serializedObject.FindProperty("autoConnect");
                autoTransmitSp = serializedObject.FindProperty("autoTransmit");
            }
    
            public override void OnInspectorGUI()
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(autoConnectSp);
                EditorGUILayout.PropertyField(autoTransmitSp);
                EditorGUILayout.PropertyField(randomRoomSp);
                if (!randomRoomSp.boolValue)
                {
                    EditorGUILayout.PropertyField(roomNameSp);
                }
                if (Application.isPlaying && !connectAndJoin.IsConnected)
                {
                    if (GUILayout.Button("Connect"))
                    {
                        connectAndJoin.ConnectNow();
                    }
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }
            }
        }
    }
    Does this happen in the "DemoVoicePun"? Because it does not use "ConnectAndJoin.cs".

    2. Photon Voice 2 comes with PUN2 included no need to import PUN2 before or after it.
    3. We usually do not support alpha or beta versions of Unity. I did not test Photon Voice 2 with Unity2019.3.x. I will try to reproduce with Unity2019.x.
  • Hi @Ergon,

    Thanks to your report I have managed to reproduce and identify the issue.

    For the time being you could apply a quick fix while we think about the best possible one to apply in the next update:

    In "RecorderEditor.cs"

    Replace:
    if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }
    with:
    if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(recorder);
                    EditorSceneManager.MarkSceneDirty(recorder.gameObject.scene);
                    serializedObject.ApplyModifiedProperties();
                }
    Thanks again.
  • Hi John, thanks for the answer and fixes.

    I switched my project to this workflow. It works great!

    Thanks again.
Sign In or Register to comment.