Skip to content

Verify hearing path with an audio-capable coding agent and fix hearing edge cases (#11) - #13

Closed
ufcenterxyz wants to merge 1 commit into
riffkit:mainfrom
ufcenterxyz:verify-hearing-path
Closed

ufcenterxyz wants to merge 1 commit into
riffkit:mainfrom
ufcenterxyz:verify-hearing-path

Conversation

@ufcenterxyz

Copy link
Copy Markdown
Contributor

Closes #11

End-to-end hearing path verification (answering the questions in #11)

Tested with Antigravity running an audio-input Gemini model (read_file supports audio/wav alongside images and text), on macOS with say and ffmpeg 8.1:

  1. Did it pass hear-check on the first try?

    • Yes — 4/4 on the first try (6/6 digits on every check):
      • A blind subagent given only SKILL.md and red-carpet.mp4 (with zero mention of hear-check or sound in its prompt) ran hear-check right after scan in step 2, opened scan/hearing/check_1.wav, answered 579725 18 seconds later, and got PASSED: 6 of 6 digits right on check 1.
      • Three additional checks on red-carpet.mp4, outfit-rules.mp4, and a standalone test WAV also passed 6/6 on the first try (211737, 239459, 923865).
    • The current wording in SKILL.md and hear-check ("Open this file the way you open the pictures: with the tool that reads a file into your input...") worked immediately; the agent never hesitated or answered --cannot-hear.
  2. How did it open the sound file?

    • With its normal read_file tool — the exact same tool it uses for overview_01.jpg and shot_01.jpg. In the blind run it batched read_file on check_1.wav in the same turn as summary.txt and the scan images, and later called read_file on listen/whole.wav (752 KB, 12.042 s) and listen/sound_06.00_12.04.wav (from listen --from 6.0 --to 12.042).
    • Also tested read_file on a 60-second mono 32 kHz WAV (3.7 MB, matching LISTEN_WHOLE_MAX_S): it opened cleanly without truncation.
  3. Was what it wrote about the sound right?

    • Yes. On red-carpet.mp4, the blind run wrote 7 heard statements (music, voice, effect, ambience) that all passed build (CHECKS: all passed) and matched direct listening:
      • 00:00.0–00:04.2 (music + voice): soft harp/synth pop intro with a female singer singing 'Sorry I cannot hear you, I'm kinda busy' (matching the ironic opening caption "can't tonight, way too much going on").
      • 00:04.2–00:06.4 (music): upbeat electronic dance-pop beat drop with looped 'I'm kinda busy' vocals.
      • 00:06.4–00:08.3 (music + effect): driving dance-pop beat plus crisp mechanical camera-shutter/flash clicks around 00:07.2–00:08.3.
      • 00:08.3–00:12.0 (music + ambience): full sung hook returning alongside an excited cheering crowd / audience roar swelling during the petal shower.
    • On outfit-rules.mp4 (listen/whole.wav), direct listening confirmed clear Spanish female speech in a quiet indoor room with warm instructional tone (upbeat "sí", firm playful "no") and no background music or SFX — confirming that the measured loudness peaks at 4 of 5 caption appearances come from the speaker starting each line.

Code & doc changes in this PR

  • skills/riffsheet/scripts/riffsheet_lib/hearing.py:
    • Sort event times before merging in listen_windows() (audio.measure_audio sorts events by t, whereas refine_onsets can move a later event's onset_t earlier than an earlier event's).
    • Add clip_name() to normalize .wav extensions and directory prefixes on heard[].clip, mirroring details.view_name() for .jpg.
  • skills/riffsheet/scripts/riffsheet_lib/build.py:
    • Use clip_name() in build_heard() so "whole.wav" or "listen/whole.wav" (matching the .wav filenames printed by listen) resolves cleanly to canonical "whole" in riffsheet.json.
  • skills/riffsheet/scripts/riffsheet_lib/report.py:
    • Change the ## Not judged heading from ## Not judged (needs hearing, or motion the still pictures do not settle) to ## Not judged (what the pictures and measurements do not settle) when the hearing check passed or the video has no audio track (observed in the blind red-carpet output, where **Sound.** Heard by the agent... appeared above ## Not judged (needs hearing, ...)).
  • README.md, README.zh-CN.md, skills/riffsheet/references/TOOL.md, skills/riffsheet/references/METHOD.md:
    • Update the note that the hearing path had not yet been run end to end with a coding agent whose model takes audio (while noting heard descriptions have not been scored across videos).
    • Document .wav acceptance on heard[].clip and clarify in METHOD.md that passing hear-check does not replace speech recognition (check_no_speech_claims still applies to prose and report when speech is not transcribed).
  • tests/test_hearing.py:
    • Add tests for out-of-order onset_t merging in listen_windows, .wav/path clip name normalization in build_heard, and the ## Not judged heading after a passed hearing check.

Verification

  • ruff check skills/riffsheet/scripts tests docs/media/make — passed
  • ruff format --check skills/riffsheet/scripts tests docs/media/make — passed
  • python3 -B tests/golden.py /tmp/rs-golden --compare /tmp/rs-before.json — 49 commands, 108 files, identical
  • RIFFSHEET_REQUIRE_FFMPEG=1 python3 -B -m unittest — Ran 207 tests — OK

… fix edge cases (riffkit#11)

Ran the hearing path end to end with an audio-capable coding agent
(Antigravity with an audio-input Gemini model), including a blind run
following SKILL.md on red-carpet.mp4 plus direct hear-check/listen runs
on red-carpet.mp4 and outfit-rules.mp4. The agent opened the WAV files
with its file-reading tool, passed hear-check on the first try (4/4
separate checks, 6/6 digits each), listened to whole.wav and custom
listen windows, and produced accurate heard statements.

Changes:
- hearing.py: sort event times before merging in listen_windows so an
  out-of-order refined onset_t does not lose an earlier window start;
  add clip_name() to normalize .wav suffixes and directory prefixes
  (mirroring details.view_name for .jpg).
- build.py: normalize heard[].clip via clip_name() so whole.wav and
  listen/whole.wav resolve to whole cleanly while preserving canonical
  clip names in riffsheet.json.
- report.py: omit 'needs hearing' from the '## Not judged' heading in
  riffsheet.md when the hearing check passed or the video has no audio
  track.
- README.md, README.zh-CN.md, TOOL.md, METHOD.md: update the hearing
  verification note, document .wav handling for heard[].clip, and note
  that passing hear-check does not replace speech recognition for
  spoken lines / prose no-speech checks.
- tests/test_hearing.py: add unit tests for out-of-order onset_t
  merging, .wav/path clip normalization, and the Not judged heading
  after a passed hearing check.

(golden: identical; ruff check/format: clean; 207 tests pass with RIFFSHEET_REQUIRE_FFMPEG=1)
@owengu-ai

Copy link
Copy Markdown

Thanks for running this for us. The ordering bug is real, and CI passes on your commit. Your changes are in 0.3.2 (2aa9bc6), with a few edits, and you are credited as a co-author of that commit and in the changelog.

What we changed: a clip name is accepted with or without .wav, but not with a folder, and there are two more tests (sound events with no onset, and the heading in each state of the hearing check).

What we checked: two larger speech recognition models, given no hint, both found the longer sung phrase you quote, word for word. Given only the sound, the model no longer reported the camera clicks and was unsure about the crowd. We have not checked the other sounds. The README says that this run was done at our request, what we checked ourselves and what did not hold up.

Everything went out in one release commit rather than by merging this branch, so I am closing this pull request.

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.

Try the hearing path with a coding agent whose model takes audio

3 participants