--- title: SeparateTracks emoji: 🎼 colorFrom: red colorTo: yellow sdk: docker sdk_version: 6.13.0 app_file: app.py tags: - audio - music - tools - MCP pinned: false short_description: Separate tracks from mixed audio --- Check out the configuration reference at ## SeparateTracks Download audio from YouTube, separate it into instrument stems with Demucs, and view the results in a Gradio AudioGallery UI with MCP support. ## Features - Accepts either a raw YouTube video ID or a full YouTube URL. - Accepts `.wav` or `.mp3` uploads as a local audio override for separation. - Builds a 7-track output gallery for drums, vocals, guitar, bass, other, piano, and combined music, with a download link under each play button. - Exposes an MCP endpoint at `/gradio_api/mcp/sse`. ## Usage Run the app locally (not admin): ```bash pip install -r requirements.txt python app.py ``` ```debugging py -m app -Xfrozen_modules=off ``` Then open `http://localhost:7860` and use one of these flows: 1. Paste a YouTube video ID or full URL into `YouTube Video ID or URL` and click `Separate Tracks`. 2. Upload a `.wav` or `.mp3` file into `Audio File Override (.wav or .mp3)` and click `Separate Tracks`. If an upload is present, it takes precedence over the YouTube field. ## Outputs Separated files are written under `separated/htdemucs_6s/{job_id}/`. For YouTube sources, `job_id` is the sanitized video title when available, falling back to the video ID. For uploaded audio, `job_id` is a sanitized version of the uploaded filename stem. Each stem card in the gallery can be played in place or downloaded directly. ## Extractors & Cookies For details about yt-dlp extractor behavior, see the official documentation: - If you need authenticated extraction (for age-restricted or otherwise protected content), one way to provide cookies safely is via a private/incognito browser session: 1. Open a new private browsing/incognito window and log into YouTube. 2. In the same window and same tab from step 1, navigate to (this should be the only private/incognito browsing tab open). 3. Export youtube.com cookies from the browser, then close the private/ incognito window so that the session is never opened in the browser again. Upload the exported cookies file in the app UI when prompted.