audio-quality-check
by @tenequm
Analyze audio recording quality - echo detection, loudness, speech intelligibility, SNR, spectral analysis. Use when the user wants to check a recording's qu...
clawhub install audio-quality-checkπ About This Skill
name: audio-quality-check description: Analyze audio recording quality - echo detection, loudness, speech intelligibility, SNR, spectral analysis. Use when the user wants to check a recording's quality, detect echo or duplication in audio files, measure speech clarity, compare original vs processed audio, diagnose why a recording sounds bad, or analyze audio tracks from Blackbox or any call recording app. Triggers on audio quality, recording analysis, echo detection, check recording, sound quality, analyze audio, speech quality, PESQ, STOI, loudness, SNR, audio diagnostics, recording sounds bad, echo in recording, audio duplication. metadata: version: "0.1.1"
Audio Recording Quality Analyzer
Comprehensive audio quality analysis for call recordings. Handles dual-track M4A files (system audio + mic), single-track recordings, and AEC-processed files.
Quick Start
Run the bundled analysis script on a recording directory:
python /scripts/analyze_recording.py "/path/to/recording/directory"
Modes for focused analysis:
python /scripts/analyze_recording.py /path --tracks # track info only
python /scripts/analyze_recording.py /path --echo # echo detection only
python /scripts/analyze_recording.py /path --quality # quality metrics (skip echo)
For Blackbox recordings, the directory is typically:
~/Library/Application Support/Blackbox/Recordings/
Dependencies
System: ffmpeg, ffprobe (brew install ffmpeg)
Python: numpy, soundfile, scipy, pyloudnorm, pesq, pystoi, librosa
Install all Python deps: pip3 install numpy soundfile scipy pyloudnorm pesq pystoi librosa
What Each Metric Tells You
EBU R128 Loudness (pyloudnorm)
Echo Detection - Autocorrelation
Cross-Track Correlation
PESQ - Speech Quality (requires reference + degraded)
STOI - Speech Intelligibility (requires reference + degraded)
Spectral Analysis (librosa)
SNR - Signal-to-Noise Ratio
Per-Minute Energy
Manual Analysis Recipes
When you need analysis beyond what the script provides, these patterns are useful.
Extract individual tracks from dual-track M4A
ffmpeg -y -i audio.m4a -map 0:0 -ac 1 -ar 16000 /tmp/system.wav
ffmpeg -y -i audio.m4a -map 0:1 -ac 1 -ar 16000 /tmp/mic.wav
Quick loudness check with sox
sox audio.wav -n stat 2>&1
Check specific time range for echo (Python)
import numpy as np
import soundfile as sf
from scipy import signaldata, sr = sf.read('/tmp/system.wav')
Analyze 5 seconds starting at 2 minutes
start = 120 * sr
seg = data[start:start + 5*sr]
seg_norm = seg / (np.max(np.abs(seg)) + 1e-10)
autocorr = np.correlate(seg_norm, seg_norm, mode='full')
mid = len(seg_norm) - 1
autocorr = autocorr / autocorr[mid]
Check 20-100ms range for echo peaks
min_lag = int(0.020 * sr)
max_lag = int(0.100 * sr)
region = autocorr[mid + min_lag:mid + max_lag]
peaks, props = signal.find_peaks(region, height=0.1)
for i, p in enumerate(peaks[:5]):
lag_ms = (p + min_lag) / sr * 1000
print(f" Peak at {lag_ms:.1f}ms, r={props['peak_heights'][i]:.3f}")
Common Issues and What Causes Them
| Symptom | Likely cause | What to check | |---------|-------------|---------------| | Speakers sound slightly doubled/echoed | Virtual audio processor (Krisp) creating delayed copy in system audio | Autocorrelation: consistent peak at 40-60ms | | Mic track has remote speakers' voices | Acoustic echo (speakers to mic) | Cross-track correlation > 0.1 | | AEC-processed file sounds worse | DTLN-aec degrading signal quality | PESQ/STOI comparing original vs processed | | AEC-processed file is too loud | Missing loudness normalization after processing | Loudness: processed > -10 LUFS | | Recording has hiss/noise | Low SNR, noisy mic, or AGC artifacts | SNR < 15dB, high zero-crossing rate | | Quiet segments mid-recording | Mic cut out or device changed | Per-minute energy: sudden RMS drop |
π‘ Examples
Run the bundled analysis script on a recording directory:
python /scripts/analyze_recording.py "/path/to/recording/directory"
Modes for focused analysis:
python /scripts/analyze_recording.py /path --tracks # track info only
python /scripts/analyze_recording.py /path --echo # echo detection only
python /scripts/analyze_recording.py /path --quality # quality metrics (skip echo)
For Blackbox recordings, the directory is typically:
~/Library/Application Support/Blackbox/Recordings/