# Design: `fix-drum-sample-paths` **Type**: bugfix **Bug**: Drum samples silent — `samples_dir/output/samples/` paths point to nonexistent directory **Root cause**: `compose_full_track.py` passes bare filenames to skeleton, which joins them with `samples_dir` expecting `output/samples/`. But `pick()` returns absolute paths from the sample library. The mismatch makes FL Studio look in the wrong place. --- ## Changes ### 1. `scripts/compose_full_track.py` — lines 201–210 **Problem**: `samples` dict receives bare filenames (`ch10_perc`, etc.) but skeleton needs absolute paths. **Fix**: Change the `samples` dict to use the `path*` variables returned by `pick()`, which are absolute paths. ```python # Before (broken) samples = { "channel10": ch10_perc, # bare filename e.g. "perc_loop.wav" ... } # After (fixed) samples = { "channel10": path10, # absolute path e.g. "C:\Users\...\library\perc_loop.wav" ... } ``` The `path*` variables already exist and hold `m.get("original_path")` from `pick()`. No other code needs changing — the samples dict key→channel mapping is already correct. --- ### 2. `src/flp_builder/skeleton.py` — `_patch_sample_path()` around line 361 **Problem**: `_patch_sample_path()` always joins `wav_name` with `self.samples_dir`, which breaks when `wav_name` is already an absolute path (as it now is after fix #1). **Fix**: Add an absolute-path guard before joining: ```python # In _patch_sample_path(), replace line 361: # Before full_path = os.path.join(self.samples_dir, wav_name) # After if Path(wav_name).is_absolute(): full_path = wav_name else: full_path = os.path.join(self.samples_dir, wav_name) ``` This preserves existing behavior for relative paths (used elsewhere) while correctly handling the absolute paths now being passed. --- ## Files affected | File | Lines | Change | |------|-------|--------| | `scripts/compose_full_track.py` | 201–210 | Use `path*` vars instead of `ch*_var` vars | | `src/flp_builder/skeleton.py` | 361 | Add `is_absolute()` guard | --- ## Verification - **Before fix**: `compose_full_track.py` prints `ch10: some_file.wav` (bare filename) - **After fix**: `compose_full_track.py` prints full paths, skeleton detects them and skips join - Run `python scripts/compose_full_track.py` — FLP should load drum samples correctly