sS deepspeech_recognize16KWav(File wav, O... _) { optPar bool useKnownPlaces; optPar S envVars; assertFileExists(wav); File dir = assertNotNull("DeepSpeech dir not set", deepspeech_dir()); File model1 = newFile(dir, "deepspeech-0.6.1-models/output_graph" + (isRaspberryPi() ? ".tflite" : ".pbmm")); assertFileExists(model1); LS args = ll( "--model", platformQuote(model1), "--lm", platformQuote(newFile(dir, "deepspeech-0.6.1-models/lm.binary")), "--trie", platformQuote(newFile(dir, "deepspeech-0.6.1-models/trie")), "--audio" ); File virtualEnv = userDir("tmp/deepspeech-venv"); File virtualEnvActivate = newFile(virtualEnv, "bin/activate"); assertFileExists(virtualEnvActivate); File scriptFile, outFile, errFile; if (useKnownPlaces) { scriptFile = javaxCachesDir("deepspeech.sh"); outFile = javaxCachesDir("deepspeech.out"); errFile = javaxCachesDir("deepspeech.err"); } else { scriptFile = createTempFile(); outFile = createTempFile(); errFile = createTempFile(); } saveTextFile(scriptFile, "source " + platformQuote(virtualEnvActivate) + " && " + unnullPlusSpace(envVars) + "deepspeech" + " " // deepspeech is in the path at that point + joinWithSpace(args) + " " + platformQuote(wav) + " > " + platformQuote(outFile) + " 2> " + platformQuote(errFile)); makeExecutable(scriptFile); time "DeepSpeech" { backtick_verbose(platformQuote(scriptFile)); } ret trim(loadTextFile(outFile)); } sS deepspeech_recognize16KWav(S wav) { ret deepspeech_recognize16KWav(newFile(wav)); }