-
Notifications
You must be signed in to change notification settings - Fork 12
Quick Start
This guide will help you start using Muze as quickly as possible.
✅ Python installed (2.7 or 3.6+)
✅ Webcam available
✅ Internet connection
✅ Algorithmia API key
pip install Flask Algorithmia Pillow numpy matplotlib Jinja2Edit algorithmia.py line 17:
client = Algorithmia.client('YOUR_API_KEY_HERE')Get your API key: algorithmia.com/users/sign_up
python app.pyNavigate to: http://localhost:5000
Click "Allow" when browser asks for camera permission.
The app will:
- Capture your facial expression
- Detect your emotion
- Generate a personalized playlist
- Start playing music automatically
-
Initial Page Load
- Webcam preview in bottom-right corner
- Audio player at top
- Two buttons: "Stop WebCam" and "Get more music"
-
After 5 Seconds
- Page reloads with your personalized playlist
- Music starts playing automatically
- Song name appears on screen
-
During Playback
- Songs play automatically one after another
- Current song name updates with each track
- After 20 songs, app rechecks your emotion
-
View Emotion Report
- Click "Stop WebCam / See report"
- See color-coded grid of your emotions over time
-
Get New Playlist
- Click "Get more music"
- Process restarts with fresh emotion detection
The app detects 7 emotions:
| Emotion | What You'll Hear |
|---|---|
| 😊 Happy | Upbeat, energetic songs |
| 😢 Sad | Mellow, contemplative tracks |
| 😠 Angry | Intense, powerful music |
| 😨 Fear | Calming or intense songs |
| 😲 Surprise | Mixed tempo variety |
| 🤢 Disgust | Neutral to moderate songs |
| 😐 Neutral | Balanced mix |
- 19-21 songs per playlist
- 60-90 minutes of music
- Automatic progression through emotional clusters
Problem: No video preview appears
Quick Fix:
- Check browser permissions (click lock icon in address bar)
- Ensure no other app is using webcam
- Try refreshing the page
- Use Chrome or Firefox for best compatibility
Problem: Page reloads but no music plays
Quick Fix:
- Check console for errors (F12 → Console tab)
- Verify API key is correct in
algorithmia.py - Ensure internet connection is active
- Check Algorithmia account has API credits
Problem: Playlist loads but audio doesn't start
Quick Fix:
- Check browser audio isn't muted
- Verify MP3 files exist in
static/music/folder - Try clicking play button manually
- Check browser console for errors
Problem: Error message about authorization
Quick Fix:
- Double-check API key in
algorithmia.pyline 17 - Ensure no extra spaces or quotes
- Verify Algorithmia account is active
- Generate new API key if needed
- Good lighting: Face the light source
- Center your face: Look directly at camera
- Clear expression: Show your emotion clearly
- Stay still: Avoid moving during snapshot (5 sec delay)
- Remove obstructions: No hands covering face
- Use headphones: Better audio quality
- Let it play: Give the playlist time to work its magic
- Try different emotions: Make different facial expressions
- Check after 20 songs: See how your mood changes
- Restart anytime: Click "Get more music" for fresh playlist
- View your journey: Click "Stop WebCam" to see emotion timeline
- Multiple sessions: Each session is independent
- Start app → Open http://localhost:5000
- Show stressed face → Frown, tense expression
- Wait 5 seconds → App captures your emotion
- Detected: Angry/Fear → App generates calming playlist
- Listen → Starts with intense songs, gradually calms
- After 20 songs → App rechecks (you're now calmer)
- New playlist → More relaxed, moderate energy songs
- Result → Mood improved through music therapy
Currently, Muze doesn't have keyboard shortcuts, but you can use browser defaults:
- Space: Play/Pause (when audio player focused)
- F11: Fullscreen mode
- F12: Open developer console (for debugging)
- Ctrl+R: Refresh page (restart session)
- Architecture: Understand how it works
- Emotion Detection: Learn about the AI
- Music Classification: See how songs are chosen
- API Reference: Technical details
-
Add your own music: Replace MP3 files in
static/music/ -
Modify clusters: Edit emotion-to-cluster mappings in
algorithmia.py -
Change UI: Edit templates in
templates/folder -
Adjust timing: Modify snapshot intervals in
musi.html
- Troubleshooting Guide: Detailed solutions
- Check logs: Look at terminal output for errors
- Browser console: F12 → Console for JavaScript errors
# Start server
python app.py
# Stop server
Ctrl+C
# Check if running
curl http://localhost:5000
# View logs
# (Terminal shows real-time logs)
# Restart server
Ctrl+C
python app.py- Terminal output: Look for Python errors
- Browser console: F12 → Console tab
- Network tab: F12 → Network (check API calls)
- Algorithmia dashboard: Check API usage/credits
| Error | Meaning | Solution |
|---|---|---|
| "Address already in use" | Port 5000 busy | Kill process or use different port |
| "Module not found" | Missing dependency | Run pip install <module>
|
| "Authorization required" | Invalid API key | Check algorithmia.py line 17 |
| "getUserMedia not supported" | Browser issue | Use Chrome/Firefox |
| "No face detected" | Can't see face | Improve lighting, center face |
- Take snapshot in good lighting
- Make exaggerated facial expressions
- Look directly at camera
- Remove glasses if possible (optional)
- Try different emotions intentionally
- Let full playlist play through
- Note songs you like (write down names)
- Explore different moods throughout day
- Close other apps using webcam
- Use wired internet for API calls
- Clear browser cache if slow
- Restart server if memory issues
- App only captures snapshots (not continuous video)
- Images sent to Algorithmia API only
- Snapshots overwritten each time
- No long-term storage of your images
Before asking for help, verify:
- Python dependencies installed
- API key configured correctly
- Webcam working in other apps
- Internet connection active
- Port 5000 not in use
- Music files present in
static/music/ -
test.txtfile exists -
snapshots/directory exists - Browser supports WebRTC
- Algorithmia account has credits
You're all set! Open http://localhost:5000 and start your personalized music therapy session.
Enjoy the music! 🎵