Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
fix: add partial recognition listener for Azure
Browse files Browse the repository at this point in the history
  • Loading branch information
space-pope committed Aug 10, 2021
1 parent f7bbe26 commit 9bba8f3
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public AzureSpeechRecognizer(SpeechConfig speechConfig) {
+ sampleRate);
}

this.buffer = ByteBuffer.allocateDirect(4096)
this.buffer = ByteBuffer.allocateDirect(1500)
.order(ByteOrder.LITTLE_ENDIAN);
this.msConfig = createMsConfig(apiKey, region);
}
Expand Down Expand Up @@ -178,6 +178,7 @@ SpeechRecognizer createRecognizer(SpeechContext context) {
private void listen(SpeechRecognizer rec, SpeechContext context) {
RecognitionListener recognitionListener =
new RecognitionListener(context);
rec.recognizing.addEventListener(recognitionListener);
rec.recognized.addEventListener(recognitionListener);

CancellationListener cancellationListener =
Expand All @@ -191,7 +192,6 @@ void bufferFrame(ByteBuffer frame) {
flush();
}

frame.rewind();
this.buffer.put(frame);
}
}
Expand Down

0 comments on commit 9bba8f3

Please sign in to comment.