# Adaptive Stem Alignment

Aligns audio stems with duration mismatch handling and pre-mix checks.

- Repository: https://github.com/HKUDS/AgentPilot (7784 stars)
- Category: Media
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add HKUDS/AgentPilot --skill adaptive-stem-alignment -g -a claude-code -y`
Codex: `npx skills add HKUDS/AgentPilot --skill adaptive-stem-alignment -g -a codex -y`
Cursor: `npx skills add HKUDS/AgentPilot --skill adaptive-stem-alignment -g -a cursor -y`
Gemini CLI: `npx skills add HKUDS/AgentPilot --skill adaptive-stem-alignment -g -a gemini-cli -y`

## Description

Incremental audio production with duration mismatch handling, adaptive stem extension, and pre-mix alignment verification

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Adaptive Stem Alignment Workflow

This skill provides a resilient pattern for audio production that emphasizes **incremental verification**, **fail-fast** principles, and **adaptive duration handling**. Each major step produces verified outputs before proceeding, with explicit strategies for handling stems of different durations.

## Overview

Follow these steps in strict order. Each step must complete successfully and pass verification before proceeding to the next:

1. **Early timing calculation** - Derive section transitions from BPM and duration first
2. **Verify reference audio** - Validate input file properties and establish target duration
3. **Generate and verify each stem individually** - One stem at a time with immediate verification
4. **Generate drum stem separately** - Dedicated drum extension with rhythm patterns
5. **Align stem durations** - Handle duration mismatches with adaptive extension strategies
6. **Apply effects with verification** - Process each stem and verify output
7. **Export master track** - Mix all verified stems
8. **Archive and final verification** - Package deliverables with comprehensive checks

## Key Differences from Standard Workflow

- **Incremental verification**: Verify each stem immediately after generation, not just at the end
- **Fail-fast approach**: Stop and report errors at each step rather than accumulating failures
- **Early timing**: Calculate section transitions before any audio generation
- **Separated drums**: Drum stem generation is a distinct step with rhythm-specific processing
- **Memory-efficient**: Process stems individually to avoid large array operations that cause sandbox failures
- **Adaptive duration handling**: Explicit strategies for mismatched stem durations (zero-padding, looping, crossfade extension)
- **Pre-mix alignment**: Verify all stems match target duration before mixing

## Step 1: Calculate Timing Parameters (Early)

The rest: https://github.com/HKUDS/AgentPilot/blob/HEAD/openspace/benchmarks/gdpval/skills/audio-track-production-enhanced-enhanced-b8f537/SKILL.md
