---
name: sample-pack
description: Turn a folder of random audio files into a standardized, releasable sample pack. Auto-detects BPM and key (via librosa), renames files with `{bpm}bpm_{key}_{name}.wav`, converts everything to 24-bit/44.1kHz WAV, sorts into one-shot vs loop subfolders by duration, builds a JSON manifest, and writes a README. Drop-in producer pipeline for FL Studio / Ableton libraries. Use when the user asks to "make a sample pack", "organize these samples", "tag with BPM and key", "build a kit from this folder", or wants to turn a dump folder into a usable producer asset.
---


# sample-pack

Folder of audio chaos → professional sample pack.

## What it does

1. Scan every audio file in the input folder (recursively or flat)
2. For each file:
   - Detect **BPM** (librosa beat tracker)
   - Detect **musical key** (Krumhansl–Schmuckler chord profile on chroma features)
   - Convert to 24-bit / 44.1kHz WAV
   - Rename to `{bpm}bpm_{key}_{original}.wav`
3. Sort:
   - `loops/` — files ≥ 2 seconds
   - `oneshots/` — files < 2 seconds
4. Write `manifest.json` (every file's metadata)
5. Write `README.md` with the pack overview

## Basic usage

```bash
python3 ~/.claude/skills/sample-pack/scripts/build.py --input ~/raw_samples --output ~/packs/MyKit_v1
```

## Skip BPM/key detection (just standardize + sort)

```bash
python3 ~/.claude/skills/sample-pack/scripts/build.py --input ./dump --output ./pack --no-analyze
```

## Custom oneshot/loop threshold

```bash
python3 ~/.claude/skills/sample-pack/scripts/build.py --input ./dump --output ./pack --oneshot-max 1.5
```

## Recursive scan

```bash
python3 ~/.claude/skills/sample-pack/scripts/build.py --input ./big_dump --output ./pack --recursive
```

## Flags

- `--input` — source folder
- `--output` — destination folder (created if missing)
- `--recursive` — descend into subfolders
- `--no-analyze` — skip BPM/key detection (much faster)
- `--oneshot-max` — duration cutoff in seconds for oneshot vs loop (default 2.0)
- `--sample-rate` — output sample rate (default 44100)
- `--bit-depth` — output bit depth (default 24)
- `--keep-original` — also copy original files into `_originals/` subfolder

## First-run install

Auto-installs `librosa`, `soundfile`, `numpy`. ffmpeg expected on PATH.

## Pairs well with

- `stems` — split a song into stems first, then sample-pack the resulting folder
- `beatcut` / `samplette` — feed organized packs into the rest of the producer ecosystem
- `cover-art` — auto-generate a cover image for the released pack
