Read VoiceRecorder.LevelMeter.CurrentAvgAmp in Offline Mode


we want to show the user a calibration screen to display the amplitude of the currently selected microphone. We are doing this by reading the VoiceRecorder.LevelMeter.CurrentAvgAmp value. This works fine, when connected to the Photon Network and if the user is in a room and transmitting data (even if the user is alone). However, we did not find a way to read this value when not connected to the photon network.

As a workaround we may use the unity microphone when offline, but we haven't tested it yet.

Can some one help here?



  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @AndreWe,

    VoiceRecorder.LevelMeter.CurrentAvgAmp should work as long as the Recorder.IsRecording.

    So maybe you could set Recorder.RecordOnlyWhenJoined to false?

  • Hi,

    Yes, we have set "Recorder.RecordOnlyWhenJoined" to false, IsRecording is true, but no "VoiceRecorder.LevelMeter.Current*" values.

    We are using the most recent version photon voice v2.28.2 (December 3rd, 2021).

    Should we upload a small sample project to show the issue?

  • Please find attached a short test script (you have to rename Test.txt to Test.cs).

    * Create a new unity project and install the newest Photon Voice Plugin

    * Use the default scene and add the Test component, Recorder and PhotonVoiceNetwork to the same GameObject and assign the Recorder and the PhotonVoiceNetwork component to the Test component (I have attached a screenshot).

    * Select a valid pun microphone

    * Hit play, and talk to the microphone. When in a room the level meter reacts, but in when offline there is no indication for the level meter (I have attached a screenshot).

    This was tested with Unity 2020.3.24f1

  • Hi @JohnTube

    do you have any update for me? :)

    Thank you and have a great weekend!

  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @AndreWe,

    Sorry for the delay!

    I have made a few tests, apparently it works only when transmission is enabled and Recorder is actually transmitting (not even when VAD is enabled).

    I was going to suggest adding your own custom level meter as a Recorcer/voice (pre)processor but as it turns out the he built-in LevelMeter is actually a processor. So we need to review if (all) processors need the Recorder to be transmitting in order to work.

    But this will be next year, I hope that's not too bad for you.

  • Hi,

    thank you for the feedback.

    So for now we would try to use a normal microphone (without photon), just to show the calibartion meter and that the user can see that someting is moving in the bar.

    Do you have a eta/priority for the issue?

    Thank you.



  • JohnTube
    JohnTube ✭✭✭✭✭
    edited December 2021

    Hi André,

    Sorry no ETA but I will try to make it happen sometime Q1 next year hopefully, I can't promise anything though.

    A workaround is to join a voice room (closed invisible) & transmit just for this? maybe overdoing it by I thought I would suggest this.

  • We thought also about joining a different room and also tested it, however, the connection time etc. is a bit too much for just testing if a microphone would work or not.

    We have now added a custom mictophone component which does the trick :)