Skip to content

SubhamBhuin-05/Moodify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎡 Moodify

A mood-aware music player that detects your facial expression and plays songs that match how you feel.

Node React


✨ Features

  • 🎭 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

πŸ› οΈ Tech Stack

Frontend

Technology Purpose
React 19 UI framework
SCSS (BEM) Styling
MediaPipe Facial landmark detection

Backend

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

πŸ“ Project Structure

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

πŸš€ Getting Started

Prerequisites

  • Node.js >= 18
  • MongoDB (local or Atlas)
  • Redis (local or cloud)
  • ImageKit account

1. Clone the repository

git clone https://github.com/SubhamBhuin-05/Moodify.git
cd Moodify

2. Backend setup

cd Backend
npm install

Create 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_endpoint

Start the backend server:

npm run dev

3. Frontend setup

cd Frontend
npm install
npm run dev

πŸ“‘ API Reference

Upload a Song

POST /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 Songs by Mood

GET /api/songs?mood=happy

🎭 How Mood Detection Works

  1. The app accesses your webcam via the browser
  2. MediaPipe Face Landmarker analyzes your facial landmarks in real time
  3. The detected expression (happy, sad, surprised) is matched against songs in the database
  4. The matching song is loaded into the player automatically

🎡 Song Upload Requirements

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).


🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a new branch: git checkout -b feature/your-feature-name
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin feature/your-feature-name
  5. Open a Pull Request

πŸ“„ License

This project is currently unlicensed. All rights reserved Β© Subham Bhuin.


πŸ‘€ Author

Subham Bhuin
GitHub: @SubhamBhuin-05


Made with ❀️ and good music 🎧

About

Your face is the remote. Moodify detects how you feel and plays music that matches your mood. 🎡

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors