leading_match_seconds's gap-tolerance rule treated any two consecutive borderline-low correlation windows as fatal, even with a long, clean, sustained match starting immediately after them. Found directly: comparing hpr0900's own audio across two different codecs (mp3 vs opus) -- identical underlying content -- a minor codec-boundary artifact in the first ~0.75s made the old rule report 0.25s for what a full non-windowed cross-correlation confirmed was actually a 0.9979 overall match at zero lag. Replaced with the same qualifying-run logic last_high_correlation_run_seconds already used (factored out via _qualifying_runs()), taking the first run instead of the last. This is a real, general fix, but it does not explain hpr0900 itself: re-tested against 17 candidates spanning the whole pre-2015 range with the fix applied, still found nothing. The user confirmed by ear that hpr0900's ~15-20s intro is a real, recognizable station jingle, so there appears to be a second distinct jingle variant in circulation that episode-number proximity doesn't predict and no tested sample shares -- documented as an open item (a vendored reference-variant library is the likely right fix, not a wider search radius). Also revisited the earlier librosa dismissal in Open Items: the bug just found is specifically a hard-threshold brittleness problem, which is a different and stronger reason to reconsider a continuous multi-feature score than the original evaluation considered. New test: test_leading_match.py, using the exact corrs pattern observed.
hpr-intro-stripper
Extracts the "inner" audio from a Hacker Public Radio episode — the host's originally submitted recording, with HPR's own added intro and outro removed — for one episode or in batch.
It never ships or assumes a local copy of the HPR archive: it fetches whatever metadata, audio, and transcripts it needs from the live HPR site itself, and never touches the original files.
For the full technical background (why this isn't trivial, how HPR's own pipeline works, the detection strategy, benchmarks, and known limitations), see docs/DESIGN.md.
Motivation
From Ken Fallon's comment on hpr4761 :: HPR Community News for October 2026 (transcript, lightly corrected for clarity):
That had me thinking, actually Lee — a lot of the original episodes on HPR have the HPR intro and outro on them, and I was just wondering: would there be a way where we could get the original source material and strip out the old intro and outro, so that we just have the audio for that, and then update them as time goes on?
Requirements
- Python 3.9+
ffmpeg/ffprobesqlite3andawk(for fetching/converting HPR's metadata dump)numpy(pip install numpy)- Optional, only used as a fallback when HPR hasn't published an official
transcript for an episode:
openai-whisper(pip install openai-whisper), run with thetinymodel on short clips only — never a whole episode, never requires a GPU.
No step requires a GPU or a specific speech-recognition setup.
How it works, briefly
HPR's intro is a per-episode, auto-generated spoken announcement (title, host, date, summary) over a music bed; the outro is a single fixed clip. Detection tries, in order: HPR's own official transcript/subtitle file (if published for that episode), a metadata-duration cross-check, local speech recognition on a short clip, then audio correlation against known reference clips — whichever signal actually works for a given episode, recorded alongside the result. Episodes with no reliable signal, or an unusual/No-Derivatives license, are flagged for manual review rather than guessed at. See docs/DESIGN.md for the full reasoning.
Usage
pip install numpy openai-whisper # openai-whisper only needed for the ASR fallback
# Detect cut points for one episode (fetches audio/metadata as needed, caches in ./cache)
python -m hpr_stripper.cli detect --episode 3700
# Detect a range
python -m hpr_stripper.cli detect --range 3700-3720
# Prefer a different audio format (default: mp3, then ogg, then opus)
python -m hpr_stripper.cli --format ogg,opus detect --episode 3700
# Produce trimmed output for everything detected so far with a usable result
python -m hpr_stripper.cli trim --out-dir ./trimmed
# Random, era-stratified spot check
python -m hpr_stripper.cli random-sample --n 12
# Full-archive detection pass -- safe to interrupt (Ctrl+C) and resume by re-running
python -m hpr_stripper.cli sweep
# Summary of what's been processed so far
python -m hpr_stripper.cli report
All intermediate state (downloaded audio, the metadata database, transcripts,
detection results, trimmed output) lives under ./cache/ and ./trimmed/
by default, both gitignored. Nothing here is uploaded or shared anywhere by
this tool.
License handling
Every episode's own Creative Commons (or other) license is read from HPR's metadata and carried through to the output. Episodes under a No-Derivatives license are never trimmed for distribution by default (see docs/DESIGN.md). Trimmed output is accompanied by a small JSON sidecar recording the host, episode number, date, and license, since the intro being removed is also HPR's mechanism for crediting hosts under CC-BY-SA.