-
Notifications
You must be signed in to change notification settings - Fork 6
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:g2p #109
Conversation
WalkthroughThe changes in this pull request focus on enhancing the Changes
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
reduce default LOG spam companion to OpenVoiceOS/ovos-audio#109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (2)
ovos_audio/playback.py (1)
35-41
: Consider adding documentation for G2P configuration.The G2P integration is well-implemented as an optional feature, but it would benefit from:
- Documentation of the expected configuration format
- Example configuration in the README
- Documentation of the fallback behavior when G2P is unavailable
This will help users understand how to properly configure and use the G2P functionality for viseme generation.
Would you like me to help draft the documentation?
🧰 Tools
🪛 Ruff
38-41: Use
contextlib.suppress(Exception)
instead oftry
-except
-pass
(SIM105)
40-40: Do not use bare
except
(E722)
ovos_audio/service.py (1)
Line range hint
1-586
: Architecture aligns with G2P integration goals.The existing G2P related methods (
get_g2p_lang_options
,handle_opm_g2p_query
) in this file show that this was a well-planned migration. Moving the G2P plugin from TTS base class to ovos-audio module is architecturally sound as:
- It consolidates audio-related functionality in one place
- The file already handles G2P configurations and queries
- It maintains clean separation of concerns between TTS and audio processing
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- ovos_audio/playback.py (4 hunks)
- ovos_audio/service.py (1 hunks)
🧰 Additional context used
🪛 Ruff
ovos_audio/playback.py
10-10:
ovos_plugin_manager.g2p.find_g2p_plugins
imported but unusedRemove unused import:
ovos_plugin_manager.g2p.find_g2p_plugins
(F401)
38-41: Use
contextlib.suppress(Exception)
instead oftry
-except
-pass
(SIM105)
40-40: Do not use bare
except
(E722)
139-139: Do not use bare
except
(E722)
🔇 Additional comments (2)
ovos_audio/playback.py (1)
180-180
: LGTM: Clean queue data handling.The simplified queue data unpacking is clear and consistent with the PR's refactoring objectives.
ovos_audio/service.py (1)
560-562
: Ensure proper thread cleanup in shutdown sequence.The changes look good and align with the PR objective. The shutdown sequence correctly:
- Checks if
playback_thread
exists before attempting shutdown- Calls shutdown on the thread
- Waits for thread completion with
join()
This ensures clean termination of the G2P functionality that was moved from the TTS base class.
Let's verify there are no lingering references to the old
tts.playback
shutdown:✅ Verification successful
Let me gather more information about the playback thread shutdown by searching for related patterns.
This will help us verify:
- The current implementation of playback thread shutdown
- Any remaining references to TTS playback
- The overall context of the PlaybackService class
Based on the search results, I can see that there are still references to
tts.playback
in the codebase, particularly inovos_audio/service.py
. Let me search for more context around these usages to understand if they're related to the shutdown sequence.This will help us understand:
- The complete context of
tts.playback
usage- How the playback thread is initialized and managed
- The relationship between
tts.playback
andplayback_thread
Let me check one more thing to understand the relationship between the old and new playback implementations.
This will help us understand:
- How the shutdown is implemented in PlaybackThread
- The initialization flow of playback
- The queue handling mechanism during shutdown
Based on the gathered information, I can now provide a final response about the shutdown sequence verification.
The shutdown sequence is correctly implemented and maintains compatibility
The changes to the shutdown sequence are verified to be correct for the following reasons:
- The
PlaybackThread
has a propershutdown()
implementation that callsstop()
(found in playback.py:227)- The references to
tts.playback
in the codebase are for different purposes (status checking and clearing) and don't conflict with the shutdown sequence- The shutdown order is correct:
- First checks if playback_thread exists
- Calls shutdown() which internally handles stopping playback
- Properly joins the thread
- Then proceeds with audio shutdown
The existing
tts.playback
references are used for runtime operations (like checking if audio is playing or clearing current playback) and are separate from the shutdown functionality that was moved to the PlaybackThread.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any remaining references to tts.playback shutdown rg "tts\.playback.*shutdown" --type pyLength of output: 40
Script:
#!/bin/bash # Search for playback thread shutdown patterns rg "playback_thread.*shutdown" -A 2 --type py # Search for any TTS playback related patterns rg "tts.*playback" -A 2 --type py # Look for the PlaybackService class definition to understand the context ast-grep --pattern 'class PlaybackService: $$$ 'Length of output: 1716
Script:
#!/bin/bash # Get more context around tts.playback usage in service.py rg "tts\.playback" -B 2 -A 2 ovos_audio/service.py # Look for the playback thread initialization rg "playback_thread.*=|PlaybackThread" --type py -B 2 -A 2 # Search for the PlaybackThread class definition ast-grep --pattern 'class PlaybackThread: $$$ 'Length of output: 2237
Script:
#!/bin/bash # Look for the shutdown method implementation in PlaybackThread ast-grep --pattern 'def shutdown(self): $$$ ' --lang python # Check for any TTS initialization related to playback rg "init.*playback" -B 2 -A 2 --type py # Look for any queue-related operations in playback rg "queue\." -B 2 -A 2 ovos_audio/playback.pyLength of output: 5785
reduce default LOG spam companion to OpenVoiceOS/ovos-audio#109
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
move the G2P plugin from TTS base class into ovos-audio
it was only there originally as a way to deploy it to classic mycroft-core when they didn't review PRs
companion to OpenVoiceOS/ovos-plugin-manager#277
Summary by CodeRabbit