A full-stack web application that downloads audio from YouTube, detects its musical key, and generates a pitch-shifted (transposed) version of the audio in a new key. The project combines a React frontend, a FastAPI backend, and audio processing techniques using Python DSP libraries.
- YouTube audio download using yt-dlp
- Automatic musical key detection using a Krumhansl–Schmuckler–based algorithm
- Pitch-shifting / audio transposition using librosa
- Simple UI for:
- entering a YouTube url
- detecting key
- selecting a new key
- downloading the transposed audio
- Temporary storage of downloaded and processed audio files
- CORS-enabled FastAPI server
- Clean modular separation of services and UI
- React (Vite)
- Axios
- FastAPI
- Python 3.12
- yt-dlp
- librosa, numpy, scipy
Song_Transposer/
│
├── backend/
│ ├── app/
│ │ ├── api/
│ │ │ ├── routes.py
│ │ ├── services/
│ │ │ ├── key_detection.py
│ │ │ ├── transposer.py
│ │ ├── utils/
│ │ │ ├── youtube.py
│ │ ├── main.py
│ ├── requirements.txt
│
├── frontend/
│ ├── src/
│ │ ├── AudioTransposer.jsx
│ │ ├── App.jsx
│ │ ├── main.jsx
│ ├── package.json
│
└── README.md
- Create and activate a virtual environment
cd backend
python3 -m venv venv
source venv/bin/activateWindows
venv\Script\activate- Install backend dependencies
pip install -r requirements.txt- Install ffmpeg macOS
brew install ffmpegUbuntu / Debian
sudp apt install ffmpegWindows Download from: https://ffmpeg.org/download.html and add to PATH. 4. Start the FastAPI server
uvicorn app.main:app --reloadThe backend will be available at: http://127.0.0.1:8000
- Install dependencies
cd frontend
npm install- Start development server
npm run devThe frontend will be available at: http://127.0.0.1:5173
- Open the frontend in your browser.
- Enter any YouTube video URL containing music.
- Click Download Audio.
- Click Analyse Key to detect the musical key.
- Choose your target key from the dropdown.
- Click Transpose to generate a pitch-shifted version.
- Download the processed audio.
- Audio files are stored temporarily in a system temp directory (e.g.,
/tmp/ytdl_audioon macOS/Linux; on Windows a platform-appropriate temp directory is used). - The .gitignore excludes virtual environments, node_modules, caches, and temporary audio files.
- This project is cross-platform (macOS, Linux, Windows), but Windows users must install ffmpeg manually and activate the venv using
venv\Scripts\activate