Skip to content

Commit

Permalink
'#1909: Use a smaller buffer to avoid Vosk slow down.
Browse files Browse the repository at this point in the history
  • Loading branch information
wladimirleite committed Sep 30, 2023
1 parent d71c6c8 commit df087de
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ protected TextAndScore transcribeAudio(File tmpFile) throws Exception {
int words = 0;

int nbytes;
byte[] buf = new byte[1 << 20];
// Buffer must be small (see #1909)
byte[] buf = new byte[(int) Math.min(tmpFile.length(), 1 << 16)];
while ((nbytes = ais.read(buf)) >= 0) {
if (recognizer.acceptWaveForm(buf, nbytes)) {
TextScoreWords result = decodeFromJson(recognizer.getResult());
Expand Down

0 comments on commit df087de

Please sign in to comment.