A Shazam-like web application I created that identifies songs in real-time using the device's microphone. I built this with React, Vite, Tailwind CSS, and integrated multiple music APIs to create a complete song recognition experience.
- π€ Real-time Audio Recognition - 10-second recording with ACRCloud fingerprinting
- πΆ File Upload - Drag & drop audio files (MP3, WAV, M4A, FLAC, OGG)
- π Gothic UI Theme - Dark Opium/Carti aesthetic with Aceternity components
- π Interactive Background - Mouse-tracking effects, floating crosses, blood drip animations
- π Audio Visualizer - Real-time frequency bars with dark red theme
- π΅ Multi-Platform Integration - Direct links to Spotify and YouTube
- π± Fully Responsive - Works seamlessly on mobile and desktop
- β‘ Lightning Fast - Built with Vite
- React 18 - UI library
- Vite - Build tool and dev server
- Tailwind CSS - Utility-first CSS framework
- Framer Motion - Smooth animations
- Aceternity UI - Modern UI components (BackgroundBeams, HoverBorderGradient, Cards)
- ACRCloud - Audio fingerprinting and recognition
- Spotify Web API - Song metadata and album art
- YouTube Data API - Music video links
- Web Audio API - Microphone access and audio processing
- MediaRecorder API - Audio recording
- Canvas API - Audio visualization
- Node.js (v18 or higher)
- npm or yarn
- Modern browser with microphone support
npm installI configured three different APIs for this project. You'll need to create accounts and get your own API keys from:
- Sign up at ACRCloud Console
- Create a new project (choose "Audio & Video Recognition")
- Get your Host, Access Key, and Access Secret
- Go to Spotify Developer Dashboard
- Create a new app
- Copy your Client ID and Client Secret
- Go to Google Cloud Console
- Create a new project
- Enable "YouTube Data API v3"
- Create credentials (API Key)
Create a .env file in the root directory:
cp .env.example .envEdit .env and add your credentials:
VITE_ACRCLOUD_HOST=your-host.acrcloud.com
VITE_ACRCLOUD_ACCESS_KEY=your_access_key
VITE_ACRCLOUD_ACCESS_SECRET=your_access_secret
VITE_SPOTIFY_CLIENT_ID=your_client_id
VITE_SPOTIFY_CLIENT_SECRET=your_client_secret
VITE_YOUTUBE_API_KEY=your_api_keynpm run devOpen http://localhost:5173 in your browser.
-
Audio Capture
- Uses
getUserMedia()to access the microphone - Records 10 seconds of audio using MediaRecorder API
- Alternatively, upload audio files via drag & drop
- Applies noise suppression and echo cancellation
- Uses
-
Audio Fingerprinting
- Sends audio to ACRCloud
- ACRCloud creates a unique "fingerprint" of the audio
- Compares it against millions of songs in their database
-
Metadata Enrichment
- Fetches album art and preview from Spotify API
- Searches for music video on YouTube
- Combines all data for display
-
Display Results
- Shows song card with beautiful animations
- Provides direct links to Spotify and YouTube
The visualizer uses the Web Audio API's AnalyserNode:
- Performs FFT (Fast Fourier Transform) on audio data
- Extracts frequency bands (bass, mids, treble)
- Maps frequency values (0-255) to bar heights
- Updates 60 times per second using
requestAnimationFrame
| Browser | Desktop | Mobile |
|---|---|---|
| Chrome | β | β |
| Firefox | β | β |
| Safari | β | β |
| Edge | β | β |
Note: Microphone access requires HTTPS in production.
- Real-time frequency visualization
- Gradient-colored bars
- Smooth Canvas rendering
- Glassmorphic design
- Album art with scale animation
- Confidence score badge
- Action buttons with hover effects
- Three states: idle, listening, processing
- Pulsing animation when active
- Loading spinner during recognition
opxm/
βββ src/
β βββ components/
β β βββ AudioVisualizer.jsx # Audio frequency visualizer
β β βββ SongCard.jsx # Song result display
β βββ services/
β β βββ recognitionService.js # ACRCloud integration
β β βββ spotifyService.js # Spotify API calls
β β βββ youtubeService.js # YouTube API calls
β βββ utils/
β β βββ audioRecorder.js # Audio recording logic
β βββ App.jsx # Main application
β βββ index.css # Global styles
β βββ main.jsx # Entry point
βββ .env.example # Environment template
βββ tailwind.config.js # Tailwind configuration
βββ vite.config.js # Vite configuration
βββ package.json
- Check browser permissions
- Ensure you're using HTTPS (required in production)
- Try a different browser
- Play the song louder
- Move microphone closer to the speaker
- Ensure 6 seconds of clear audio
- Try a different song (some songs may not be in the database)
- Verify your API credentials in
.env - Check API quotas (free tiers have limits)
- Ensure all three APIs are properly configured
MIT License - feel free to use this project for learning or commercial purposes.
- ACRCloud - Audio recognition technology
- Spotify - Music metadata
- YouTube - Video links
- Tailwind CSS - Styling
- Framer Motion - Animations
Enjoy discovering music with Opxm! π΅