Skip to content

CodeWithBasu/RhythmX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

128 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽต RhythmX โ€” Premium Audio Visualizer App

RhythmX Banner

RhythmX is a high-performance, real-time music visualizer built with Next.js 16, MongoDB, Pusher, and Cloudinary. It features ultra-low latency synchronization and high-fidelity neon visuals.

๐Ÿš€ Key Features

  • Real-Time Party Sync: Zero-latency playback alignment (<50ms) using Pusher Client Events.
  • High-Capacity Storage: Bypasses Vercel's 4.5MB limit using direct Cloudinary binary uploads.
  • Dynamic Neon Visualizer: Real-time HSL frequency mapping for immersive, glowing waves.
  • Social Interaction: Instant floating emoji reactions that sync across all connected devices.
  • Progressive Web App (PWA): Installable on iOS, Android, and Desktop with full-screen support.

โšก Technical Code Snippets

1. Zero-Latency Party Sync (Pusher)

We use Pusher's client-events to bypass the server entirely for sub-50ms synchronization across devices.

// Unified sync beam for play, pause, and seek events
const sendSyncEvent = (action: string, time: number) => {
  if (partyChannelRef.current && isHost) {
    partyChannelRef.current.trigger('client-sync', {
      action,
      time,
      senderId: myUserId
    });
  }
};

2. High-Capacity Cloudinary Upload

To bypass the 4.5MB Vercel Serverless limit, we stream binary files directly from the browser to Cloudinary.

const uploadToCloud = async (file: File) => {
  const formData = new FormData();
  formData.append('file', file);
  formData.append('upload_preset', 'rhythmx_unsigned');
  
  const response = await fetch(`https://api.cloudinary.com/v1_1/${cloudName}/upload`, {
    method: 'POST',
    body: formData
  });
  const data = await response.json();
  return data.secure_url; // Returns the permanent cloud link
};

3. Dynamic Neon Visualizer Logic

Maps raw audio frequency data to a smooth color-blended gradient with organic glowing blooms.

const getBarColors = (index: number, total: number, height: number, isPlaying: boolean) => {
  // Map frequency position to vibrant HSL color wheel
  const hue = (index / total) * 360;
  const intensity = height / 100; // 0 to 1
  
  return {
    bg: isPlaying ? `hsla(${hue}, 80%, 65%, ${0.3 + intensity * 0.7})` : 'rgba(255,255,255,0.1)',
    glow: isPlaying ? `0 0 ${15 * intensity}px hsla(${hue}, 80%, 65%, 0.5)` : 'none'
  };
};

๐Ÿ—๏ธ System Architecture

... [Keep existing mermaid diagram] ...

graph TD
    User((User))
    Guest((Guest User))

    subgraph "Frontend (PWA & Next.js)"
        UI["Responsive React UI"]
        Visualizer["Web Audio API Engine"]
        PusherClient["Pusher JS (Websocket)"]
        CloudinarySDK["Cloudinary Upload"]
    end

    subgraph "Backend (Next.js Edge API)"
        MetaAPI["GET/POST /api/party & /api/songs"]
        MongoClient["MongoDB Native Driver"]
        PusherServer["Pusher Node Server"]
    end

    subgraph "Cloud Infrastructure"
        Atlas[("MongoDB Atlas")]
        PusherCloud(("Pusher Channels"))
        Cloudinary[("Cloudinary Media")]
    end

    User --> UI
    UI --> Visualizer
    UI --> CloudinarySDK --> Cloudinary
    UI --> MetaAPI
    UI --> PusherClient
    
    PusherClient -- "Client Event Sync" --> PusherCloud
    PusherCloud -- "Zero-Latency Ping" --> Guest
    
    MetaAPI --> MongoClient --> Atlas
    MetaAPI --> PusherServer --> PusherCloud
Loading

๐Ÿ› ๏ธ Tech Stack

  • Framework: Next.js 16 (App Router + Turbopack)
  • Styling: Vanilla CSS, Tailwind & Framer Motion
  • Database: MongoDB Atlas
  • Storage: Cloudinary (Large Media)
  • Real-Time: Pusher (Pub/Sub)
  • Deployment: Vercel

๐Ÿ“ฆ Getting Started

Quick Start

  1. npm install
  2. Set up your .env (MongoDB, Pusher, Cloudinary).
  3. npm run dev

๐Ÿ“„ License

MIT License. Developed with โค๏ธ by CodeWithBasu

About

RhythmX is a powerful real-time music visualizer that transforms audio into a dynamic visual experience. Upload your favorite MP3, hit play, and watch vibrant frequency bars dance to every beat in perfect sync. ๐ŸŽถโœจ Built with modern web technologies, RhythmX blends smooth animations, real-time audio processing, and an interactive UI.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages