Add multiband waveform view

- waveform.py: render_multiband_waveform() — N rows of ASCII bars, each row
  labeled with its band-start time. Makes it easy to find timestamps in
  long audio by counting row + column.
- cli.py: new 'multiband' / 'mb' subcommand
- Fixed: multiband band alignment was drifting (off-by-one in samples)
- tests: 1 new multiband smoke test; 62 total all passing
This commit is contained in:
2026-07-27 04:25:18 -07:00
parent fa0628f0e2
commit 6b12130bbd
3 changed files with 103 additions and 1 deletions
+22
View File
@@ -164,6 +164,21 @@ def cmd_paste(args: argparse.Namespace) -> int:
return 0
def cmd_multiband(args: argparse.Namespace) -> int:
"""Print a multi-band ASCII waveform. Each row is N seconds labeled."""
from .waveform import render_multiband_waveform
audio = Path(args.audio)
if not audio.exists():
print(f"error: {audio} not found", file=sys.stderr)
return 1
print(render_multiband_waveform(
audio,
width=args.width,
band_seconds=args.band_seconds,
))
return 0
def cmd_slices(args: argparse.Namespace) -> int:
"""Extract overlapping audio slices for manual review.
@@ -324,6 +339,13 @@ def main(argv: list[str] | None = None) -> int:
p_paste.add_argument("--replacements", nargs="+", help="glob(s) for replacement MP3s in order")
p_paste.set_defaults(func=cmd_paste)
# multiband (multi-row ASCII waveform with band labels)
p_mb = sub.add_parser("multiband", aliases=["mb"], help="Multi-band ASCII waveform with band-start labels")
p_mb.add_argument("audio")
p_mb.add_argument("--width", type=int, default=60, help="waveform width in columns per band")
p_mb.add_argument("--band-seconds", type=float, default=60.0, help="seconds of audio per band (one row)")
p_mb.set_defaults(func=cmd_multiband)
# slices (extract overlapping audio chunks for manual review)
p_slices = sub.add_parser("slices", help="Extract overlapping audio slices for manual review")
p_slices.add_argument("audio")