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

feat: plugin rework #3

Merged
merged 42 commits into from
Mar 9, 2023
Merged

Conversation

sergsavchuk
Copy link
Collaborator

@sergsavchuk sergsavchuk commented Mar 9, 2023

Hi there!
Me and @EvgeniyVabishchevich reworked the plugin to make it more flexible and useful (sorry for making this PR so huge).

Motivation

I am using this plugin in my private project and I felt a lack of control over recognition when using it. There was also an unpleasant bug: the model was loaded in a separate thread on the Android side, so await VoskFlutterPlugin.initModel(modelZip); didn't wait for the model to load, and if you had started recognition immediately after that, you would have received an error.

Major changes

Bumped VOSK android lib version to 0.3.46

Added the ability to create and work with VOSK Models and Recognizers

Now you can create multiple recognizers, configure them and use them to recognize audio data.

Applied very_good_analysis

To keep the plugin's code readability and the overall code quality at a high level.

Added unit tests

Utility code that doesn't use platform calls are covered with unit tests

Added integration tests

To test the code that use platform calls I added integration tests that can be run on an android device or emulator.

Configured Github Actions

To check the style and formatting of the code, to run unit and integration tests on each pull request. There is also a badge in Readme.md which displays the status of the last worklow run:
image

Minor changes

  • removed RECORD_AUDIO permission from the plugin's manifest
  • microphone permission check has been moved to the Dart side of plugin
  • applied google code style to Java code
  • license added(I just copied it from other @alphacep projects)
  • package has been prepared for publishing to pub.dev

Further thoughts

FFI

This has already been mentioned in #2, but it would be great to use Dart FFI to interact with VOSK lib, as it's done in Java VOSK API via JNA. Maybe I'll try to do that somewhere in the future 😃.

Publishing

It will be great to publish the plugin to pub.dev to make it more accessible for developers. But it will take some effort on your part. If you would like to publish the package and will have time to do so, please feel free to contact me with any questions.

sergsavchuk and others added 30 commits February 13, 2023 02:55
The minor changes:
- updated readme
- updated pubspec.yaml
- added barrel file
- added ModelLoader to simplify model loading
- load model in separate isolate
…n wrong arguments names or types where sent. Removed some unnecessary exception handling. +small fixes
…n wrong arguments names or types where sent. Removed some unnecessary exceptio

n handling. +small fixes
…stence check, before call its functions. Added spech service destruction before program closing.
@nshmyrev nshmyrev merged commit 24030e0 into alphacep:master Mar 9, 2023
@nshmyrev
Copy link
Contributor

nshmyrev commented Mar 9, 2023

Cool job done, thanks a lot! I'll publish coming days on pub.dev

Please let us know if you have other thoughts!

@nshmyrev
Copy link
Contributor

nshmyrev commented Mar 9, 2023

I published https://pub.dev/packages/vosk_flutter but didn't test fully, thanks a lot again!

@sergsavchuk
Copy link
Collaborator Author

I published https://pub.dev/packages/vosk_flutter but didn't test fully, thanks a lot again!

🚀 It looks great, you can actually transfer the package to a verified account associated with your domain(https://alphacephei.com/), more info about this here

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

Successfully merging this pull request may close these issues.

3 participants