generate functionSun, 04 Dec 2022

Offline speech recognition vosk

from vosk import Model, KaldiRecognizer import sys if not sys.argv[1]: print ("Missing wav parameter") sys.exit() model = Model("model") rec = KaldiRecognizer(model, 16000) with open(sys.argv[1], "rb") as f: for buf in f: if buf: rec.AcceptWaveform(buf) else: result = json.dumps(rec.FinalResult()) print(result) break

Questions about programming?Chat with your personal AI assistant