FlacJacket is a web application that analyzes long audio files (like DJ mixes and live concert recordings) from platforms such as SoundCloud or YouTube. It identifies individual tracks within these recordings using audio fingerprinting technology and allows users to download them in high-quality formats.
- URL input support for SoundCloud and YouTube
- High-quality audio downloading
- Advanced audio fingerprinting and track detection
- Track metadata display
- High-quality track downloads
- Real-time analysis status updates
- Task monitoring dashboard
The system uses advanced audio analysis to detect individual tracks within a mix:
-
Download Phase
- Downloads audio from SoundCloud using
scdl
- Converts to WAV format for analysis
- Logs file sizes and conversion details
- Downloads audio from SoundCloud using
-
Analysis Phase
- Uses
librosa
for audio processing - Detects onsets (significant changes in audio)
- Creates segments based on detected onsets
- Assigns confidence scores based on segment duration
- Uses
-
Track Types
full_track
: When no clear segments are detectedonset_based
: Segments detected between onsetsfinal_segment
: Last segment to end of file
- Flask (Python web framework)
- SQLAlchemy (Database ORM)
- Celery (Async task processing)
- yt-dlp (YouTube downloading)
- scdl (SoundCloud downloading)
- librosa (Audio processing)
- PostgreSQL (Database)
- Redis (Message broker)
- Flower (Celery monitoring)
- Structlog (Structured logging)
- Next.js 14
- TypeScript
- Tailwind CSS
- Material-UI components
- React Hooks for state management
- Clone the repository:
git clone https://github.com/yourusername/flacjacket.git
cd flacjacket
- Start the application using Docker Compose:
docker compose up --build
That's it! The application will:
- Build all necessary containers
- Initialize the PostgreSQL database
- Automatically apply any pending migrations
- Start the Flask backend, Celery worker, and React frontend
The application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5001
The application consists of several services that run in Docker containers:
-
Frontend (Next.js)
- Port: 3000
- Development server with hot-reloading
- Communicates with backend API
- Modern UI with real-time updates
-
Backend (Flask)
- Port: 5001
- RESTful API endpoints
- Handles audio analysis requests
- Manages database operations
- Coordinates with Celery worker
-
PostgreSQL
- Port: 5432
- Stores analysis results and track data
- Persistent volume for data storage
- Automatic health checks
-
Redis
- Port: 6379
- Message broker for Celery
- Task queue management
- Result backend storage
-
Celery Worker
- Processes audio analysis tasks
- Handles long-running operations
- Manages file downloads and processing
- Updates task status in real-time
The database migrations are handled automatically when the application starts. However, if you need to manage migrations manually:
- Create a new migration:
docker compose exec backend flask db migrate -m "Description of changes"
- Apply migrations manually:
docker compose exec backend flask db upgrade
- Revert migrations:
docker compose exec backend flask db downgrade
The project includes comprehensive tests using real SoundCloud URLs:
SOUNDCLOUD_URLS = [
"https://soundcloud.com/soundnightclub/sparrow-barbossa-live-at-sound-on-031624",
"https://soundcloud.com/sweetmusicofc/sweet-mixtape-135-sparrow-barbossa",
"https://soundcloud.com/sparrowandbarbossa/maggies1"
]
Run tests with:
docker compose exec backend pytest tests/test_audio_analysis.py -v
POST /api/analysis
- Start a new analysis{ "url": "https://soundcloud.com/example/track" }
GET /api/analysis/:id
- Get analysis status and resultsGET /api/analyses
- List all analysesDELETE /api/analysis/:id
- Delete an analysis
GET /api/health
- Check API health status
- Start analysis:
curl -X POST -H "Content-Type: application/json" \
-d '{"url":"https://soundcloud.com/your-url"}' \
http://localhost:5001/api/analysis
- Check status:
curl http://localhost:5001/api/analysis/{analysis_id}
The application is composed of several Docker containers:
frontend
: Next.js web applicationbackend
: Flask API servercelery_worker
: Async task processor for audio analysispostgres
: PostgreSQL databaseredis
: Message broker for Celeryflower
: Celery task monitoring dashboard
The application includes comprehensive monitoring and logging:
-
Task Monitor Dashboard
- Access at http://localhost:5555
- Real-time task status and progress
- Historical task data and statistics
- Worker status and resource usage
-
Structured Logging
- Detailed task execution logs
- Error tracking and debugging information
- Performance metrics
- Audit trail for all operations
The system provides detailed logging at every stage:
-
Download Stage
- Track info fetching
- Download progress
- File sizes (MP3 and WAV)
- Conversion details
-
Analysis Stage
- Audio file properties
- Onset detection results
- Segment creation
- Confidence calculations
-
Processing Stage
- Database updates
- Track entry creation
- Processing duration
- Fork the repository
- Create your feature branch
- Add tests for any new functionality
- Ensure all tests pass
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.