Capturing outgoing PUN voice

Hi

I need to save outgoing voice to .wav file.
I've checked this article
https://doc.photonengine.com/en-us/voice/current/troubleshooting/faq#how_to_save_conversations_into_files_
and forum posts, but still have difficulties.

Article says that need to use IProcessor.Process, but this method actually requires input audio data as a parameter. Where I can find that data? Could you clarify how can get outgoing audio data?

Comments

  • Hi @bananalopa,

    Thank you for choosing Photon and sorry for the delay!

    Where I can find that data? Could you clarify how can get outgoing audio data?
    Data will be automatically passed to the processor by the Photon Voice API. You need to add your custom processor when the voice stream is created.

    In the component to be attached to the same GameObject as the Recorder:
    private void PhotonVoiceCreated(PhotonVoiceCreatedParams p)
            {
                if (p.Voice is LocalVoiceAudioFloat)
                {
                    LocalVoiceAudioFloat v = p.Voice as LocalVoiceAudioFloat;
                     // create floatProcessor that extends IProcessor.Process<float>
                    v.AddPostProcessor(this.floatProcessor);
                }
                else if (p.Voice is LocalVoiceAudioShort)
                {
                    LocalVoiceAudioShort v = p.Voice as LocalVoiceAudioShort;
                    // create shortProcessor that extends IProcessor.Process<short>
                    v.AddPostProcessor(this.shortProcessor);
                }
                else if (this.Logger.IsErrorEnabled)
                {
                    this.Logger.LogError("LocalVoice object has unexpected value/type: {0}", p.Voice == null ? "null" : p.Voice.GetType().ToString());
                }
            }
Sign In or Register to comment.