01. The local-first philosophy: your music belongs to you

In today's media landscape, users have been pushed into a forced rental relationship: monthly subscriptions, catalogues that vanish over licensing disputes, invasive telemetry tracking every second you listen, and desktop apps that are really packaged Chromium browsers eating 800 MB of RAM while idle.

Davusic was born as a direct response to that technical decline. Designed as the natural, refined successor to my earlier media projects (such as the hi-fi audio engine I built for Dabot on Discord), Davusic takes an uncompromisingly local-first approach:

  • Full data ownership: your music library, playlists, liked songs, playback history and preference weights are stored only locally (in open JSON and SQLite formats). No proprietary servers, no mandatory accounts and no cloud analytics.
  • Lightweight references, not compulsive downloads: imported playlists keep the essential metadata (title, artist, album, search identifiers). Audio is resolved in real time through on-demand streaming and kept in a bounded temporary cache, so you don't have to fill your drive with hundreds of unnecessary gigabytes.
  • Native efficiency: built in Rust for instant start-up (<100 ms), under 60 MB of memory while playing and imperceptible audio latency.
The guiding principle
If your internet connection drops or a third-party service changes its business terms, your local music keeps playing, your playlists stay organised on your drive and your privacy remains completely intact.

02. System architecture: Tauri 2 + Rust vs Chromium/Electron

The most important design decision was ditching Electron. Embedding a full instance of V8, Blink and a web renderer just to decode audio and draw a list is an unacceptable waste of system resources.

I went with Tauri v2, a Rust 1.85+ backend and a static zero-bundler frontend. There's no package.json, no webpack, no Vite and no Node.js at runtime: the web files (semantic HTML, pure reactive CSS and native JavaScript) are compiled and embedded as binary assets directly inside the final executable.

Frontend layer (zero bundler · embedded in the binary)
index.html Reactive HUD shell, 5 visual themes, zero npm dependencies
styles.css CSS variables, Grid/Flexbox layout, high-DPI support
app.js State manager, view engine, keyboard shortcuts
IPC & security layer (Tauri 2 core)
Secure protocols cover:// and wallpaper:// with sandbox isolation
Type-safe IPC Invocable Rust commands with serde JSON serialisation
Strict CSP No eval injection, script-src 'self' and restricted CDNs
Native backend layer (Rust 2024 / multithreading)
audio.rs rodio 0.23 + Symphonia decoders on a high-priority thread
youtube.rs yt-dlp orchestration, streaming & cache pruning
library.rs Lofty ID3 indexer for FLAC, MP3, Opus, M4A, WAV
mpris.rs MPRIS D-Bus server (io.github.davo.davusic)
Performance metric Typical Electron player Davusic (Tauri 2 + Rust)
Idle RAM usage ~350 MB – 850 MB 35 MB – 58 MB
Cold start time 1.8 s – 4.2 s < 95 ms
Executable size 180 MB – 240 MB ~14 MB (stripped binary)
Web rendering Bundled monolithic Chromium WebKitGTK (Linux) / WebView2 (Windows)
Audio pipeline HTML5 Audio / WebAudio (via Chromium) Native ALSA / PipeWire (rodio)

03. Native audio engine: rodio, Symphonia and Lofty

One of the chronic problems of Chromium-based players is handing playback to the browser's <audio> element, which adds unwanted resampling layers, inconsistent buffering and hiccups whenever the main JavaScript thread is busy with heavy animations.

In Davusic, audio lives entirely in a dedicated Rust thread called davusic-audio. I used the rodio 0.23 crate together with the full set of Symphonia decoders.

src/audio.rs — native sink and decoder initialisation
// Desacoplamiento del hilo de audio con rodio y Symphonia
use rodio::{Decoder, OutputStream, Sink};
use std::fs::File;
use std::io::BufReader;
use std::sync::atomic::{AtomicU64, Ordering};

/// Generador atómico para anular reproducciones concurrentes atrasadas
static PLAY_GENERATION: AtomicU64 = AtomicU64::new(0);

pub struct AudioEngine {
    _stream: OutputStream,
    stream_handle: rodio::OutputStreamHandle,
    sink: Sink,
}

impl AudioEngine {
    pub fn new() -> Result<Self, String> {
        let (_stream, stream_handle) = OutputStream::try_default()
            .map_err(|e| format!("Fallo al inicializar endpoint de audio ALSA/PipeWire: {}", e))?;
        let sink = Sink::try_new(&stream_handle)
            .map_err(|e| format!("Fallo creando rodio Sink: {}", e))?;
        
        Ok(Self { _stream, stream_handle, sink })
    }

    pub fn play_file(&mut self, path: &std::path::Path) -> Result<(), String> {
        let file = File::open(path).map_err(|e| e.to_string())?;
        let source = Decoder::new(BufReader::new(file))
            .map_err(|e| format!("Codec no soportado por Symphonia: {}", e))?;
        
        self.sink.stop();
        self.sink.append(source);
        self.sink.play();
        Ok(())
    }
}

Preventing race conditions with atomic generations

When a user quickly clicks five songs in a row, a naive player would launch five concurrent async tasks. If the third download or read takes longer than the fifth, the third could overwrite the final playback and the wrong song would start.

To solve this cleanly, I added play_generation: AtomicU64. Every play request increments the counter. When the backend finishes preparing the audio buffer or stream, it checks whether its generation still matches the current one. If it doesn't, it aborts straight away and discards the stale audio without blocking the CPU.

Very fast metadata indexing with Lofty

To scan local libraries I used the lofty 0.25 crate. Unlike tag readers that shell out to ffmpeg or rely on heavy C libraries, Lofty reads file headers directly in memory:

  • Supported formats: FLAC, MP3 (ID3v1, ID3v2.3, ID3v2.4), OGG Vorbis, Opus, M4A/AAC, WAV, AIFF and WavPack.
  • Embedded artwork: zero-copy extraction of JPEG/PNG covers through the custom cover:// protocol, so no duplicate temporary files are written to disk.
  • Performance: more than 12,000 local tracks scanned in just 3.8 seconds on an NVMe SSD under Linux.

04. Ephemeral streaming and smart caching with yt-dlp

Davusic doesn't need every song to be downloaded to your drive beforehand. If you search for a song that isn't in your local library, or import a playlist from an external service, the youtube.rs subsystem takes over.

Under the hood, Davusic drives yt-dlp with tightly controlled process management:

  1. Unified search: typing in the search bar (Ctrl + K) fires two parallel threads: an instant search of the local database and a query to YouTube Music / YouTube (ytsearch12: artist song).
  2. On-demand resolution: when you play a remote track, Davusic runs yt-dlp asking only for the best audio-only stream (-f bestaudio/best -x).
  3. Ephemeral storage: the audio is written straight to the user's cache directory:
    ~/.cache/davusic/streams/<video_id>.opus (on Linux) or %LOCALAPPDATA%\davusic\cache\ (on Windows).
  4. Automatic cache pruning: so it never quietly fills your disk, Davusic includes a configurable garbage collector (LRU cache pruning) that automatically deletes downloaded files once they exceed the maximum quota (2 GB by default) or haven't been played for more than 30 days.
yt-dlp auto-provisioning
If the user doesn't have yt-dlp installed on their system, Davusic doesn't fail with a cryptic error: it downloads the official, verified binary from the GitHub releases by itself and places it in ~/.local/share/davusic/bin/yt-dlp, making it executable automatically.

05. Spotify's legal boundary & universal import with Exportify

Many unofficial music clients make the serious mistake of trying to bypass Spotify's DRM, extract Widevine keys or use libraries such as librespot, which break the terms of service and often get user accounts banned.

Davusic draws a firm legal line:

  • No DRM circumvention: Davusic never plays audio from Spotify's servers, doesn't use the Web Playback SDK and doesn't read cookies from other apps installed on your computer.
  • Official OAuth 2.0 PKCE: the Spotify integration is 100% official, using the Proof Key for Code Exchange standard (RFC 7636). The flow only asks for read permissions: playlist-read-private, playlist-read-collaborative and user-library-read.
  • Protected tokens: the session token is stored in ~/.config/davusic/spotify.json with strict Unix 0600 permissions (read/write for the owner only).

Native Exportify integration and multiple sources

For users who don't want to link their Spotify account through OAuth, Davusic includes a universal playlist parser in playlist_import.rs:

Supported import & export formats
# Formatos reconocidos por el motor de importación:
[1] Exportify ZIP / CSV  -> Exportación estándar de Spotify con cabeceras completas
[2] Google Takeout       -> CSV / TSV extraídos de YouTube Music
[3] M3U / M3U8 Estándar  -> Listas de reproducción de reproductores de escritorio clásicos
[4] JSON Estructurado    -> Esquema nativo Davusic de listas compartidas
[5] Texto Plano (Raw)    -> Listas en formato "Artista - Canción" pegadas a mano

Davusic can also go the other way: the Export to Exportify feature creates a ZIP with one CSV per playlist and normalised columns (Track Name, Artist Name(s), Album Name, Duration (ms), Track URI, Playlist Name), so you can move your collection to any other platform with no vendor lock-in.

Update (v0.1.2): the Exportify tab is now assisted. Davusic opens exportify.net, watches your downloads folder and, as soon as the CSV or ZIP appears, recognises it by its headers and opens it so you can choose which playlists to bring in, album artwork included. It's the recommended route if you don't have Premium, because it doesn't require creating a Spotify Developer app. This version also picks better matches for each song (title, artist and duration against YouTube and YouTube Music), preloads the next track in the queue and scans the library incrementally.

06. Live lyrics with LRCLIB and a local recommendation algorithm

The player fully supports song lyrics through the open LRCLIB API. When a track starts playing:

  1. The backend queries LRCLIB with the title, artist, album and exact duration in seconds.
  2. If timestamps are available ([mm:ss.xx] format), Davusic parses the synced lyrics (LRC).
  3. In the immersive view, the lines scroll automatically in sync with rodio playback. Click any line and the player instantly seeks to that exact position.

The “For you” engine: local, private machine learning

The For you section builds music recommendations without sending your habits to any server. Every time you listen to a whole song (+1 point), add it to your likes (+3 points), skip it in the first 15 seconds (−2 points) or keep searching for an artist, Davusic updates a local affinity matrix of genres and artists.

When your queue runs out, Davusic switches on Auto Radio: it generates an endless queue based on your local affinity profile, chaining related tracks from your library or from streaming suggestions.

07. Linux desktop integration: D-Bus MPRIS and Wayland (Niri)

One of the most neglected aspects of cross-platform players is integration with the Linux ecosystem. Davusic implements the full MPRIS v2 specification (Media Player Remote Interfacing Specification) over D-Bus using the mpris-server crate.

This gives you:

  • Full control from your keyboard's media keys (play, pause, next, previous, stop).
  • Integration with native Wayland status bars such as Waybar or KDE Plasma / GNOME Shell widgets.
  • High-resolution artwork in system notifications and on the lock screen.
  • Two-way volume control and position scrubbing from tools like playerctl:
Controlling Davusic with playerctl on Linux
# Comprobar estado del reproductor Davusic
$ playerctl --player=davusic status
Playing

# Obtener metadatos de la pista actual
$ playerctl --player=davusic metadata --format "{{ artist }} - {{ title }} ({{ duration(position) }} / {{ duration(mpris:length) }})"
Cyberpunk Ambient - Night City Rain (01:42 / 04:15)

# Saltar a una posición específica mediante D-Bus
$ playerctl --player=davusic position 120

Tuned for the Niri scrollable window manager

Davusic ships a dedicated configuration for the Niri Wayland window manager on CachyOS. The installer automatically sets up the window rule in ~/.config/niri/davusic.kdl so the app opens at the ideal size (1480×940) and respects the compositor's rounded corners and shadows.

08. Complete build and installation guide

Davusic is free software released under the MIT licence. You can build it from source or install it from ready-made packages.

1. System dependencies

Installing development packages on Linux
# En Arch Linux / CachyOS / Manjaro:
$ sudo pacman -S --needed base-devel rust webkit2gtk-4.1 gtk3 librsvg pkgconf alsa-lib

# En Debian / Ubuntu / Linux Mint:
$ sudo apt-get install -y \
  build-essential pkg-config \
  libwebkit2gtk-4.1-dev libgtk-3-dev \
  libayatana-appindicator3-dev librsvg2-dev \
  libasound2-dev patchelf

2. Clone the repository and build

Native build with Cargo
# Clonar el repositorio oficial
$ git clone https://github.com/davito-03/davusic.git
$ cd davusic

# Ejecutar los tests de Rust y validación de UI
$ cargo test

# Compilar binario optimizado en modo release
$ cargo build --release

3. Quick install for the current user

The repository includes an automated install.sh script that installs the binary to ~/.local/bin/davusic, creates the desktop entry in ~/.local/share/applications/davusic.desktop, registers the icons in every size and sets up the Niri rule:

Local deployment with a single command
$ ./scripts/install.sh
==> Instalando Davusic en ~/.local/bin/davusic...
==> Copiando iconos a ~/.local/share/icons/hicolor/...
==> Registrando davusic.desktop y actualizando base de datos de escritorio...
==> Regla Niri actualizada en ~/.config/niri/davusic.kdl
==> ¡Instalación completada con éxito! Ya puedes lanzar 'davusic'.

4. Building .deb and AppImage packages

If you'd rather build self-contained packages for your distribution, use cargo-tauri:

Official packaging with the Tauri CLI
$ cargo tauri build --bundles deb,appimage
# Los paquetes generados quedarán en:
target/release/bundle/deb/davusic_0.1.2_amd64.deb
target/release/bundle/appimage/davusic_0.1.2_amd64.AppImage

5. Visual identity & cross-platform icon generation

Version 0.1.1 introduces Davito's own visual identity in Davusic (the lobster-cat concept, combining the cyber cat and the lobster from the Dabot ecosystem with studio headphones). The icon is designed as a scalable vector in assets/icon.svg, and an automated script builds every PNG size, the Windows .ico file and the Android mipmaps:

scripts/make-icon.sh — cross-platform icon build
$ ./scripts/make-icon.sh
==> Generando PNGs (32x32, 128x128, 256x256, 512x512, 1024x1024)...
==> Compilando icon.ico con Tauri CLI...
==> Actualizando mipmaps Android (hdpi, xhdpi, xxhdpi, xxxhdpi)...
==> Iconos actualizados con éxito en assets/icons/ y frontend/assets/logo.png

6. Installing on Windows 10/11

Davusic supports Windows natively through the WebView2 Runtime. You can download the .exe (NSIS) or .msi installers straight from the official GitHub releases, or build from PowerShell with the MSVC toolchain:

PowerShell on Windows
PS > cargo build --release
PS > cargo tauri build
# Genera instaladores en target\release\bundle\nsis\ y bundle\msi\

09. Conclusions & roadmap

Davusic shows that you don't have to give in to Electron's runaway memory use, or hand over control of your personal data, to enjoy a first-class music experience on the desktop. The combination of Tauri 2, the relentless performance of Rust and decoupled services built on proven tools like yt-dlp delivers exactly that: instant speed, strict respect for privacy and long-term technical sustainability.

Next steps on the roadmap
  • 10-band parametric equaliser: implemented in Rust with real-time biquad filters on the rodio stream.
  • Local P2P sync: share playlists and the library between devices on the same local network using mDNS/ZeroConf discovery, with no servers in between.
  • A more mature Android version: bring the native playback engine and offline cache to mobile devices, beyond the current preview.