mirror of
https://github.com/alphacep/vosk-api.git
synced 2026-03-23 00:01:25 +08:00
* Init gem * WIP * WIP * WIP: Gemify * WIP * Try ffi_gen * Revert "Try ffi_gen" This reverts commit a54e56b35a1bdc079dbe122aff47d79038d4e52f. * Vibecode 1 * Vibecode 2 * rework progressbar * Some ref + test_captcha * Return deleted by Claude * Draft precompiled packaging * Review and refactor C bindings * ref OwnedString * Rename methods and add notes * rubocop * Fix progressbar, add examples * Ref spec * Ref spec - final * Final ver * Add srt, other fixes * Move to ruby dir --------- Co-authored-by: Nickolay V. Shmyrev <nshmyrev@gmail.com>
18 lines
395 B
Ruby
Executable File
18 lines
395 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
# frozen_string_literal: true
|
|
|
|
require "vosk"
|
|
|
|
SAMPLE_RATE = 16_000
|
|
|
|
Vosk.log_level = -1
|
|
|
|
model = Vosk::Model.new(lang: "en-us")
|
|
rec = Vosk::KaldiRecognizer.new(model, SAMPLE_RATE)
|
|
rec.words = true
|
|
|
|
IO.popen(["ffmpeg", "-loglevel", "quiet", "-i", "audio.mp4",
|
|
"-ar", SAMPLE_RATE.to_s, "-ac", "1", "-f", "s16le", "-",]) do |stream|
|
|
puts rec.srt_result(stream)
|
|
end
|