Extract the "stems" (e.g. drums, vocals, bass) from any song on Spotify or Youtube into separate audio files
This is a Flask web app using the following resources:
- Demucs ML model: Demucs is an music source separation model that creates the stems
- yt-dlp: Extracts the audio from the YouTube videos before passing them into demucs.
- Spotify API & Youtube Data API for URL conversion
-
Install Python 3.8 or higher
-
Clone the repository: Open a terminal and clone the repository using the following command:
git clone https://github.com/otonomee/streamstem.git cd streamstem -
Install dependencies: Navigate to the project directory and install the required dependencies:
pip install -r requirements.txt
-
Set up environment variables (Required for Spotify URL conversion):
a. Copy the example environment file:
cp .env.example .env
b. Edit
.envand add your API credentials:SPOTIFY_CLIENT_ID=your_spotify_client_id_here SPOTIFY_CLIENT_SECRET=your_spotify_client_secret_here GOOGLE_API_KEY=your_google_api_key_hereHow to get API credentials:
- Spotify API: Register at Spotify Developer Dashboard to get Client ID and Secret
- Google YouTube API: Create a project at Google Cloud Console and enable YouTube Data API v3
Note: API credentials are only required if you want to use Spotify URLs. YouTube URLs work without any API keys.
-
Run the web app: Start the web app by running the following command:
python application.py
-
Access the web app: Open your web browser and go to http://localhost:8001 to access the web app.
-
Enter the YouTube video URL: On the web app's homepage, enter the URL of the YouTube video you want to convert the audio from.
-
Select the number of stems you'd like:
- 2 stems: vocals and instrumental
- 4 stems: vocals, drums, bass, other
- 6 stems: vocals, drums, bass, guitar, piano, other
-
Select desired output format
-
Hit Submit and wait a few minutes. Download prompt will appear when finished :)