Xilp005 Daw Export
src.xil_pipeline.XILP005_daw_export
Export episode audio as separate DAW layer WAV files.
Reads the parsed script JSON and episode stems to build four isolated, full-length WAV files — one per audio layer — that can be imported into Audacity (or any DAW) as pre-aligned tracks:
daw/{TAG}/{TAG}_layer_dialogue.wav — spoken dialogue (with effects)
daw/{TAG}/{TAG}_layer_ambience.wav — looped environmental background
daw/{TAG}/{TAG}_layer_music.wav — music stings and themes
daw/{TAG}/{TAG}_layer_sfx.wav — one-shot sound effects/beats
All four WAVs are exactly the same length (full episode duration) so they align perfectly when imported at t=0. The producer controls final level balance and any additional processing inside the DAW.
An Audacity import helper script is also generated at:: daw/{TAG}/{TAG}_open_in_audacity.py
Run it to print the file paths and manual import instructions; if Audacity's mod-script-pipe is enabled it will attempt automation.
Usage:
python XILP005_daw_export.py --episode S01E02 --dry-run
python XILP005_daw_export.py --episode S01E02
python XILP005_daw_export.py --episode S01E02 --output-dir exports/
No ElevenLabs API calls are made — this stage is safe to run freely.
LAYERS
module-attribute
LAYERS: list[tuple[str, str, str]] = [('dialogue', 'layer_dialogue', 'Spoken dialogue (audio filter chain + pan applied per speaker)'), ('ambience', 'layer_ambience', 'Looped environmental background (no ducking)'), ('music', 'layer_music', 'Music stings and themes (no ducking)'), ('sfx', 'layer_sfx', 'One-shot sound effects and beat silences'), ('vintage_filter', 'layer_vintage_filter', 'Record player crackle (vintage filter active spans)')]
generate_audacity_macro
generate_audacity_macro(output_dir: str, tag: str, layer_files: list[tuple[str, str]], show: str = 'Sample Show', season_title: str | None = None, episode_title: str | None = None, artist: str = 'XIL Pipeline') -> str | None
Write an Audacity macro file that imports all layer WAVs and sets metadata.
The macro is written to the Audacity Macros directory
(%APPDATA%\audacity\Macros\<SLUG>_<TAG>.txt) so it appears
immediately under Tools → Macros without restarting Audacity.
Parameters:
-
output_dir(str) –Directory containing the exported layer files.
-
tag(str) –Episode tag used to name the macro (e.g.
"S02E03"). -
layer_files(list[tuple[str, str]]) –List of
(track_name, filename)pairs to import. -
show(str, default:'Sample Show') –Show name for Album metadata (default
"Sample Show"). -
season_title(str | None, default:None) –Season title for metadata title field.
-
episode_title(str | None, default:None) –Episode title for metadata title field.
-
artist(str, default:'XIL Pipeline') –Artist/creator credit for metadata.
Returns:
-
str | None–Path to the written macro file, or
Noneif the Audacity Macros -
str | None–directory could not be located.
Source code in src/xil_pipeline/XILP005_daw_export.py
dry_run_daw
dry_run_daw(tag: str, stem_plans, entries_index: dict, output_dir: str, stems_dir: str = '', sfx_config=None, cast_config: dict | None = None, vintage_scenes: list[str] | None = None) -> None
Print a DAW export summary without writing any files.
Parameters:
-
tag(str) –Episode tag.
-
stem_plans–Classified stem list.
-
entries_index(dict) –Parsed entry index.
-
output_dir(str) –Target directory (shown in summary).
-
stems_dir(str, default:'') –Stems source directory (shown in summary).
-
sfx_config–SfxConfiguration instance for vintage_scenes fallback.
-
cast_config(dict | None, default:None) –Per-speaker voice settings dict for filter reporting.
-
vintage_scenes(list[str] | None, default:None) –Scene slugs for vintage filter routing. When provided, overrides
sfx_config.vintage_scenes.
Source code in src/xil_pipeline/XILP005_daw_export.py
derive_vintage_scenes_from_parsed
Extract scene slugs that contain VINTAGE FILTER spans from the parsed JSON.
Collects the scene field of every VINTAGE FILTER ENGAGES direction
entry. Returns a deduplicated, order-preserving list of scene slugs. When
the parsed JSON is unavailable or contains no such entries, returns [].
Parameters:
-
parsed_path(str) –Path to the parsed script JSON (XILP001 output).
Returns:
Source code in src/xil_pipeline/XILP005_daw_export.py
export_daw_layers
export_daw_layers(config: dict[str, dict], stems_dir: str, parsed_path: str, output_dir: str, tag: str, save_aup3: bool = False, macro: bool = False, show: str = 'Sample Show', season_title: str | None = None, episode_title: str | None = None, artist: str = 'XIL Pipeline', timeline: bool = False, timeline_html: bool = False, sfx_config=None, gap_ms: int = 600) -> None
Build and export all four DAW layer WAV files.
Parameters:
-
config(dict[str, dict]) –Per-speaker voice settings from cast config.
-
stems_dir(str) –Directory containing episode stem MP3 files.
-
parsed_path(str) –Path to the parsed script JSON (XILP001 output).
-
output_dir(str) –Directory to write the layer WAV files.
-
tag(str) –Episode tag used to name output files.
-
save_aup3(bool, default:False) –When True, include a SaveProject2 step in the helper script.
-
macro(bool, default:False) –When True, write an Audacity macro file to the Audacity Macros dir.
-
show(str, default:'Sample Show') –Show name for audio metadata (default
"Sample Show"). -
season_title(str | None, default:None) –Season title for metadata artist field.
-
episode_title(str | None, default:None) –Episode title for metadata.
Source code in src/xil_pipeline/XILP005_daw_export.py
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | |
get_parser
Source code in src/xil_pipeline/XILP005_daw_export.py
main
CLI entry point for DAW layer export.
Loads cast config, derives stem and parsed JSON paths from the episode tag, builds four per-layer WAV files and an Audacity helper script. No ElevenLabs API key required.
Source code in src/xil_pipeline/XILP005_daw_export.py
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 | |