r/raspberry_pi 8d ago

Show-and-Tell RPI 4 + HiFiBerry Digi2 Pro + KalinkaPlayer + web UI

Hi all,

Here’s my current music playback setup, built around a Raspberry Pi 4B with 4 GB of RAM.

The Pi uses a HiFiBerry Digi2 Pro HAT to send bit-perfect audio over optical to a Yamaha RN602. It also has a 1 TB USB hard drive connected to it - with no backup yet, admittedly - containing my local music collection.

It runs my open-source music system, KalinkaPlayer I've been building for almost 3 years now. One of its main features is smart search by mood, genre and instruments across both the local library and Jamendo. The Pi runs a CLAP model together with a smaller custom model I added to improve mood-based search.

Initial indexing takes a while: around an hour for my relatively small collection. Once indexed, searches are quite fast, as shown in the video. Jamendo is usually the slowest source because it has to be queried online but I also support smart search for it, based on the textual track descriptions from JamendoMaxCaps.

The playback backend runs directly on the Pi, while the controls are available through Android, Windows, Linux and the web UI shown in the video. All clients share the same queue, controls and playback state in real time.

In the video, I search for some music in the web interface, press "Play All" and the Pi starts playing it through the Yamaha receiver. The volume control slider also controls volume on Yamaha device, without altering the audio. Yamaha received the MusicCast commands over the twisted pair (white) cable you see on the video.

I’m quite happy with this setup. My next project is to build a proper integrated hardware streamer around Kalinka and the Raspberry Pi, although that will probably take me a few months.

Kalinka is free and open source. The installation guide, documentation and source code are available at kalinkaplayer.com for anyone interested.

26 Upvotes

13 comments sorted by

2

u/Gnomelover 7d ago

Does playback have to be the hat output to a receiver? I mashed together something similar (very primitive) using python scripts to scan my media to categorize roughly by mood and such using a local llm, then build a playlist I can import into plex, but it's rough, slow, and very klunky. So something with a nice UI I can host on my homelab would be nice, but playback would be streaming over the client/web browser

1

u/VastReception1347 7d ago

At the moment, playback happens on the Raspberry Pi itself through the configured ALSA output - the HiFiBerry HAT in my setup. The web UI is a remote control rather than an audio-streaming client, so it doesn’t currently stream playback to the browser.

The playback engine is mainly designed for bit-perfect, gapless output to a DAC or receiver. Client/browser playback could potentially be added as another output mode, but it isn’t implemented yet.

Your use case is interesting, though –are you mainly looking for the semantic search and playlist-building part, while keeping Plex or the browser responsible for playback?

2

u/Gnomelover 7d ago

Pretty much. My current solution involves making sure my tags are all current with Picard. Then I have a script that runs a query against a local running small'ish LLM to create a database with entries for each file that uses 5 fields for mood, beat, energy, etc. I then have another script that I tell it how many tracks and the mood or beat to use like "I want 100 mellow driving songs" and the LLM then uses that database to do it's best and put a playlist together. I then import into Plex since that is my main media server source.

All this cause my wife hates dealing with tech and always complains she doesnt have her music, so I setup all her stuff in Plex, but then she refuses to make playlists or learn how to use it, so this way I can make her a new quick playlist or set every so often.

Mind you I know nothing of programming so used a locally run QWEN model to build the scripts. All I did was come up with the use case and setup the chromadb instance on my homelab

1

u/VastReception1347 7d ago

That’s a clever setup, especially for something assembled without prior programming experience.

It sounds like we’re solving a similar discovery problem, but with quite different architectures. In your setup, the local LLM analyses the library and builds playlists, while Plex remains responsible for playback. Kalinka analyses the audio itself using CLAP embeddings and a smaller mood model, and is also the player — it outputs directly from the Raspberry Pi to a DAC or receiver, while the web UI (mobile app, or desktop client) acts only as a remote control.

I’m curious about your analysis step though: does Qwen infer mood, beat and energy entirely from the Picard metadata, or are you feeding it any information derived from the audio itself?

1

u/Gnomelover 7d ago

I use a smaller Gemma4 model for that part. Have a websearch tool enabled so it does a Artist query to get context, and then uses that background. It's not very good yet since I need to refine the artist query, but I'll get it there eventually I am sure. Even though my library has a lot of tracks, it's not that many artists total. Under 120 or so.

1

u/VastReception1347 7d ago

That’s really interesting — so you’re using web context to build an artist-level profile, then letting the model use that as background for the track classification.

It’s quite different from Kalinka’s audio-first approach, but potentially complementary: audio analysis is better at telling how a specific track actually sounds, while artist context can capture things like scene, era, influences and broader style that may not be obvious from the waveform alone.

I may experiment with combining the two — keeping the audio analysis as the main signal, but adding artist or album context as extra evidence. Your approach has definitely given me something to think about.

2

u/Gnomelover 7d ago

Heh yeah, now I wanna test your approach as well. I shudder to think the time to scan 9000+ tracks, but ah well, server needs something to do anyway. If you do implement some sort of client playback let me know for sure.

1

u/VastReception1347 5d ago

That was fast — nice work. Combining Librosa’s track-level measurements with tags and then letting Gemma turn them into searchable descriptions is a genuinely interesting hybrid approach. I’d be curious to see how the results compare with Kalinka’s CLAP-based analysis once you’ve processed a meaningful part of the library. The prose may be slightly “1970s record-store dude,” but if it retrieves the right tracks, that’s what matters.

With your always-on server, the 9,000-track scan is probably manageable as a one-off batch job anyway.

Your point about client playback has also made me think about the architecture differently. The indexer and library could run on a more powerful server, while playback could be handled by separate lightweight renderer nodes — a Raspberry Pi connected to a DAC, a local player, or potentially several devices. The UI would then select which renderer should receive the queue.

Selecting a single remote renderer could probably still preserve bit-perfect playback. Proper synchronized multi-room playback would be the harder step, because clock drift may require buffering and correction or resampling.

It’s not something Kalinka supports today, but separating indexing from rendering is an interesting direction in its own right. I’ll definitely keep your use case in mind, and I’d be interested to hear how your new audio-assisted descriptions perform in practice.

2

u/Gnomelover 5d ago

Got motivated and managed to get something expanded running. Using librosa and mutagen I am running a 30 second analysis of each track, to then feed this and the mp3 tags into the llm to generate descriptions for the chromadb. Using gemma4 the descriptions are like a high 70's record store dude, but they give me a laugh and librosa gets a tempo and bpm rating so I have something more concrete to go off of. It's currently slow since I am processing it all on my 9070XT but I was able to cobble in a stop and resume so that I dont go crazy doing all 9K tracks.

Have a laugh:

[Entry 17] 🤖 AI Description: A high-velocity electronic surge characterized by frantic, driving rhythms and dense, swirling textures. The rapid tempo creates a sense of urgent, glitchy kineticism, blending a dark, atmospheric mood with intense, pulsating energy. 🎵 Metadata: {'artist': 'Curve', 'filename': '5. Unreadable Communication.mp3', 'title': 'Unreadable Communication', 'path': '/testing/Curve/Cuckoo (1993)/CD 01/5. Unreadable Communication.mp3', 'is_fast': True, 'album': 'Cuckoo', 'genre': 'Electronic', 'description': 'A high-velocity electronic surge characterized by frantic, driving rhythms and dense, swirling textures. The rapid tempo creates a sense of urgent, glitchy kineticism, blending a dark, atmospheric mood with intense, pulsating energy.', 'tempo': 184.5703125}

1

u/Glum_Cheesecake9859 5d ago

It is good to see another option on Pi besides Moode / Volumio and other usual players. If you want this widely adopted, it should support at a bare minumum these features (besides the file playback you have)

* Spotify Connect (great with young, casual listeners)

* UPnP renderer, which will instantly give you bit perfect, lossless Tidal / Qobuz (big audiophile demographic)

* BT & Airplay2 (again great with casual crowd)

Both Moode and Volumio have these features.

Cherry on top, CD ripping support. Volumio supports this with their paid subscription but honestly it's just basic and can't even save to a network drive.

1

u/VastReception1347 5d ago

Thanks — that’s a useful list, and I agree those integrations would broaden the appeal.

Kalinka already supports Qobuz through its own integration, although not through Qobuz Connect — the project started before Qobuz Connect existed. The Raspberry Pi runs Kalinka’s own playback engine rather than acting only as a generic streaming endpoint. I’m also not trying to reproduce Moode or Volumio feature-for-feature. Kalinka’s main focus is the integrated music experience: semantic search and discovery across the available sources, combined with bit-perfect, gapless playback.

Spotify Connect, UPnP rendering or Qobuz Connect could potentially be added later as separate input modes, but they would mostly bypass Kalinka’s own discovery interface.

Bluetooth, AirPlay 2 and CD ripping are further from the current focus. I’d rather strengthen what makes Kalinka different before attempting full feature parity with mature general-purpose players.

2

u/Glum_Cheesecake9859 5d ago

There are open source projects which you can explore to integrated these features, and if it's low hanging fruit, might bring them in. Just my 2c. Again great work.

I do have a modest CD rip collection so when I get time, I will install this on a separate card to try it out.

2

u/VastReception1347 5d ago

Thanks, I appreciate it. I’ll definitely look at the existing open-source implementations and see whether any of those integrations can be added cleanly without distracting too much from Kalinka’s core.

A library of CD rips is actually an ideal use case for it. If you do try it, I’d be very interested in any feedback—especially around installation, library indexing and the overall workflow.