Commit Graph

1610 Commits

Author SHA1 Message Date
Fabio Manganiello 72bc697122 [assistant.picovoice] Extended documentation. 2024-05-02 00:51:09 +00:00
Fabio Manganiello d813356d9c [music.mopidy] Handle the case where `add` returns a list. 2024-05-02 00:51:09 +00:00
Fabio Manganiello 1192782729 [tts.picovoice] Convert digits before replacing other substrings. 2024-05-02 00:51:09 +00:00
Fabio Manganiello 237fc58928 [tts.picovoice] A more robust logic for replacing unsupported characteres on the input. 2024-05-02 00:51:09 +00:00
Fabio Manganiello d8e24207c5 Added `openai` plugin. 2024-05-02 00:51:09 +00:00
Fabio Manganiello bd4b1d3e0f [assistant.picovoice] Sync between the speech and intent engines. 2024-05-02 00:51:09 +00:00
Fabio Manganiello 632d98703b New architecture for the assistant speech detection logic.
The assistant object now runs in its own thread and leverages an
external `SpeechProcessor` that uses two threads to scan for both
intents and speech in parallel on audio frames.
2024-05-02 00:51:09 +00:00
Fabio Manganiello af1392b5b9 [assistant] Added `ResponseEndEvent` and `IntentMatchedEvent` 2024-05-02 00:51:09 +00:00
Fabio Manganiello bb9b6cd319 [assistant.picovoice] Various improvements.
- Added `intent_model_path` parameter.

- Always apply `expanduser` to configuration paths.

- Better logic to infer the fallback model path.

- The Picovoice Leonardo object should always be removed after
  `assistant.picovoice.transcribe` is called.
2024-05-02 00:51:09 +00:00
Fabio Manganiello f0a780b759 Added `assistant.picovoice.transcribe` and `assistant.picovoice.say`. 2024-05-02 00:51:09 +00:00
Fabio Manganiello f04f7ce9d7 [tts.picovoice] Better text pre-processing logic. 2024-05-02 00:51:09 +00:00
Fabio Manganiello 37d70d67ac [assistant.picovoice] Implemented `assistant.picovoice.send_text_query`. 2024-05-02 00:51:09 +00:00
Fabio Manganiello fa1d5eb672 [tts.picovoice] Added text pre-processing workaround.
This workaround is required until
https://github.com/Picovoice/orca/issues/10 is fixed.
2024-05-02 00:51:09 +00:00
Fabio Manganiello a345b12244 [assistant.picovoice] Leverage upstream `_on_mute_changed`.
The plugin should leverage `AssistantPlugin._on_mute_changed` to handle
the boilerplate state managent on mute/unmute actions instead of
re-implementing the same logic.
2024-05-02 00:51:09 +00:00
Fabio Manganiello 2c197c275e [assistant.picovoice] Implemented mic mute/unmute handling. 2024-05-02 00:51:09 +00:00
Fabio Manganiello 9de49c71a1 [assistant.picovoice] Conversation flow improvements.
- The `Responding` state should be modelled as an extra event/binary
  flag, not as an assistant state. The assistant may be listening for
  hotwords even while the `tts` plugin is responding, and we don't want
  the two states to interfere with each either - neither to build a more
  complex state machine that also needs to take concurrent states into
  account.

- Stop any responses being rendered upon the `tts` plugin when a new
  hotword audio is detected. If e.g. I say "Ok Google", I should always
  be able to trigger the assistant and stop any concurrent audio
  process.

- `SpeechRecognizedEvent` should be emitted even if `cheetah`'s latest
  audio frame results weren't marked as final, and the speech detection
  window timed out. Cheetah's `is_final` detection seems to be quite
  buggy sometimes, and it may not properly detect the end of utterances,
  especially with non-native accents. The workaround is to flush out
  whatever text is available (if at least some speech was detected) into
  a `SpeechRecognizedEvent` upon timeout.
2024-05-02 00:51:09 +00:00
Fabio Manganiello aa333db05c [assistant.picovoice] More features.
- Added wiring between `assistant.picovoice` and `tts.picovoice`.

- Added `RESPONDING` status to the assistant.

- Added ability to override the default speech model upon
  `start_conversation`.

- Better handling of conversation timeouts.

- Cache Cheetah objects in a `model -> object` map - at least the
  default model should be pre-loaded, since model loading at runtime
  seems to take a while, and that could impact the ability to detect the
  speech in the first seconds after a hotword is detected.
