Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1026981 // vosk_recognize16KWav

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (6447L/45K).

sS vosk_recognize16KWav(File wav, O... _) {
  optPar S envVars;
  optPar S language = "en";
  
  assertFileExists(wav);
  File dir = assertNotNull("vosk dir not set", vosk_example_dir());
  File model1 = newFile(dir, "model-" + assertIdentifier(language));
  assertFileExists(model1);
  LS args = ll(platformQuote(model1));

  File pyFile = newFile(dir, "recognize.py");
  if (!fileExists(pyFile))
    saveTextFile(pyFile, loadSnippet(#1026985));
  time "vosk recognition" {
    S text = trim(backtickToConsole_returnOutput("python3 " + platformQuote(pyFile) + " " +
    + joinWithSpace(args) + " " + platformQuote(wav)));
  }
  ret text;
}

sS vosk_recognize16KWav(S wav) {
  ret vosk_recognize16KWav(newFile(wav));
}

Author comment

Began life as a copy of #1026959

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026981
Snippet name: vosk_recognize16KWav
Eternal ID of this version: #1026981/8
Text MD5: 3d6850a0ea9509f14365050209622f5d
Transpilation MD5: e86b60e4af3b76af6c4fa655a0438817
Author: stefan
Category: javax / speech recognition
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-06 02:53:20
Source code size: 740 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 267 / 377
Version history: 7 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)