Detect when user is talking with VoiceDetection
Options
BFX
✭
in Photon Voice
I've activated VoiceDetection and regulated the threshold accordingly. It works well, I can clearly hear my voice being transmitted when talking and transmission being put on hold during silence. However, I need to fire some events connected to when the user is talking and I'm not able to do so.
These are my current Recorder settings --> https://ibb.co/K6wHLmg
And this is the code I'm using to detect when the user is talking:
My log is showing "Talking" all the time even during silence.
My Stack:
These are my current Recorder settings --> https://ibb.co/K6wHLmg
And this is the code I'm using to detect when the user is talking:
public class VoiceEvents : MonoBehaviour { Recorder recorder; PhotonVoiceView voiceView; // Start is called before the first frame update void Start() { // Audio is not transmitted by default recorder = GetComponent<Recorder>(); voiceView = GetComponent<PhotonVoiceView>(); // recorder.TransmitEnabled = false; } // Update is called once per frame void Update() { if (recorder.TransmitEnabled) { Debug.Log("Talking"); } else { Debug.Log("Silence"); } } }
My log is showing "Talking" all the time even during silence.
My Stack:
- Unity3D 2019.3 - Oculus Quest - PUN2 Free - 2.17.1 - Photon Voice FREE 1.23
0
Comments
-
Hi @BFX,
Make sure Photon Voice version is correct!
It should be 2.15 and not 1.23.
You could use Recorder.VoiceDetector.Detected or Recorder.VoiceDetector.OnDetected.
Or Recorder.IsCurrentlyTransmitting.
By the way, you could get the Recorder in use from PhotonVoiceView.RecorderInUse.0 -
Thanks a lot. We updated it and using Recorder.IsCurrentlyTransmitting. Now it's working well.0