Add audio diagnostic agent to detect audio classification mismatches in videos #66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements a Python CLI agent to automatically audit audio in videos, detecting potential misclassifications (e.g., "snore" detected when audio contains "bark") by analyzing spectrograms and frequency band energies.
Core Implementation
CLI Tool (
scripts/audio_diagnostic_agent.py, 510 LOC)labels.txtor ESC-50 classesAudio Utilities (
scripts/utils_audio.py, 232 LOC)get_sample_rate()- ffprobe integrationextract_audio_wav()- ffmpeg extraction preserving sample ratecompute_mel_spectrogram()- librosa with configurable n_fft/hop_length/n_mels/fmin/fmaxmeasure_energy_in_band()- frequency range energy analysissave_spectrogram_image()- matplotlib PNG generationConfiguration
CLI accepts parameters via arguments or YAML config:
Report Output
{ "video_path": "video.mp4", "original_sample_rate": 44100, "used_sample_rate": 44100, "spectrogram_path": "reports/video_spectrogram.png", "frequency_band_energies": { "bark": -45.2, "snore": -65.1 }, "suspicion": true, "suspicion_reasons": ["Large energy variation: 28.9 dB"] }Testing & CI
Usage
Dependencies: librosa, soundfile, matplotlib, pyyaml (added to
requirements-dev.txt)Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
esm.ubuntu.com/usr/lib/apt/methods/https(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.