Skip to main content
Glama
README.md
# cuebox

UGC music discovery, variant lineage, and FFmpeg audio cueing **CLI (`cue`) + MCP (`cue-mcp`)** for AI video editing agents.

Zero third-party Python dependencies (pure Python 3.10+ stdlib + `ffmpeg`/`ffprobe`).

## Features

- **Pluggable UGC Providers**: Ships with **Audius** (public API, zero API key required, native Remix lineage) and **Local** audio folder/file scanning; ready for SoundCloud, YouTube, and TikTok URL adapters.
- **Cross-Platform Variant Lineage (SQLite)**: Automatically normalizes titles and classifies variants (`original`, `cover`, `remix`, `slowed_reverb`, `sped_up`, `piano`, `orchestral`, `instrumental`, `phonk`, `lofi`, `mashup`) under a shared `work_id`.
- **FFmpeg Audio Analysis & Cueing**: Measures duration, integrated LUFS, true peak, and highest-energy **Hook Window**, then trims/loops with fade-in/fade-out and loudness normalization (`-14 LUFS`, etc.).
- **Dual Interface**: Same core service exposed as `cue` CLI (human-readable + `--json`) and `cue-mcp` (standard JSON-RPC 2.0 MCP stdio server).

## Quick Start

Requires Python 3.10+ and `ffmpeg` / `ffprobe` on `PATH`.

```bash
uv venv .venv
uv pip install --python .venv/bin/python -e .
```

### CLI (`cue`)

```bash
# Search UGC tracks on Audius (zero API key needed)
.venv/bin/cue search "cyberpunk phonk" --limit 5

# Filter by variant, duration, or vocals
.venv/bin/cue search "piano cover" --variant piano --duration 30-240 --json

# Discover remixes & cross-platform variants of the same work
.venv/bin/cue versions audius:<track_id>

# Import a remote track (downloads audio + analyzes LUFS & hook window) or local folder
.venv/bin/cue import audius:<track_id>
.venv/bin/cue import ./my-music-folder

# Clip 15s starting at the detected high-energy hook window with fades and -14 LUFS
.venv/bin/cue clip audius:<track_id> -o clip.wav --hook --duration 15 --fade-in 0.3 --fade-out 1.5 --lufs -14
```

### MCP Server (`cue-mcp`)

Add to Claude Desktop, Cursor, or Antigravity MCP config:

```json
{
  "mcpServers": {
    "cuebox": {
      "command": "/path/to/cuebox/.venv/bin/cue-mcp"
    }
  }
}
```

Exposed tools:
- `music_search` — multi-provider & local search with variant/BPM/duration/vocals filters
- `music_versions` — find variants/remixes sharing the same work lineage
- `music_related` — discover related tracks
- `music_preview` — return stream/page URLs and metadata
- `music_import` — download remote track or scan local files into SQLite
- `music_analyze` — measure duration, LUFS, true peak, and hook window
- `music_clip` — FFmpeg trim/loop/fade/LUFS export

## Development

```bash
.venv/bin/python -m unittest discover -s tests -v
```

## License

MIT — see [LICENSE](LICENSE).