Skip to content

Arunteja27/Vibe-ify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎡 Vibe-ify

A low-latency C++ music engine with real-time DSP effects, FFT spectrum analysis, YouTube integration, and a REST API. All built from scratch with raw pointers, manual memory management, and zero external libraries.

See demo of the engine features served via the REST API, showcased on a simple testUI.html file (UNMUTE video below!).

vibeify-demo.mp4

Features

πŸŽ›οΈ Real-Time DSP Effects

Five chainable audio effects processed in real-time on the PCM buffer:

Effect Command Range Description
Echo echo <0-100> Delay-based echo with feedback Configurable delay line
Reverb reverb <0-100> Multi-tap room simulation Simulates acoustic space
Bass Boost bass <0-100> Low-frequency amplification Single-pole IIR filter
Distortion distort <0-100> Hard/soft clipping Waveshaper with tanh curve
Speed speed <25-400> Playback speed (%) Linear interpolation resampler

Effects are applied in a dynamic chain: Source β†’ Speed β†’ Bass β†’ Echo β†’ Reverb β†’ Distortion β†’ Volume

πŸ“Š FFT Spectrum Analyzer

  • Cooley-Tukey radix-2 FFT (1024-point)
  • Hann window to reduce spectral leakage
  • 64 frequency bands with logarithmic distribution
  • Real-time analysis on every audio buffer
  • ASCII visualizer in CLI, JSON array via API

▢️ YouTube Integration

Search and play music from YouTube directly:

  • Powered by yt-dlp + ffmpeg (auto-detected at startup)
  • Downloads as 44.1kHz stereo 16-bit WAV
  • File caching in media/cache/ (skips re-download)
  • Auto-saves to media/samples/ for persistent library

🌐 REST API Server

Raw Winsock2 HTTP server on localhost:8080, running alongside the CLI on a separate thread. Full CORS support for browser frontends.

GET Endpoints

Endpoint Description
/api/tracks List all loaded tracks
/api/now Current playback status
/api/spectrum 64-band frequency data (JSON array)
/api/effects Current effect levels

POST Endpoints

Endpoint Body Description
/api/play {"id": 1} Play track by ID
/api/pause β€” Pause playback
/api/resume β€” Resume playback
/api/stop β€” Stop playback
/api/volume {"level": 75} Set volume (0-100)
/api/effects {"bass": 50, "echo": 30} Set effect levels
/api/effects {"clear": "true"} Reset all effects
/api/yt/search {"query": "song name"} Search YouTube
/api/yt/play {"index": 1} Play from search results
/api/search {"query": "artist"} Search local library

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  main.cc                     β”‚
β”‚     CLI (PlaybackController) + HTTP Server   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   Terminal    β”‚     REST API (port 8080)     β”‚
β”‚   Commands    β”‚     ApiController            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                AudioEngine                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚  Effect Chain (dynamic rebuild)         β”‚ β”‚
β”‚  β”‚  Source β†’ Speed β†’ Bass β†’ Echo β†’         β”‚ β”‚
β”‚  β”‚  Reverb β†’ Distortion β†’ Volume           β”‚ β”‚
β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚
β”‚  β”‚  SpectrumAnalyzer (FFT on each buffer)  β”‚ β”‚
β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚
β”‚  β”‚  Windows WaveOut (double-buffered PCM)  β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  TrackLibrary ← WAV files (media/samples/)   β”‚
β”‚  YouTubeSource ← yt-dlp (media/cache/)       β”‚
β”‚  StreamCache ← persistent download manager   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Build

Requirements: MinGW g++ (C++17), Windows

mingw32-make clean
mingw32-make

Optional (for YouTube):

winget install yt-dlp
winget install ffmpeg

Usage

.\vibeify.exe

The engine starts both the CLI and the API server on port 8080.

CLI Commands

Playback:     play <id>, pause, resume, stop, skip, prev
Queue:        queue <id>, list, now, search <query>
Effects:      echo <0-100>, reverb <0-100>, bass <0-100>
              distort <0-100>, speed <25-400>
              effects, clear, spectrum
YouTube:      yt-search <query>, yt-play <1-5>
General:      help, quit

API Examples

# List tracks
curl http://localhost:8080/api/tracks

# Play track 1
curl -X POST http://localhost:8080/api/play -d "{\"id\": 1}"

# Bass boost + echo
curl -X POST http://localhost:8080/api/effects -d "{\"bass\": 60, \"echo\": 40}"

# Get spectrum data
curl http://localhost:8080/api/spectrum

# Search YouTube
curl -X POST http://localhost:8080/api/yt/search -d "{\"query\": \"lofi beats\"}"

# Play first result
curl -X POST http://localhost:8080/api/yt/play -d "{\"index\": 1}"

File Structure

β”œβ”€β”€ main.cc                 Entry point, starts CLI + API server
β”œβ”€β”€ AudioEngine.h/.cc       Core audio renderer (WaveOut, effect chain, FFT)
β”œβ”€β”€ AudioNode.h             Base class for all audio sources
β”œβ”€β”€ AudioEffect.h/.cc       DSP effects (Echo, Reverb, Bass, Distortion, Speed)
β”œβ”€β”€ AudioBuffer.h           Float PCM buffer with clamping
β”œβ”€β”€ SpectrumAnalyzer.h/.cc  Cooley-Tukey FFT, Hann window, frequency bands
β”œβ”€β”€ Track.h/.cc             WAV file loader and PCM source
β”œβ”€β”€ Playlist.h/.cc          Double-linked-list track queue
β”œβ”€β”€ TrackLibrary.h/.cc      Raw pointer array track collection
β”œβ”€β”€ PlaybackController.h/.cc  Terminal CLI interface
β”œβ”€β”€ HttpServer.h/.cc        Raw Winsock2 HTTP server (threaded)
β”œβ”€β”€ ApiController.h/.cc     REST endpoint router with JSON I/O
β”œβ”€β”€ YouTubeSource.h/.cc     yt-dlp wrapper (search + WAV download)
β”œβ”€β”€ StreamCache.h/.cc       Download cache manager
β”œβ”€β”€ WavGenerator.h          Procedural waveform generator (sine, square, saw)
β”œβ”€β”€ Makefile                MinGW build system
└── media/
    β”œβ”€β”€ samples/            Persistent WAV library (auto-loaded on startup)
    └── cache/              YouTube download cache

Technical Highlights

  • Zero external libraries - raw Win32 API (WaveOut, Winsock2), manual everything
  • Raw pointer memory management - new/delete, no smart pointers, no STL containers for core data
  • Double-buffered audio - callback-driven WaveOut with two alternating PCM buffers
  • Dynamic effect chain - rebuilds on parameter change, only active effects are processed
  • In-place FFT - Cooley-Tukey butterfly with bit-reversal permutation
  • Hand-rolled HTTP - raw TCP socket, manual HTTP parsing, JSON building
  • Dual interface - CLI and REST API control the same engine instance simultaneously

About

A low-latency C++ music engine (DSP, FFT analysis, REST API)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors