A web application for chord substitution and reharmonization using music theory algorithms.
Interactive chord substitution tool with dual input modes:
- Classical Mode: Select key signature (30 major/minor keys) to generate diatonic chords
- Modern Mode: Input custom chord progressions
Substitution Techniques:
- All Techniques: Best substitutions combining all methods
- Diatonic: Chords sharing common tones within the same key
- Circle of Fifths: Chords related by fifth intervals (strong voice leading)
- Relative Major/Minor: Same key signature, different tonal center
- Parallel Major/Minor: Same root note, different quality (modal interchange)
- Chromatic Approach: Approach chords a semitone away (jazz technique)
- Tritone Substitution: Dominant 7th chords a tritone apart (jazz technique)
Each chord displays:
- 5 alternative substitution options
- Music notation (VexFlow rendering)
- Improvisation notes with chord tones and scale recommendations
Upload a musical phrase and receive chord recommendations based on the melody.
- Backend: Python 3.11, FastAPI, SQLAlchemy, PostgreSQL
- Frontend: React 18, TypeScript, Vite, React Router
- Music Notation: VexFlow for rendering chord symbols and notes
- Database: PostgreSQL 15
- Development: Docker, docker-compose
reharmonizer/
├── backend/ # Python/FastAPI backend
│ ├── app/
│ │ ├── api/ # REST API endpoints
│ │ ├── models/ # SQLAlchemy ORM models
│ │ ├── schemas/ # Pydantic validation schemas
│ │ ├── services/ # Business logic & music theory algorithms
│ │ └── repositories/# Data access layer
│ ├── alembic/ # Database migrations
│ └── scripts/ # Utility scripts (seeding, etc.)
├── frontend/ # React/TypeScript frontend
│ └── src/
│ ├── components/ # React components
│ │ ├── features/ # Feature-specific components
│ │ ├── layout/ # Layout components
│ │ ├── common/ # Reusable components
│ │ └── pages/ # Page components
│ ├── services/ # API client services
│ ├── store/ # Context API state management
│ └── types/ # TypeScript definitions
└── docker-compose.yml # Development environment
- Docker and docker-compose
- Git
- Clone the repository:
cd /Users/bgregorutti/Documents/git-projects/reharmonizer- Copy environment files:
cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env- Start all services:
docker-compose upThe services will be available at:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Database: localhost:5432
Run migrations and seed the database:
# Enter the backend container
docker-compose exec backend bash
# Run migrations
alembic upgrade head
# Seed the database with initial data
python scripts/seed_database.pyAvailable at http://localhost:8000/api/v1:
GET /keys- List available key signaturesGET /keys/{key}/chords- Get diatonic chords for a keyPOST /reharmonize- Get chord substitutionsGET /improvisation/notes/{chord}- Get improvisation notes and scales
Interactive API documentation: http://localhost:8000/docs
The application uses a database-driven approach with pre-computed chord substitution relationships:
- 15,000+ substitution pairs covering major music theory techniques
- Each substitution includes technique classification, shared notes, and compatibility scores
- Techniques include: diatonic, tritone, circle of fifths, chromatic, relative/parallel modal interchange
- Query database for substitutions matching selected technique
- Filter by compatibility criteria (shared notes, voice leading quality)
- Return top 5 ranked substitutions
- Display with music notation and improvisation notes
- Extract chord tones (root, third, fifth, seventh)
- Determine appropriate scales based on chord quality
- Provide scale recommendations and tension notes
See DEVELOPMENT_PLAN.md for future enhancements and roadmap.
MIT License
- VexFlow: Music notation rendering library
- FastAPI: Modern Python web framework
- React: UI library