samples
Find drum, one-shot, loop, and break audio files by folder, path query, or duration, then use returned paths in project_write to load samplers or audio clips.
Instructions
List samples for drums, one-shots, loops and breaks; a sample's path (its folder plus its name) goes into project_write as a sampler's or audio clip's path. Call it before choosing any sample, and take samples only from folders the user gave.
No arguments: the user's sample folders, each with its subfolders and how many audio files each holds. With query, the samples whose path matches; with folder, that folder's subfolders and files, and a query stays inside it. Returns {total, results: {folder: [[name, seconds]]}}; past limit the list is an even spread across folders.
When config sample_folders is not set it returns {ok: false, error}: ask the user where their samples are and set it with config (a folder or a JSON list), or 'none' when they have none, which makes FL's factory packs the source; the answer is kept.
Changes no sample file; FL need not run. It caches folder listings in tmp/samples/index/; measure also writes tmp/samples/.tsv.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | at most this many samples | |
| query | No | words that must all appear in the path below the sample folder, case-insensitive, any order, any depth, e.g. 'snare tight' | |
| folder | No | one folder to look into: absolute, below a sample folder, or %FLStudioFactoryData%/...; omit for all sample folders | |
| measure | No | also write the folder's own audio files' levels, width, onsets and centroid to tmp/samples/<folder>.tsv | |
| max_folders | No | at most this many folders in a folder listing, whole levels from the top | |
| max_seconds | No | keep samples at most this long, e.g. 1 for one-shots | |
| min_seconds | No | keep samples at least this long |