A mood-aware music player that detects your facial expression and plays songs that match how you feel.
- π Real-time facial expression detection β uses your webcam to detect your mood
- πΆ Mood-based song playback β songs are tagged by mood and played accordingly
- π Song upload with metadata β reads ID3 tags (title, artist, album, year) automatically
- πΌοΈ Album art extraction β pulls embedded artwork from MP3 files
- β‘ Custom audio player β with progress bar, skip controls, speed control, and volume
- βοΈ Cloud storage β songs and posters stored on ImageKit
- ποΈ Persistent library β song metadata stored in MongoDB
- β‘ Redis caching β fast repeated queries
| Technology | Purpose |
|---|---|
| React 19 | UI framework |
| SCSS (BEM) | Styling |
| MediaPipe | Facial landmark detection |
| Technology | Purpose |
|---|---|
| Node.js + Express | REST API server |
| MongoDB + Mongoose | Song metadata storage |
| Redis | Caching layer |
| ImageKit | Cloud storage for audio & images |
| node-id3 | MP3 ID3 tag parsing |
| Multer | File upload handling |
Moodify/
βββ Backend/
β βββ src/
β β βββ controllers/
β β β βββ song.controller.js
β β βββ models/
β β β βββ song.model.js
β β βββ routes/
β β β βββ song.routes.js
β β βββ services/
β β βββ storage.service.js
β βββ .env
β βββ package.json
β
βββ Frontend/
βββ src/
β βββ components/
β β βββ Player.jsx
β β βββ FaceExpression.jsx
β βββ hooks/
β β βββ useSong.js
β βββ styles/
β β βββ player.scss
β βββ utils/
β β βββ util.js
β βββ song.context.js
βββ package.json
- Node.js >= 18
- MongoDB (local or Atlas)
- Redis (local or cloud)
- ImageKit account
git clone https://github.com/SubhamBhuin-05/Moodify.git
cd Moodifycd Backend
npm installCreate a .env file in the Backend directory:
PORT=3000
MONGODB_URI=your_mongodb_connection_string
REDIS_URL=your_redis_url
IMAGEKIT_PRIVATE_KEY=your_imagekit_private_key
IMAGEKIT_PUBLIC_KEY=your_imagekit_public_key
IMAGEKIT_URL_ENDPOINT=your_imagekit_url_endpointStart the backend server:
npm run devcd Frontend
npm install
npm run devPOST /api/songs/upload
Content-Type: multipart/form-data| Field | Type | Description |
|---|---|---|
file |
File |
MP3 file with embedded ID3 tags |
mood |
String |
One of: happy, sad, surprised |
Response:
{
"message": "Song uploaded successfully",
"song": {
"_id": "...",
"title": "Song Title",
"artist": "Artist Name",
"album": "Album Name",
"year": "2024",
"mood": "happy",
"url": "https://ik.imagekit.io/...",
"posterUrl": "https://ik.imagekit.io/..."
}
}GET /api/songs?mood=happy- The app accesses your webcam via the browser
- MediaPipe Face Landmarker analyzes your facial landmarks in real time
- The detected expression (
happy,sad,surprised) is matched against songs in the database - The matching song is loaded into the player automatically
For best results, upload MP3 files with complete ID3 tags:
- Title β song name
- Artist β artist name
- Album β album name
- Year β release year
- Embedded album art β used as the poster in the player
You can tag MP3s using tools like Mp3tag (free, Windows/Mac).
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a new branch:
git checkout -b feature/your-feature-name - Commit your changes:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature/your-feature-name - Open a Pull Request
This project is currently unlicensed. All rights reserved Β© Subham Bhuin.
Subham Bhuin
GitHub: @SubhamBhuin-05
Made with β€οΈ and good music π§