Nodes/CRT-Nodes/Audio Loader Crawl (CRT)
ComfyUI Node

Audio Loader Crawl (CRT)

Grab a random audio file from a folder, deterministically

By PGCRT·Created 2 years ago·Updated 7 days ago· 129
Audio Loader Crawl (CRT)
    • audio
    • file_name
    • file_path
    folder_path
    seed0
    file_extensionwav
    crawl_subfoldersfalse
    remove_extensionfalse
    max_length_seconds0.0
    start_offset_seconds0.0
    gain_db0.0

    If you've batch-processed images in ComfyUI, "crawl a folder and pick a file by seed" is a pattern you already know - CRT-Nodes has the same trick for images (Image Loader Crawl) and applies it to audio here. Instead of hardcoding one file path, you point this node at a folder and let it pick a file for you, reproducibly, based on a seed rather than truly at random.

    What it's for

    This is a dataset/batch-processing node more than a one-off loader. If you've got a folder of background music, sound effects, or voice samples and you want your workflow to pull a different one each run - but still be able to reproduce a specific pick later by reusing the same seed - this is the node for it. It also handles the trimming and gain-staging you'd otherwise bolt on separately: start offset, max length, and a gain adjustment are all built in, so you can go from "a folder of raw audio files" to "a properly leveled clip of the right length" in one node.

    The inputs and outputs that matter

    All required, all with tooltips straight from the node itself:

    • folder_path - "Path to the folder containing audio files."
    • seed - "Seed for deterministic file selection." Same seed, same folder contents, same file picked every time - this is what makes "random" here actually reproducible.
    • file_extension - enum of wav, mp3, flac, ogg (default wav), "File extension to filter for."
    • crawl_subfolders (default false) - "If true, include files in subfolders."
    • remove_extension (default false) - "Output filename without extension," for when you want the clean name for a save path or label rather than myfile.wav.
    • max_length_seconds (default 0, meaning no limit) - "Maximum length of the audio in seconds (0 for no limit)."
    • start_offset_seconds (default 0) - "Start loading the audio from this offset in seconds," useful for skipping a silent intro or a specific section of a longer file.
    • gain_db (default 0, range −120 to 120) - "Gain in decibels (dB)," applied on load.

    Outputs: audio, file_name (STRING), and file_path (STRING) - both string outputs are handy for logging which file got picked, or for feeding into a save node so your output filename references the source clip.

    Installing it

    One of eleven nodes in CRT-Nodes' CRT/Load category, alongside its image and video/text crawl counterparts - the "pick a random file from a folder by seed" pattern repeats across several media types in this pack, all bundled in PGCRT's larger CRT-Nodes suite.

    ComfyUI Manager - search CRT-Nodes, install, restart.

    Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/PGCRT/CRT-Nodes.git
    pip install -r requirements.txt
    

    Restart ComfyUI. Audio decode/gain here runs on librosa and imageio-ffmpeg from the pack's base requirements - nothing extra needed for this node specifically.

    Common issues

    • Same seed picks a different file after adding or removing audio files from the folder - this is expected, not a bug. The selection is deterministic relative to the folder's current contents, so any change to the file list can shift what a given seed resolves to. If reproducibility across time matters, keep the source folder frozen once you've locked in a seed.
    • Nothing loads, or an error about no matching files - check file_extension actually matches what's in the folder; it's a strict filter, and a folder of .m4a files under a wav filter will come up empty.
    • Subfolder files never get picked - crawl_subfolders defaults to false. If your audio is organized into subdirectories, you need to flip that on explicitly.
    • Clip is louder or quieter than expected - check gain_db isn't left at a nonzero value from a previous tweak; it's an absolute adjustment applied every load, not a one-time normalization.
    CategoryCRT/Load

    Inputs (8)

    NameTypeDefaultDescription
    folder_pathSTRINGPath to the folder containing audio files
    seedINT00–18446744073709550000Seed for deterministic file selection
    file_extensionCOMBOwavFile extension to filter for
    crawl_subfoldersBOOLEANfalseIf true, include files in subfolders
    remove_extensionBOOLEANfalseOutput filename without extension
    max_length_secondsFLOAT0.0Maximum length of the audio in seconds (0 for no limit)
    start_offset_secondsFLOAT0.0Start loading the audio from this offset in seconds
    gain_dbFLOAT0.0-120–120Gain in decibels (dB)

    Outputs (3)

    NameTypeDescription
    audioAUDIO
    file_nameSTRING
    file_pathSTRING