OpenVoiceOS / ovos-ww-plugin-openWakeWord

Apache License 2.0
1 stars 3 forks source link

Update __init__.py #4

Closed madgrizzle closed 1 year ago

madgrizzle commented 1 year ago

This change properly handles chunk sizes that are not exactly 1280 bytes.

codecov[bot] commented 1 year ago

Codecov Report

Merging #4 (597a13e) into dev (4aaabd8) will not change coverage. Report is 11 commits behind head on dev. The diff coverage is 0.00%.

:exclamation: Current head 597a13e differs from pull request most recent head 861bc42. Consider uploading reports for the commit 861bc42 to get more accurate results

@@          Coverage Diff          @@
##             dev      #4   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files          3       3           
  Lines         35      37    +2     
=====================================
- Misses        35      37    +2     
Files Changed Coverage Δ
ovos_ww_plugin_openwakeword/__init__.py 0.00% <0.00%> (ø)
ovos_ww_plugin_openwakeword/version.py 0.00% <0.00%> (ø)
madgrizzle commented 1 year ago

openWakeWord will split chunks into 1280-sample segments so there is no need to split chunks in the plugin. However, if the chunk size is not a multiple of 1280-samples, then openWakeWord will drop the extra data which will lead to a loss of performance. A better solution is to default to a multiple of 1280 (perhaps 3840 as that's close to the current 4096) and add to the README that chunk size, if it is changed, should be a multiple of 1280. We could also detect the chunk size in the plugin initialization portion and raise a warning if its not a multiple.