2024-05-02 00:51:09 +00:00
Fabio Manganiello af875c996e Added `tts.picovoice` plugin. 2024-05-02 00:51:09 +00:00
Fabio Manganiello a4c911a5d7 Added ffmpeg requirement for `assistant.picovoice`. 2024-05-02 00:51:09 +00:00
Fabio Manganiello 8193c5702c s/partial_transcript/transcript/g 2024-05-02 00:51:09 +00:00
Fabio Manganiello 8378bee7c6 Refactored `AssistantEvent`.
`AssistantEvent.assistant` is now modelled as an opaque object that
behaves the following way:

- The underlying plugin name is saved under `event.args['_assistant']`.

- `event.assistant` is a property that returns the assistant instance
  via `get_plugin`.

- `event.assistant` is reported as a string (plugin qualified name) upon
  event dump.

This allows event hooks to easily use `event.assistant` to interact with
the underlying assistant and easily modify the conversation flow, while
event hook conditions can still be easily modelled as equality
operations between strings.
2024-05-02 00:51:09 +00:00
Fabio Manganiello a670f01647 [assistant.picovoice] Better partial transcript + flush handling logic. 2024-05-02 00:51:09 +00:00
Fabio Manganiello 921025be0c `picovoice` -> `assistant.picovoice` 2024-05-02 00:51:09 +00:00
Fabio Manganiello bb38f2439c Better integration with the native base API of the assistant plugin. 2024-05-02 00:51:09 +00:00
Fabio Manganiello f7517eb321 [WIP] Added speech detection logic over Cheetah. 2024-05-02 00:51:09 +00:00
Fabio Manganiello a9498ea191 [WIP] Added initial hotword integration. 2024-05-02 00:51:09 +00:00
Fabio Manganiello 44f9c03bf3 [#304] Removed old Picovoice integrations 2024-05-02 00:51:09 +00:00
Fabio Manganiello e123463804
[media.chromecast] Refactored implementation.
continuous-integration/drone/push Build is passing Details
Explicitly use a `CastBrowser` object initialized at plugin boot instead
of relying on blocking calls to `pychromecast.get_chromecasts`.

1. It enables better event handling via callbacks instead of
   synchronously waiting for scan batches.

2. It optimizes resources - only one Zeroconf and one CastBrowser object
   will be created in the plugin, and destroyed upon stop.

3. No need for separate `get_chromecast`/`_refresh_chromecasts` methods:
   all the scanning is run continuously, so we can just return the
   results from the maps.
2024-04-17 03:56:45 +02:00
Fabio Manganiello f99f6bdab9
[media.chromecast] Resource clean up + new API adaptations.
continuous-integration/drone/push Build is passing Details
- `pychromecast.get_chromecasts` returns both a list of devices and a
  browser object. Since the Chromecast plugin is the most likely culprit
  of the excessive number of open MDNS sockets, it seems that we may
  need to explicitly stop discovery on the browser and close the
  ZeroConf object after the discovery is done.

- I was still using an ancient version of pychromecast on my RPi4, and I
  didn't notice that more recent versions implemented several breaking
  changes. Adapted the code to cope with those changes.
2024-04-17 02:49:31 +02:00
Fabio Manganiello 4972c8bdcf
Unregister a Zeroconf instance if it already exists before publishing a backend service.
continuous-integration/drone/push Build is passing Details
`mdns` connection are another culprit for the increasing number of open
files in the process.
2024-04-16 00:12:55 +02:00
Fabio Manganiello 33d4c8342d
[#389] Possible fix for "Too many open files" media issue.
continuous-integration/drone/push Build is passing Details
It seems that the process keeps a lot of open connections to Chromecast
devices during playback.

The most likely culprit is the `_refresh_chromecasts` logic.

We should start a `cast` object and register a status listener only if a
Chromecast with the same identifier isn't already registered in the
plugin.
2024-04-15 23:01:10 +02:00
Fabio Manganiello b4d0716bc5
Added layer of compatibility with both paho.mqtt >= 2.0.0 and < 2.0.0.
See 28aa2e6b26/ChangeLog.txt (L6)
2024-04-08 23:01:54 +02:00
revil-O 584f226b62 mqtt CallbackAPIVersion fix for paho.mqtt >= 2.0.0
fix to work with paho.mqtt >= 2.0.0
2024-04-08 16:05:27 +02:00
Fabio Manganiello a026a101cd
Removed `stt.deepspeech` integration.
continuous-integration/drone/push Build is passing Details
The project hasn't seen a commit in three years and it's probably been
abandoned by Mozilla.

New and better maintained speech-to-text integrations will be
investigated.
2024-04-05 20:56:45 +02:00
Fabio Manganiello c31180dae8
[music.mopidy] Fixed parsing of `new_state` upon `playback_state_changed`.
continuous-integration/drone/push Build is passing Details
2024-04-05 03:46:01 +02:00
Fabio Manganiello 083c9e250e
[music.mopidy] Better handling of client events.
continuous-integration/drone/push Build is passing Details
2024-04-05 03:40:27 +02:00
Fabio Manganiello 5f6fd4aa54
Added `--db` CLI option and support for configuration over environment.
continuous-integration/drone/push Build is passing Details
Closes: #280
2024-04-05 02:54:45 +02:00
Fabio Manganiello d2ec93b798 [#297] Removed `music.spotify` backend.
1. I no longer I use a Spotify account (I switched to Tidal after
   Spotify deprecated libspotify), and I wouldn't like to create one
   just to test this integration.

2. After a couple of years, the libspotify open fork (Librespot) seems
   to be still in an unstable stage and it's already been discontinued
   once - I would avoid rebuilding the integration against a dependency
   that may change a lot in the near future.
2024-04-04 00:52:30 +00:00
Fabio Manganiello 58518a4d63 Better timeout management on mopidy status refresh. 2024-04-03 23:01:22 +00:00
Fabio Manganiello 5346833152 [WIP] API adaptations for `music.mpd` 2024-04-03 23:01:22 +00:00
Fabio Manganiello 89d618b35f [WIP] `music.mopidy` refactor, initial backend rewrite. 2024-04-03 23:01:22 +00:00
Fabio Manganiello d2e5e5230b [music.mpd] Removed deprecated actions.
- `setvol` ➡️  `set_volume`
- `seekcur` ➡️  `seek`
- `playlistinfo` ➡️  `get_tracks`
- `listplaylists` ➡️  `get_playlists`
- `listplaylist` ➡️  `get_playlist`
- `listplaylistinfo` ➡️  `get_playlist`
- `playlistadd` ➡️  `add_to_playlist`
- `playlistdelete` ➡️  `remove_from_playlist`
- `playlistmove` ➡️  `playlist_move`
- `playlistclear` ➡️  `playlist_clear`
- `rename` ➡️  `rename_playlist`
- `rm` ➡️  `delete_playlist`

stuff
2024-04-03 23:01:22 +00:00
Fabio Manganiello a3b6d411e4 [music.mpd] Adjust default poll_interval: 5 -> 20 seconds. 2024-04-03 23:01:22 +00:00
Fabio Manganiello 2066db463b
[#295] Merged `music.mpd` plugin and backend.
continuous-integration/drone/push Build is passing Details
Closes: #295
2024-03-03 22:37:26 +01:00
Fabio Manganiello 6bdc9e77ee
[#349] Refactored/rewritten `telegram` plugin.
continuous-integration/drone/push Build is passing Details
1. `chat.telegram` -> `telegram` plugin.

2. Merged `backend.chat.telegram` logic into `telegram` plugin.

3. Rewritten the architecture of the integration to adapt to the new
   asyncio API introduced in the latest versions of telegram-bot-api.

Closes: #349
2024-03-03 15:39:47 +01:00
Fabio Manganiello 7637890a54
[irc] Plugin rename/refactor.
The `chat.irc` plugin is now `irc`.
2024-03-03 15:39:47 +01:00
Fabio Manganiello d415d65bff
Removed legacy wiimote plugin
continuous-integration/drone/push Build is passing Details
2024-02-29 00:49:56 +01:00
Fabio Manganiello c7b0440562
[#357] Migrated `backend.button.flic` to `flic` plugin.
continuous-integration/drone/push Build is passing Details
Closes: #357
2024-02-29 00:27:32 +01:00
Fabio Manganiello f1e568d6c8
FIX: Fixed refactored plugin name
continuous-integration/drone/push Build is passing Details
2024-02-28 01:49:52 +01:00
Fabio Manganiello ac9b82236e
Renamed `http.request` plugin as `http`.
continuous-integration/drone/push Build is passing Details
2024-02-28 01:44:04 +01:00