assistant.openwakeword#

Description#

Hotword detection plugin that uses OpenWakeWord.

param models:

List of wake word model to use (use list_models() to see the available models). By default all available models are used (use with caution as this may consume significant resources).

param models_directory:

Directory where to store wake word models. Default: <PLATYPUSH_WORKDIR>/openwakeword/models

param detection_sensitivity:

Wake word detection sensitivity, a float between 0.0 and 1.0 (default: 0.4). Higher values increase the sensitivity, i.e. make the plugin more likely to detect a hotword.

param frame_duration:

Audio frame duration in seconds. Default: 0.5 seconds.

param enable_speex_noise_suppression:

Whether to enable Speex-based noise suppression (requires the speexdsp_ns package to be installed). By default it’s enabled if the package is available.

param audio_frame_timeout:

Audio frame timeout in seconds. Any frames older than this value will be discarded. Default: 5.0 seconds.

param pause_seconds_after_hotword:

Number of seconds to pause detection after a hotword is detected, to prevent multiple detections of the same hotword. Default: 2.0 seconds.

param poll_interval:

How often the AssistantOpenwakewordPlugin.loop function should be executed (default: 15 seconds). NOTE: For back-compatibility reasons, the poll_seconds argument is also supported, but it’s deprecated.

param stop_timeout:

How long we should wait for any running threads/processes to stop before exiting (default: 5 seconds).

param disable_monitor:

If set to True then the plugin will not monitor for new events. This is useful if you want to run a plugin in stateless mode and only leverage its actions, without triggering any events. Defaults to False.

Configuration#

assistant.openwakeword:
  # [Optional]

  # models:   # type=Iterable[str] | None

  # [Optional]

  # models_directory:   # type=str | None

  # [Optional]

  # detection_sensitivity: 0.4  # type=float

  # [Optional]

  # frame_duration: 0.5  # type=float

  # [Optional]

  # enable_speex_noise_suppression:   # type=bool | None

  # [Optional]

  # audio_frame_timeout: 5.0  # type=float

  # [Optional]

  # pause_seconds_after_hotword: 2.0  # type=float

  # [Optional]
  # How often the `RunnablePlugin.loop <https://docs.platypush.tech/platypush/plugins/.html#platypush.plugins.RunnablePlugin.loop>`_ function should be
  # executed (default: 15 seconds). *NOTE*: For back-compatibility
  # reasons, the `poll_seconds` argument is also supported, but it's
  # deprecated.
  # poll_interval: 15  # type=float | None

  # [Optional]
  # How long we should wait for any running
  # threads/processes to stop before exiting (default: 5 seconds).
  # stop_timeout: 5  # type=float | None

  # [Optional]
  # If set to True then the plugin will not monitor
  # for new events. This is useful if you want to run a plugin in
  # stateless mode and only leverage its actions, without triggering any
  # events. Defaults to False.
  # disable_monitor: False  # type=bool

Dependencies#

pip

pip install sounddevice platypush-openwakeword ai-edge-litert

Alpine

apk add swig speexdsp

Debian

apt install swig libspeexdsp-dev

Fedora

yum install swig speexdsp

Arch Linux

pacman -S swig speexdsp

Triggered events#

Actions#

Module reference#

class platypush.plugins.assistant.openwakeword.AssistantOpenwakewordPlugin(models: Iterable[str] | None = None, models_directory: str | None = None, detection_sensitivity: float = 0.4, frame_duration: float = 0.5, enable_speex_noise_suppression: bool | None = None, audio_frame_timeout: float = 5.0, pause_seconds_after_hotword: float = 2.0, **kwargs)[source]#

Bases: RunnablePlugin

Hotword detection plugin that uses OpenWakeWord.

Parameters:
  • models – List of wake word model to use (use list_models() to see the available models). By default all available models are used (use with caution as this may consume significant resources).

  • models_directory – Directory where to store wake word models. Default: <PLATYPUSH_WORKDIR>/openwakeword/models

  • detection_sensitivity – Wake word detection sensitivity, a float between 0.0 and 1.0 (default: 0.4). Higher values increase the sensitivity, i.e. make the plugin more likely to detect a hotword.

  • frame_duration – Audio frame duration in seconds. Default: 0.5 seconds.

  • enable_speex_noise_suppression – Whether to enable Speex-based noise suppression (requires the speexdsp_ns package to be installed). By default it’s enabled if the package is available.

  • audio_frame_timeout – Audio frame timeout in seconds. Any frames older than this value will be discarded. Default: 5.0 seconds.

  • pause_seconds_after_hotword – Number of seconds to pause detection after a hotword is detected, to prevent multiple detections of the same hotword. Default: 2.0 seconds.

__init__(models: Iterable[str] | None = None, models_directory: str | None = None, detection_sensitivity: float = 0.4, frame_duration: float = 0.5, enable_speex_noise_suppression: bool | None = None, audio_frame_timeout: float = 5.0, pause_seconds_after_hotword: float = 2.0, **kwargs)[source]#
Parameters:
  • poll_interval – How often the loop() function should be executed (default: 15 seconds). NOTE: For back-compatibility reasons, the poll_seconds argument is also supported, but it’s deprecated.

  • stop_timeout – How long we should wait for any running threads/processes to stop before exiting (default: 5 seconds).

  • disable_monitor – If set to True then the plugin will not monitor for new events. This is useful if you want to run a plugin in stateless mode and only leverage its actions, without triggering any events. Defaults to False.

list_models() List[str][source]#

List available wake word models.