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

Commit 9bba8f3

Browse files
committed
fix: add partial recognition listener for Azure
1 parent f7bbe26 commit 9bba8f3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/io/spokestack/spokestack/microsoft/AzureSpeechRecognizer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public AzureSpeechRecognizer(SpeechConfig speechConfig) {
9797
+ sampleRate);
9898
}
9999

100-
this.buffer = ByteBuffer.allocateDirect(4096)
100+
this.buffer = ByteBuffer.allocateDirect(1500)
101101
.order(ByteOrder.LITTLE_ENDIAN);
102102
this.msConfig = createMsConfig(apiKey, region);
103103
}
@@ -178,6 +178,7 @@ SpeechRecognizer createRecognizer(SpeechContext context) {
178178
private void listen(SpeechRecognizer rec, SpeechContext context) {
179179
RecognitionListener recognitionListener =
180180
new RecognitionListener(context);
181+
rec.recognizing.addEventListener(recognitionListener);
181182
rec.recognized.addEventListener(recognitionListener);
182183

183184
CancellationListener cancellationListener =
@@ -191,7 +192,6 @@ void bufferFrame(ByteBuffer frame) {
191192
flush();
192193
}
193194

194-
frame.rewind();
195195
this.buffer.put(frame);
196196
}
197197
}

0 commit comments

Comments
 (0)