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).

1  
sS vosk_recognize16KWav(File wav, O... _) {
2  
  optPar S envVars;
3  
  optPar S language = "en";
4  
  
5  
  assertFileExists(wav);
6  
  File dir = assertNotNull("vosk dir not set", vosk_example_dir());
7  
  File model1 = newFile(dir, "model-" + assertIdentifier(language));
8  
  assertFileExists(model1);
9  
  LS args = ll(platformQuote(model1));
10  
11  
  File pyFile = newFile(dir, "recognize.py");
12  
  if (!fileExists(pyFile))
13  
    saveTextFile(pyFile, loadSnippet(#1026985));
14  
  time "vosk recognition" {
15  
    S text = trim(backtickToConsole_returnOutput("python3 " + platformQuote(pyFile) + " " +
16  
    + joinWithSpace(args) + " " + platformQuote(wav)));
17  
  }
18  
  ret text;
19  
}
20  
21  
sS vosk_recognize16KWav(S wav) {
22  
  ret vosk_recognize16KWav(newFile(wav));
23  
}

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: 174 / 262
Version history: 7 change(s)
Referenced in: [show references]