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)')]
detect_audacity_generations
Report which Audacity generations have configuration on this machine.
Audacity 4.0 dropped both Macro Manager and the scripting pipe (they are slated to return in a later release), so the macro this module writes and the pipe automation in the helper script are Audacity 3 features. Knowing which generations are present is what lets the export say so instead of reporting a macro as written and leaving the user to find the missing menu.
Detection reads the config directory rather than Program Files because
APPDATA is already resolved here and install locations vary:
"4"—Audacity4.inior anAudacity4/directory"3"— aMacros/directory, which is exactly what--macroneeds
This detects "has been run on this machine", not "is installed now" — a config directory outlives an uninstall. Good enough to qualify a warning; never gate anything destructive on it.
Returns:
-
frozenset[str]–A set containing any of
"3"and"4"; empty when neither is found -
frozenset[str]–or the config directory cannot be resolved.
Source code in src/xil_pipeline/XILP005_daw_export.py
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: list[StemPlan], entries_index: dict, output_dir: str, stems_dir: str = '', sfx_config: SfxConfiguration | None = 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(list[StemPlan]) –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 | None, default:None) –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', slug: str = '', 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
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 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 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 | |
get_parser
Return the argument parser for xil-daw.
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
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 | |