A web-based tool that automatically detects notes and chords from piano tutorial videos using computer vision. No server required - everything runs in your browser!
Piano Reader analyzes piano tutorial videos (like those made with Synthesia) and extracts the notes and chords being played in real-time. Instead of trying to follow falling raindrops and light-up keys, you get a clear tablature showing exactly what's being played.
| Left Hand | Right Hand |
|---|---|
| A Major | A1 D |
| A Maj | A2 |
| D minor | D2 |
- 🎥 Browser-based video processing - No server required
- 🎹 Automatic key detection - Set two reference points, generate the rest
- 🎵 Real-time note tracking - Detects which keys are pressed each frame
- 🎶 Chord recognition - Uses Tonal.js to identify chords from detected notes
- ⚙️ Adjustable sensitivity - Fine-tune detection for different video types
- 📱 Mobile responsive - Works on desktop and mobile devices
- White keys only: Currently doesn't support black keys/sharps
- Real-time processing: Must play video at normal speed for accurate detection
- Local files only: Cannot process videos from URLs due to CORS restrictions
- Manual calibration: Requires user to position initial tracking points
- Load a video file - Upload your piano tutorial video
- Position tracking points - Drag the red and blue markers to align with C1 and D1 keys
- Generate piano overlay - The tool creates tracking rectangles for all white keys
- Analyze frames - Each video frame is processed to detect lit-up keys
- Extract notes & chords - Real-time output of notes and chord progressions
- Modern web browser (Chrome, Firefox, Safari, Edge)
- Piano tutorial video file (MP4, WebM, etc.)
- Clone the repository:
git clone https://github.com/yourusername/pianoreader.git
cd pianoreader- Install dependencies:
cd react-src
npm install- Start the development server:
npm start- Open your browser to
http://localhost:3000
I intially started to build the app as a desktop app with neutralino.js. This is no longer used, but you can build on it as a desktop app with:
npm install -g @neutralinojs/neu
neu run
- Upload Video: Click "Choose File" and select your piano tutorial video
- Position Markers:
- Drag the red marker to the C1 key
- Drag the blue marker to the D1 key
- Generate Tracking: Click "Generate Piano Keys" to create the overlay
- Adjust Settings:
- Key Distance: Fine-tune spacing between keys
- Tracker Height: Adjust vertical position of detection area
- Sensitivity: Control how sensitive the detection is
- Play & Analyze: Start the video to see real-time note detection
- Frontend: React.js with Fabric.js for interactive canvas
- Video Processing: HTML5 Canvas with
getImageData()for pixel analysis - Computer Vision: Grayscale filtering + threshold-based key detection
- Music Theory: Tonal.js for chord recognition
- Styling: Tailwind CSS
src/
├── canvas.js # Main video processing and key detection
├── utils.js # Grayscale analysis and helper functions
├── components/
│ ├── playercontrols.js # Video playback controls
│ └── notesviewer.js # note/chord display
└── App.js # Main application component
- Grayscale Conversion: Apply grayscale filter to reduce color complexity
- Pixel Sampling: Extract pixel data from each key's detection area
- Threshold Analysis: Compare average grayscale value against sensitivity threshold
- Key State: Determine if key is "pressed" (lit up) or "unpressed"
- Chord Detection: Pass detected notes to Tonal.js for chord identification
You can bookmark specific configurations using URL parameters:
?c1=170,400&d1=183,400&kd=0&h=400&s=0.33&t=5
c1: C1 key position (left,top)d1: D1 key position (left,top)kd: Key distance adjustmenth: Tracker heights: Sensitivity (0-1)t: Start time in seconds
- Low sensitivity (0.1-0.3): Only very bright keys detected
- Medium sensitivity (0.3-0.6): Balanced detection
- High sensitivity (0.6-1.0): Detects dimmer key presses
- 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
# Install dependencies
npm install
# Start development server
npm start
# Build for production
npm run buildThis project is licensed under the MIT License - see the LICENSE file for details.
I don't have major plans to do much with this tool at the moment, happy to take contributions or encourage a fork.