# OVOS Simple Listener
`ovos-simple-listener` is a lightweight alternative to `ovos-dinkum-listener`, designed for efficient wake word detection and speech recognition.
This listener provides a streamlined approach for integrating voice command capabilities into your applications using the Open Voice OS (OVOS) framework.
It was made to power [hivemind-listener](https://github.com/JarbasHiveMind/hivemind-listener) and [hivemind-mic-satellite](https://github.com/JarbasHiveMind/hivemind-mic-satellite), but can also be used in place of [ovos-dinkum-listener](https://github.com/OpenVoiceOS/ovos-dinkum-listener) in your OVOS setups
> at around 150 Lines of code, this repo is a good clean reference of how to use OVOS audio plugins in your own applications
## Features
- **Wake Word Detection**: Supports customizable wake word engines to initiate listening.
- **Voice Activity Detection (VAD)**: Detects silence and speech to optimize audio processing.
- **Speech Recognition**: Utilizes various speech-to-text (STT) engines to transcribe audio input.
- **Callback System**: Provides a flexible callback mechanism to handle state changes and processed audio.
- **Multithreading Support**: Operates in a separate thread to avoid blocking the main application flow.
## Installation
> TODO: This has not yet been packaged and published on pypi, you must run the code manually
To use `ovos-simple-listener`, clone this repository and install the necessary dependencies. You can do this using pip:
```bash
git clone https://github.com/TigreGotico/ovos-simple-listener
cd ovos-simple-listener
pip install -r requirements.txt
```
## OVOS Usage
run `ovos_simple_listener/__main__.py` in place of ovos-dinkum-listener, plugins are selected from the default OVOS config `~/.config/mycroft/mycroft.conf`
## Library Usage
To use `ovos-simple-listener`, you can initialize it with the desired components (microphone, STT, VAD, and wake word) as shown in the example below:
```python
from ovos_simple_listener import SimpleListener
from ovos_plugin_manager.microphone import OVOSMicrophoneFactory
from ovos_plugin_manager.stt import OVOSSTTFactory
from ovos_plugin_manager.vad import OVOSVADFactory
from ovos_plugin_manager.wakewords import OVOSWakeWordFactory
listener = SimpleListener(
mic=OVOSMicrophoneFactory.create(),
vad=OVOSVADFactory.create(),
wakeword=OVOSWakeWordFactory.create_hotword("hey_mycroft"),
stt=OVOSSTTFactory.create()
)
listener.run()
```
### Callbacks
You can implement your own callbacks by extending the `ListenerCallbacks` class to handle events such as starting a command, ending listening, processing audio, errors, and recognizing text.
```python
from ovos_simple_listener import ListenerCallbacks
class MyCallbacks(ListenerCallbacks):
@classmethod
def listen_callback(cls):
# Handle when the listener starts processing a command
pass
@classmethod
def end_listen_callback(cls):
# Handle when the listener stops processing a command
pass
@classmethod
def audio_callback(cls, audio):
# Handle processed audio data
pass
@classmethod
def error_callback(cls, audio):
# Handle STT errors
pass
@classmethod
def text_callback(cls, utterance, lang):
# Handle recognized text
pass
```
## Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
## Acknowledgements
- [Open Voice OS](https://openvoiceos.org) for providing the framework and plugins.
Raw data
{
"_id": null,
"home_page": "https://github.com/OpenVoiceOS/ovos-simple-listener",
"name": "ovos-simple-listener",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/53/92/df1531ce00f9ba9c46c42cf2b02ddf8705a285a0a19078698d6ef7b8e92b/ovos-simple-listener-0.0.3.tar.gz",
"platform": null,
"description": "# OVOS Simple Listener\n\n`ovos-simple-listener` is a lightweight alternative to `ovos-dinkum-listener`, designed for efficient wake word detection and speech recognition. \n\nThis listener provides a streamlined approach for integrating voice command capabilities into your applications using the Open Voice OS (OVOS) framework.\n\nIt was made to power [hivemind-listener](https://github.com/JarbasHiveMind/hivemind-listener) and [hivemind-mic-satellite](https://github.com/JarbasHiveMind/hivemind-mic-satellite), but can also be used in place of [ovos-dinkum-listener](https://github.com/OpenVoiceOS/ovos-dinkum-listener) in your OVOS setups\n\n> at around 150 Lines of code, this repo is a good clean reference of how to use OVOS audio plugins in your own applications\n\n## Features\n\n- **Wake Word Detection**: Supports customizable wake word engines to initiate listening.\n- **Voice Activity Detection (VAD)**: Detects silence and speech to optimize audio processing.\n- **Speech Recognition**: Utilizes various speech-to-text (STT) engines to transcribe audio input.\n- **Callback System**: Provides a flexible callback mechanism to handle state changes and processed audio.\n- **Multithreading Support**: Operates in a separate thread to avoid blocking the main application flow.\n\n## Installation\n\n> TODO: This has not yet been packaged and published on pypi, you must run the code manually\n\nTo use `ovos-simple-listener`, clone this repository and install the necessary dependencies. You can do this using pip:\n\n```bash\ngit clone https://github.com/TigreGotico/ovos-simple-listener\ncd ovos-simple-listener\npip install -r requirements.txt\n```\n\n## OVOS Usage\n\nrun `ovos_simple_listener/__main__.py` in place of ovos-dinkum-listener, plugins are selected from the default OVOS config `~/.config/mycroft/mycroft.conf`\n\n## Library Usage\n\nTo use `ovos-simple-listener`, you can initialize it with the desired components (microphone, STT, VAD, and wake word) as shown in the example below:\n\n```python\nfrom ovos_simple_listener import SimpleListener\nfrom ovos_plugin_manager.microphone import OVOSMicrophoneFactory\nfrom ovos_plugin_manager.stt import OVOSSTTFactory\nfrom ovos_plugin_manager.vad import OVOSVADFactory\nfrom ovos_plugin_manager.wakewords import OVOSWakeWordFactory\n\nlistener = SimpleListener(\n mic=OVOSMicrophoneFactory.create(),\n vad=OVOSVADFactory.create(),\n wakeword=OVOSWakeWordFactory.create_hotword(\"hey_mycroft\"),\n stt=OVOSSTTFactory.create()\n)\n\nlistener.run()\n```\n\n### Callbacks\n\nYou can implement your own callbacks by extending the `ListenerCallbacks` class to handle events such as starting a command, ending listening, processing audio, errors, and recognizing text.\n\n```python\nfrom ovos_simple_listener import ListenerCallbacks\n\nclass MyCallbacks(ListenerCallbacks):\n @classmethod\n def listen_callback(cls):\n # Handle when the listener starts processing a command\n pass\n\n @classmethod\n def end_listen_callback(cls):\n # Handle when the listener stops processing a command\n pass\n\n @classmethod\n def audio_callback(cls, audio):\n # Handle processed audio data\n pass\n\n @classmethod\n def error_callback(cls, audio):\n # Handle STT errors\n pass\n\n @classmethod\n def text_callback(cls, utterance, lang):\n # Handle recognized text\n pass\n```\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.\n\n## Acknowledgements\n\n- [Open Voice OS](https://openvoiceos.org) for providing the framework and plugins.\n\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "ovos-core listener daemon client",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/OpenVoiceOS/ovos-simple-listener"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c60fab4eb186bb1a6cd574fd3120a2894155d278e243717aa1c6ebd291e885f9",
"md5": "9bd6362c40fd1571e726eb0824e27e7c",
"sha256": "cd7c799b47b798db698a13f27ef5a640ad64b460295659bf4127f53a281cfbaf"
},
"downloads": -1,
"filename": "ovos_simple_listener-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9bd6362c40fd1571e726eb0824e27e7c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 9917,
"upload_time": "2024-10-26T00:05:29",
"upload_time_iso_8601": "2024-10-26T00:05:29.440407Z",
"url": "https://files.pythonhosted.org/packages/c6/0f/ab4eb186bb1a6cd574fd3120a2894155d278e243717aa1c6ebd291e885f9/ovos_simple_listener-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5392df1531ce00f9ba9c46c42cf2b02ddf8705a285a0a19078698d6ef7b8e92b",
"md5": "633bf2fac4dbfd901033a9ffec25a771",
"sha256": "68fc7a7489f9d01075c4baaff931f8f29377a03df8215ff5f6c9362c9e38df76"
},
"downloads": -1,
"filename": "ovos-simple-listener-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "633bf2fac4dbfd901033a9ffec25a771",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9658,
"upload_time": "2024-10-26T00:05:30",
"upload_time_iso_8601": "2024-10-26T00:05:30.733660Z",
"url": "https://files.pythonhosted.org/packages/53/92/df1531ce00f9ba9c46c42cf2b02ddf8705a285a0a19078698d6ef7b8e92b/ovos-simple-listener-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-26 00:05:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "OpenVoiceOS",
"github_project": "ovos-simple-listener",
"github_not_found": true,
"lcname": "ovos-simple-listener"
}