void Start() { // Restart recording if companion app for mic input has reconnected serverSideConnectRequestManager.ClientConnectedEventStream .Where(clientConnectionEvent => clientConnectionEvent.IsConnected && !micSampleRecorder.IsRecording && micProfile != null && micProfile.ConnectedClientId == clientConnectionEvent.ConnectedClientHandler.ClientId) .Subscribe(_ => micSampleRecorder.StartRecording()) .AddTo(gameObject); // Find first sentence to analyze SetRecordingSentence(recordingSentenceIndex); if (micProfile != null) { roundingDistance = playerProfile.Difficulty.GetRoundingDistance(); micSampleRecorder.MicProfile = micProfile; micSampleRecorder.StartRecording(); // The AudioSampleAnalyzer uses the MicSampleRecorder's sampleRateHz. Thus, it must be initialized after the MicSampleRecorder. audioSamplesAnalyzer = MicPitchTracker.CreateAudioSamplesAnalyzer(settings.AudioSettings.pitchDetectionAlgorithm, micSampleRecorder.SampleRateHz); audioSamplesAnalyzer.Enable(); } else { Debug.LogWarning($"No mic for player {playerProfile.Name}. Not recording player notes."); gameObject.SetActive(false); } }
void Start() { // Find first sentence to analyze SetRecordingSentence(recordingSentenceIndex); if (micProfile != null) { roundingDistance = playerProfile.Difficulty.GetRoundingDistance(); audioSamplesAnalyzer = MicPitchTracker.CreateAudioSamplesAnalyzer(settings.AudioSettings.pitchDetectionAlgorithm, micSampleRecorder.SampleRateHz); audioSamplesAnalyzer.Enable(); micSampleRecorder.MicProfile = micProfile; micSampleRecorder.StartRecording(); } else { Debug.LogWarning($"No mic for player {playerProfile.Name}. Not recording player notes."); gameObject.SetActive(false); } }