Skip to content

Commit

Permalink
deepgram fix
Browse files Browse the repository at this point in the history
- vad won't falsely activate at the beginning of recordings (deepgram)
  • Loading branch information
VRCWizard authored Feb 3, 2024
1 parent 0c53584 commit 05ceab1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions OSCVRCWiz/Resources/StartUp/StartUps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public static void OnFormLoad() //delayed until form is loaded correctly
VRChatListener.initiateTimer();
SpotifyAddon.initiateTimer();
WhisperRecognition.initiateWhisper();
VoiceWizardProRecognition.deepgramStartup();
ToastNotification.initiateTimer();


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ public class VoiceWizardProRecognition
private static int frameSize;
public static CancellationTokenSource deepgramCt = new();


public static void deepgramStartup()
{

vad = new WebRtcVad()
{
OperatingMode = OperatingMode.HighQuality,
FrameLength = frameLength,
SampleRate = SampleRate.Is16kHz,
};
frameSize = (int)vad.SampleRate / 1000 * 2 * (int)frameLength;
}

public static async Task doRecognition(string apiKey,bool calibrating)
{
try
Expand Down Expand Up @@ -311,13 +324,9 @@ public static async Task<MemoryStream> RecordAudio(int minDuration, int maxDurat
bool validAudioClip = false;
TimeSpan startTime = DateTime.MinValue.TimeOfDay;
TimeSpan endTime = DateTime.MinValue.TimeOfDay;
vad = new WebRtcVad()
{
OperatingMode = VADMode,
FrameLength = frameLength,
SampleRate = SampleRate.Is16kHz,
};
frameSize = (int)vad.SampleRate / 1000 * 2 * (int)frameLength;

vad.OperatingMode = VADMode;


// Set up the silence detection
int silenceThreshold = 1000; // bigger number = less sensative to noise // if set to 2000 it will end earlier because it can't hear me talking
Expand Down

0 comments on commit 05ceab1

Please sign in to comment.