Skip to content

Commit

Permalink
Merge pull request #90 from uezo/develop
Browse files Browse the repository at this point in the history
Avoid to recognize too long phrase for wakeword #87
  • Loading branch information
uezo authored Nov 15, 2020
2 parents 7857dcc + ca31124 commit 9b5d439
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ChatdollKit/Scripts/IO/WakeWordListenerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class WakeWordListenerBase : VoiceRecorderBase
public float VoiceDetectionThreshold = 0.1f;
public float VoiceDetectionMinimumLength = 0.2f;
public float SilenceDurationToEndRecording = 0.3f;
public float VoiceRecognitionMaximumLength = 3.0f;

public Action OnListeningStart;
public Action OnListeningStop;
Expand Down Expand Up @@ -96,9 +97,12 @@ public async Task StartListeningAsync()
var voiceRecorderResponse = await GetVoiceAsync(0.0f, token);
if (voiceRecorderResponse != null && voiceRecorderResponse.Voice != null)
{
if (voiceRecorderResponse.Voice.length <= VoiceRecognitionMaximumLength)
{
#pragma warning disable CS4014
ProcessVoiceAsync(voiceRecorderResponse.Voice); // Do not await to continue listening
ProcessVoiceAsync(voiceRecorderResponse.Voice); // Do not await to continue listening
#pragma warning restore CS4014
}
}
}
}
Expand Down

0 comments on commit 9b5d439

Please sign in to comment.