Skip to content

Add duration to utterance_start message - #146

Open
femelo wants to merge 3 commits into
OpenVoiceOS:devfrom
femelo:add-audio-duration
Open

Add duration to utterance_start message#146
femelo wants to merge 3 commits into
OpenVoiceOS:devfrom
femelo:add-audio-duration

Conversation

@femelo

@femelo femelo commented Jan 27, 2026

Copy link
Copy Markdown

Add duration to utterance_start message

Summary by CodeRabbit

  • New Features
    • Audio duration is now automatically calculated and included in recognizer events when utterance recognition begins, supplying timing metadata for audio workflows and analytics. If duration lookup fails, processing continues without the duration and a warning is logged.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Imports a sound-duration helper and computes the duration of each played audio (stripping a file:// prefix) in ovos_audio/playback.py, then attaches that duration as message.data["duration"] before emitting the recognizer_loop:utterance_start event.

Changes

Cohort / File(s) Summary
Audio duration injection
ovos_audio/playback.py
Add get_sound_duration import; compute duration from audio path (remove file:// prefix if present) and set message.data["duration"] before emitting recognizer_loop:utterance_start (logs a warning if duration retrieval fails).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hop through bytes and song,
I count each beat, I hum along,
A little number tucked inside,
A rhythm kept for every stride,
Quietly added — soft and spry.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a duration field to the utterance_start message.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter

codecov-commenter commented Jan 27, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (aaa2d58) to head (7ba4482).
⚠️ Report is 14 commits behind head on dev.

Files with missing lines Patch % Lines
ovos_audio/playback.py 0.00% 6 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@          Coverage Diff          @@
##             dev    #146   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files          8       8           
  Lines       1013    1018    +5     
=====================================
- Misses      1013    1018    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@ovos_audio/playback.py`:
- Around line 134-136: Wrap the call to get_sound_duration in a local try/except
so a failure there doesn't abort playback: catch exceptions around
get_sound_duration(data.replace('file://', '')), set
message.data["duration"]=None on error (or leave unset), optionally log the
exception, and then continue to emit
self.bus.emit(message.forward("recognizer_loop:utterance_start", message.data))
and call play_audio as before; this change should be made inside the _play
method around the get_sound_duration usage to ensure playback proceeds even if
duration computation fails.

Comment thread ovos_audio/playback.py Outdated
@JarbasAl

Copy link
Copy Markdown
Member

@femelo can you please rebase so the new CI bot and tests run?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants