Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vosk 0.3.30, SetWords support, acceptWaveform with "raw" float buffer #11

Merged
merged 2 commits into from
Aug 30, 2021

Conversation

Yahweasel
Copy link
Contributor

@Yahweasel Yahweasel commented Aug 24, 2021

Hello,

I made some updates to vosk-browser that I needed for my own (potential) use of it. Hopefully none of them are too offensive, so you may want to integrate them.

  1. I updated Vosk to 0.3.30. This was more painful than it should've been. 0.3.30 really wants a newer version of OpenFST, but trying to update OpenFST caused Kaldi not to compile, and trying to update Kaldi caused the MKL dependency to break, and I couldn't get the newer MKL to compile under Emscripten. Luckily, then OpenFST issue is incredibly trivial, so instead I just included a one-line patch to vosk, with which 0.3.30 works fine.
  2. I added SetWords. This involved adding a class of "set" messages, which I generalized so that newer recognizer settings can be added in the future, though the only one I added was words. The words setting is preserved in the frontend "meta-recognizer" (whatever you'd like to call it), so that if a new backend recognizer needs to be made because sample rates change, it will preserve the setting.
  3. I added a version of acceptWaveform that works with a raw float buffer, acceptWaveformFloat. I need this because in my project, I already have three or four other components hanging off of an AudioWorkletNode, so conforming to AudioBuffer or your AudioWorkletNode was not an option, but just giving a waveform was.

If you have a better solution for upgrading Vosk, it would obviously be preferable :). Everything else here is pretty tame.

@nshmyrev
Copy link

0.3.30 really wants a newer version of OpenFST, but trying to update OpenFST caused Kaldi not to compile

Not just newer, we have our own version with important speed fixes (about 20% faster). It is better to build our openfst than generic one.

@Yahweasel
Copy link
Contributor Author

0.3.30 really wants a newer version of OpenFST, but trying to update OpenFST caused Kaldi not to compile

Not just newer, we have our own version with important speed fixes (about 20% faster). It is better to build our openfst than generic one.

OHHHHHHH. I'll bet that's why that was such a rabbit hole :). My apologies, I was not familiar with that quirk.

@ccoreilly
Copy link
Owner

Thank you very much for your contribution @Yahweasel ! I have been meaning to update vosk-api to the latest version (as well as adding other stuff) but have had no time, so it is really appreciated.

As @nshmyrev points out, vosk-api uses its own fork of Kaldi and OpenFST but when I started working on vosk-browser I had issues with OpenFST 1.8.0 compilation as it would not find the zlib dependency. I'll try to fix that again.

I'll test your changes locally and merge/publish them, thanks again!

@ccoreilly ccoreilly mentioned this pull request Aug 24, 2021
@ccoreilly ccoreilly merged commit 97dc5b4 into ccoreilly:master Aug 30, 2021
@ccoreilly
Copy link
Owner

FYI: I updated the build and it now uses the OpenFST fork of Alpacephei in version 1.8.0. I will publish a new package in npm once I've cleaned up some things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants