Lain Wave: Offline High-Fidelity (FLAC) Audio Player
A subscription-free, strictly local desktop digital music library built on Tauri and SvelteKit, engineered for high-fidelity (FLAC) media archiving and offline playback.
Tech stack
- Languages
- Frameworks & libraries
Performance & metrics
- Prevents frontend lockups by offloading CPU-bound operations (media encoding, AI inference) to isolated Tokio thread pools
- Utilizes hardware-accelerated, C++ GGML-based execution for Whisper model inference to minimize RAM overhead
- Implements aggressive database indexing and connection caching to ensure zero-latency library queries across thousands of FLAC files
Why I built it
Modern audio consumption is heavily centralized around cloud-based, DRM-locked, and subscription-dependent services like Spotify or Apple Music. I engineered Lain Wave as a direct countermeasure. The objective was to build a highly optimized, telemetry-free, 100% free local-first client that puts users back in control of their data, focusing strictly on high-fidelity (FLAC) archiving without requiring constant internet connectivity.
Architecture & decisions
The application bridges a SvelteKit file-based routing frontend (/playlist/[id], /artist/[name]) with a low-level Tauri Rust backend. The persistence layer utilizes rusqlite wrapped in an Arc<Mutex<Connection>> to ensure thread-safe concurrent database access. Heavy I/O operations (YouTube scraping, FFmpeg encoding) are strictly isolated within tauri::async_runtime::spawn_blocking tasks to prevent UI thread starvation. External binaries (yt-dlp, FFmpeg) are orchestrated via std::process::Command using piped stdout buffers, injecting Windows-specific creation flags (0x08000000) for headless, stealth execution. Additionally, local AI lyric generation is achieved without cloud APIs by running a C++ GGML Whisper model directly in memory via the whisper_rs bindings.
Key features
- 01Asynchronous media scraping, ID3 tag injection, and lossless FLAC conversion from YouTube architectures
- 02On-device, local inference via Whisper AI for automated SRT lyric generation and synchronization
- 03Lightning-fast local library, artist, and playlist management via a thread-safe SQLite persistence layer
- 04System-level global media hotkey integration (
tauri_plugin_global_shortcut) - 05Asynchronous state management for real-time Discord Rich Presence (RPC) telemetry
Technical review
This project is a testament to resilient 'local-first' software engineering. The application executes completely offline post-download. Raw audio is transcoded on-the-fly to pcm_s16le format via the hound library and piped directly into the localized Whisper model for lyric generation. For database portability, the JSON-based backup and restore protocols utilize strict SQLite transactional boundaries (tx.execute) to guarantee ACID compliance during massive bulk-insert operations.