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

19
LINES

< > BotCompany Repo | #1026983 // vosk - recognize audio file with vosk (if installed in a certain dir)

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

Transpiled version (4804L) is out of date.

// optional parameter: bool useKnownPlaces
sS vosk(File audioFile, O... _) {
  if (isRIFFFileByContent(audioFile) &&
    eq(wavSampleRateAndChannels(audioFile), pair(16000f, 1)))
    // assuming 16 bit
    ret vosk_recognize16KWav(audioFile, _);
    
  optPar bool useKnownPlaces;
  File wav = useKnownPlaces ? javaxCachesDir("16k-for-vosk.wav") : createTempFileWithExtension(".wav");
  temp useKnownPlaces ? null : tempDeleteFile(wav);
  print("Converting " + audioFile + " to 16k WAV");
  deleteFile(wav);
  ffmpeg_toMonoAudio_16k(audioFile, wav);
  ret vosk_recognize16KWav(wav, _);
}

sS vosk(S f, O... _) {
  ret vosk(newFile(f), _);
}

Author comment

Began life as a copy of #1026958

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: #1026983
Snippet name: vosk - recognize audio file with vosk (if installed in a certain dir)
Eternal ID of this version: #1026983/3
Text MD5: aa5737cbb3ac576eb8999018907641f8
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-05 23:25:43
Source code size: 658 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 291 / 362
Version history: 2 change(s)
Referenced in: [show references]