Skip to content

RamiDevX/Safaa-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Separate vocals from music using AI. Send a YouTube link or an MP3 — get the vocals back, clean.


📖 About

Safaa AI is a Telegram bot that isolates vocals from any song using AI. Drop a YouTube link or upload an MP3, and the bot handles the rest — no editing software, no manual work.


✨ Features

🎥 Extract audio directly from YouTube links
📤 Or upload an audio file straight from Telegram
🤖 AI-powered vocal isolation using Demucs (htdemucs model)
🧹 Automatic cleanup of temporary files after every request
Fully async — handles multiple users concurrently

🛠️ Tech Stack

Python Aiogram PyTorch FFmpeg Demucs yt--dlp


📋 Requirements

  • Python 3.9+
  • FFmpeg installed and available on your system PATH
  • A Telegram bot token from @BotFather

🚀 Setup

1. Clone the repo

git clone https://github.com/RamiDevX/Safaa-AI.git
cd Safaa-AI

2. Create and activate a virtual environment

python -m venv .venv

# Windows
.venv\Scripts\Activate.ps1

# macOS/Linux
source .venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Configure environment variables

Create a .env file in the project root:

BOT_TOKEN=your_telegram_bot_token_here

5. Run the bot

python bot.py

💬 Usage

Command / Action Result
/start Shows a welcome message and instructions
Send a YouTube link Bot downloads the audio and returns the isolated vocals
Upload an audio file (≤ 20 MB) Same process, straight from your file

📂 Project Structure

Safaa-AI/
├── bot.py              # Main bot logic
├── requirements.txt    # Python dependencies
├── .env                # Bot token (not committed)
├── .gitignore
└── bot_data/            # Runtime logs + temporary session files (auto-created)

📝 Notes

Note

The first run downloads the htdemucs model weights (~80 MB), so the first request takes longer than usual.

Note

Videos longer than 30 minutes are skipped to avoid excessive resource usage — configurable via MAX_VIDEO_DURATION_SECONDS in bot.py.

Warning

Never commit your .env file or bot token to version control.


👨‍💻 Developer

Rami Bitar



Safaa AI © 2026

About

Safaa AI — a Telegram bot that separates vocals from background music using AI (Demucs). Send a YouTube link or upload an MP3 and get an isolated vocal track.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages