| title | TarangFX |
|---|---|
| emoji | 🎵 |
| colorFrom | blue |
| colorTo | indigo |
| sdk | docker |
| pinned | false |
Professional-grade audio processing pipeline built on Telethon & Spotify's Pedalboard.
TarangFX v2 is a complete rewrite focusing on speed, quality, and stackable effects. Unlike the previous version, v2 allows you to chain multiple operations (e.g., "Convert to FLAC" + "Bass Boost" + "Reverb") into a single processing session.
Key Upgrades in v2:
- Engine: Switched from pure FFmpeg to Spotify's Pedalboard for studio-quality effects (VST-like processing).
- Core: Migrated from Pyrogram to Telethon for better async handling and session management.
- Workflow: New "Session" system. Configure everything first, then process once.
- Performance: Redis caching for rate limits and session state.
This release finalizes the v2 pipeline for production use and includes the following shipped improvements:
- Lossless bitrate workflow improvements:
- Dynamic bitrate menu based on selected/source format.
- FLAC/lossless targets now expose high bitrate presets up to 36000 kbps.
- Original bitrate option is preserved.
- Format-aware validation:
- Bitrate choices are validated against selected format and user tier.
- Convert and bitrate settings are synchronized so final output uses selected encoding intent.
- Processor pipeline refinements:
- Avoids unnecessary double-transcoding when both bitrate and convert operations are selected.
- FLAC bitrate-style selections are mapped to FLAC compression behavior for stable output generation.
- Container/runtime stability:
- Docker runtime supports local Redis for self-contained deployments.
- Cache backend selection supports Upstash when configured, with Redis URL fallback behavior.
- Quality assurance updates:
- Added/updated tests for bitrate menu behavior and FLAC-related processing logic.
- Format Conversion:
- Free: MP3, AAC, OGG, OPUS
- Premium: FLAC, WAV, AIFF, ALAC (Lossless)
- Bitrate Control:
- Lossy presets: 128kbps, 192kbps, 256kbps, 320kbps
- Lossless/FLAC presets (Premium): up to 36000kbps
- Original (pass-through)
- Sample Rate:
- Free: 22.05kHz, 44.1kHz
- Premium: 48kHz, 96kHz (High-Res)
Powered by Pedalboard, allowing granular control:
- Bass Boost: Frequency-targeted boosting (20Hz - 120Hz).
- Vocal Enhancement: Presets for Male and Female vocals.
- Standard FX: Reverb, Delay, Distortion, Chorus.
- Smart Normalization: Available to all users.
- Async Operations: Non-blocking downloads and uploads.
- Concurrency Control: Limits active operations per user to prevent server overload.
- Privacy: Temp files are isolated by User ID and auto-deleted after processing.
There are two primary ways to deploy TarangFX:
- Zero-Cost Cloud Deployment (No Credit Card required) - Perfect for users wanting a 24/7 bot for free using Hugging Face Spaces.
- Standard VPS or Local Deployment - For those who have their own Linux server or Windows PC.
This stack provides a robust production environment absolutely free forever.
Step 1: Get a free PostgreSQL Database (Neon.tech)
- Go to Neon.tech and sign up (no card required).
- Create a new project and copy the Connection String (e.g.,
postgres://user:pass@ep-restless...). - This is your
DATABASE_URL.
Step 2: Get a free Redis Database (Upstash)
- Go to Upstash and sign up (no card required).
- Create a Redis database. Scroll down to the REST API section.
- You will need the UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.
Step 3: Deploy to Hugging Face Spaces (Compute) Hugging Face provides 16GB RAM and 2 vCPUs completely free!
- Go to Hugging Face and create an account.
- Go to Spaces -> Create new Space.
- Space name:
tarangfx(or whatever you like). - License:
MIT. - Select the Docker space SDK.
- Choose the Blank template and create the space.
- Clone the Space repository to your computer and copy all files from this TarangFX codebase into it. Push it back, OR upload the files manually via the Hugging Face web interface.
- Go to your Space settings -> Variables and secrets.
- Add all your
.envvariables as Secrets:API_IDAPI_HASHBOT_TOKENSUDO_USERSDATABASE_URL(From Step 1)UPSTASH_REDIS_REST_URL(From Step 2)UPSTASH_REDIS_REST_TOKEN(From Step 2)
Step 4: Keep it Awake 24/7 Hugging Face spaces sleep after 48 hours. To keep it awake forever:
- Go to cron-job.org (free).
- Create a cron job that pings your Hugging Face Space URL (e.g.,
https://username-tarangfx.hf.space) every 60 minutes.
Follow these steps to set up TarangFX on your local machine or server.
Ensure you have the following installed:
- Python 3.10+: Download Here
- Git: Download Here
Open your terminal (Command Prompt/PowerShell on Windows, Terminal on Linux) and run:
git clone https://github.com/PN-Projects/TarangFX.git
cd TarangFXFFmpeg is required for audio format conversion.
- Download the essential build from gyan.dev.
- Extract the
.7zfile (using 7-Zip or WinRAR) to a folder, e.g.,C:\ffmpeg. - Add FFmpeg to your System PATH:
- Search for "Edit the system environment variables".
- Click "Environment Variables".
- Under "System variables", select Path and click Edit.
- Click New and paste the path to the
binfolder inside your extracted ffmpeg folder (e.g.,C:\ffmpeg\bin). - Click OK on all windows.
- Verify by typing
ffmpeg -versionin a new command prompt.
sudo apt update
sudo apt install ffmpeg
ffmpeg -versionYou need a PostgreSQL database to store user data.
- Go to Neon.tech and sign up.
- Create a new project.
- On the dashboard, copy the Connection String (it looks like
postgresql://user:pass@ep-xyz.neon.tech/neondb?sslmode=require). - Save this for your
.envfile later.
- Windows: Download and install PostgreSQL for Windows. During install, set a password for the
postgresuser.- Your URL will be:
postgresql://postgres:YOUR_PASSWORD@localhost:5432/postgres
- Your URL will be:
- Linux:
sudo apt install postgresql postgresql-contrib sudo -u postgres psql # Inside psql shell: ALTER USER postgres PASSWORD 'your_password'; \q
Redis is used for handling user sessions and rate limiting.
- Go to Redis.com and sign up.
- Create a free subscription.
- Copy the Public Endpoint (e.g.,
redis-12345.c1.us-east-1-2.ec2.cloud.redislabs.com:12345). - Copy the Default User Password.
- Your URL format:
redis://default:PASSWORD@ENDPOINT(e.g.,redis://default:password123@redis-12345...:12345).
- Windows: Redis is not officially supported on Windows.
- Alternative: Use Memurai Developer Edition OR run Redis via WSL 2 (Windows Subsystem for Linux).
- Linux:
sudo apt install redis-server sudo systemctl enable redis-server sudo systemctl start redis-server- Your URL:
redis://localhost:6379/0
- Your URL:
Create a file named .env in the root folder and fill in the following details.
- API_ID & API_HASH:
- Log in to my.telegram.org.
- Go to API development tools.
- Create an app (any name works). Copy the
App api_idandApp api_hash.
- BOT_TOKEN:
- Open Telegram and chat with @BotFather.
- Send
/newbot, name your bot, and get the token.
- OWNER_ID:
- Chat with @userinfobot on Telegram.
- Copy the
Id.
# --- Telegram Defaults ---
API_ID=12345678
API_HASH=abcdef1234567890abcdef
BOT_TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
OWNER_ID=123456789 (Your Telegram ID)
# --- Database & Cache ---
# neon.tech or local postgres url
DATABASE_URL=postgresql://user:pass@ep-xyz.neon.tech/neondb?sslmode=require
# redis labs or local redis url
REDIS_URL=redis://default:pass@redis-endpoint:port
# --- Limits & Settings ---
TEMP_DIR=./tmp_downloads
MAX_FILE_SIZE_MB=2000
SESSION_TIMEOUT_MINUTES=10- Create Virtual Environment:
python -m venv venv - Activate Environment:
.\venv\Scripts\activate
- Install Dependencies:
pip install -r requirements.txt - Run:
python bot.py
- Create Virtual Environment:
python3 -m venv venv
- Activate Environment:
source venv/bin/activate - Install Dependencies:
pip install -r requirements.txt # If you face issues with pedalboard, ensure you have build tools installed: # sudo apt install build-essential python3-dev
- Run:
python3 bot.py
If you prefer using Docker (easy deployment on VPS):
# docker-compose.yml
version: '3.8'
services:
bot:
build: .
restart: always
env_file: .env
depends_on:
- redis
# Only needed if you want local redis.
# If using Redis Labs, remove this service and the depends_on block above.
redis:
image: redis:alpine
restart: alwaysCommand to run:
docker-compose up -d --buildWe welcome contributions!
- Fork the repository.
- Create a feature branch (
git checkout -b feature/amazing-feature). - Commit your changes (
git commit -m 'Add amazing feature'). - Push to the branch (
git push origin feature/amazing-feature). - Open a Pull Request.