MCPcopy Create free account
hub / github.com/FastLED/FastLED / main

Function main

ci/tools/generate_audio_fixtures.py:451–547  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

449
450
451def main() -> None:
452 parser = argparse.ArgumentParser(
453 description="Generate audio fixtures for VocalDetector tests"
454 )
455 parser.add_argument(
456 "--output",
457 type=Path,
458 default=Path("tests/data/audio"),
459 help="Output directory (default: tests/data/audio)",
460 )
461 parser.add_argument(
462 "--synth-only",
463 action="store_true",
464 help="Use synthetic generation only (no downloads)",
465 )
466 parser.add_argument(
467 "--cache-dir",
468 type=Path,
469 default=Path(tempfile.gettempdir()) / "fastled_audio_cache",
470 help="Cache directory for downloads",
471 )
472 args = parser.parse_args()
473
474 ffmpeg = find_ffmpeg()
475 print(f"Using ffmpeg: {ffmpeg}")
476
477 # Create output directories
478 stems_dir = args.output / "stems"
479 mixes_dir = args.output / "mixes"
480 stems_dir.mkdir(parents=True, exist_ok=True)
481 mixes_dir.mkdir(parents=True, exist_ok=True)
482 args.cache_dir.mkdir(parents=True, exist_ok=True)
483
484 # --- Generate stems ---
485 print("\n=== Generating stems ===")
486 all_stems = ["voice_male", "voice_female", "guitar_acoustic", "drums_jazz"]
487
488 for stem_name in all_stems:
489 output_path = stems_dir / f"{stem_name}.ogg"
490 if output_path.exists():
491 print(
492 f" {stem_name}: already exists ({output_path.stat().st_size // 1024}KB)"
493 )
494 continue
495
496 downloaded = False
497 if not args.synth_only and stem_name in SOURCES:
498 src = SOURCES[stem_name]
499 downloaded = download_and_trim(
500 ffmpeg, src["url"], src["start"], output_path, args.cache_dir
501 )
502
503 if not downloaded:
504 print(f" {stem_name}: using synthetic fallback")
505 generate_synthetic_stem(ffmpeg, stem_name, output_path)
506
507 # --- Generate mixes ---
508 print("\n=== Generating mixes ===")

Callers 1

Calls 9

find_ffmpegFunction · 0.85
download_and_trimFunction · 0.85
generate_synthetic_stemFunction · 0.85
create_mixFunction · 0.85
verify_oggFunction · 0.85
parse_argsMethod · 0.80
itemsMethod · 0.80
printFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected