cafeg: The Android app that latches onto live audio sessions

A foreground service, a broadcast receiver, and Android’s audio effects API combine to add binaural virtualization and reverb directly onto playback sessions.

7 min read · evinjohnn/cafeg

A smartphone is shown like a cutaway machine, with a thin tether jumping from a music app into a hidden internal chamber and then out to earbuds. The image explains the central idea in cafeg: it attaches effects to a live audio session instead of processing sound only inside the app.
cafeg treats a live playback session like a place you can clip effects onto, not a stream you have to own outright.
Key Takeaways

The hidden attach point in Android audio

The surprising thing about cafeg is not that it adds audio effects. It is that it waits for Android to announce a live session, then moves in at that exact moment. The app listens for the broadcast that opens an audio effect control session, captures the session ID, and treats that ID like a handle on the sound itself.

That turns a normal playback event into a control surface. Instead of asking you to route audio through a custom player, the repo follows the system’s own broadcast trail and attaches to whatever app is already talking.

A tight close-up shows one audio stream splitting into two paths, with a small tag hanging off the stream like a clipped badge. One path flows into a device chip while a tiny hook grips the tag itself. The image explains how cafeg binds effects to the session identity, not to a manual playlist or player UI.
The interesting object is not the song. It is the session ID that Android exposes when the song starts playing.

How a session ID turns into sound shaping

The code path is short, which is part of the appeal. AudioSessionReceiver catches the system event, forwards the session ID and package name, and hands them to CafeModeService. The service runs in the foreground so Android is less likely to evict it, which matters when your whole product depends on staying attached to playback.

Inside the service, the session ID becomes the anchor for two effect objects. Virtualizer handles spatial spread, and PresetReverb adds a room-like tail. The app does not remix audio in software. It binds into Android’s own audio effects layer and lets the platform do the work.

private fun attachEffects(sessionId: Int) {
    virtualizer = Virtualizer(0, sessionId).apply {
        enabled = true
        forceVirtualizationMode(Virtualizer.VIRTUALIZATION_MODE_BINAURAL)
    }

    presetReverb = PresetReverb(0, sessionId).apply {
        preset = PresetReverb.PRESET_LARGEROOM
        enabled = true
    }
}

class AudioSessionReceiver : BroadcastReceiver() {
    override fun onReceive(context: Context, intent: Intent) {
        val sessionId = intent.getIntExtra(AudioEffect.EXTRA_AUDIO_SESSION, -1)
        if (sessionId != -1) {
            context.startService(
                Intent(context, CafeModeService::class.java)
                    .putExtra(EXTRA_SESSION_ID, sessionId)
            )
        }
    }
}

The whole system is a loop. Android broadcasts a session, the service attaches effects, and the UI sends parameter updates back into that same chain.

A pair of earbuds faces a circular sound field that expands into a wider oval as if the air around it has been bent. A small mechanical switch sits beside the field, suggesting a deliberate mode choice rather than a generic enhancement. The image explains why binaural virtualization changes the shape of the experience, not just the volume or tone.
The explicit binaural mode call is the tell. This is about spatial perception, not a loudness trick.

Why binaural mode is the real design choice

The standout line in the service is the explicit VIRTUALIZATION_MODE_BINAURAL call. That is not a default setting. It is a point of view. The project is not trying to be a generic equalizer with more knobs. It is trying to make headphones feel larger than they are.

That narrows the promise in a useful way. Binaural processing only makes sense when the listener is wearing headphones, but when it works it changes apparent space rather than just tone. That is why cafeg reads more like a spatial audio experiment than a bass booster in a prettier shell.

A polished control panel floats above a compact engine bay inside a phone, with thin wires linking sliders to hidden dials. The panel looks like a remote control rather than the source of the sound, which explains the app’s separation between UI and service.
The interface is only a control surface. The audio path lives below it, inside the service.

The UI is a remote control, not the engine

MainActivity behaves like a remote. Sliders send ACTION_UPDATE_PARAMS intents, and a status receiver keeps the screen in sync with whatever the service is doing underneath. That split is clean, and it makes the app feel more expensive than its code volume suggests.

This is where the project’s design polish shows. The repository reads like an audio product, with a premium visual language and a small set of controls that never pretend to be the engine. That restraint is part of the charm.

What this does better than ordinary EQ apps

DimensionOrdinary EQ appscafeg
Where processing happensUsually in a software layer or inside a self-contained playerInside Android’s audio effects stack, bound to a live session
How it startsUser picks a source or opens a custom playerThe system broadcasts a session event and the app attaches itself
What it changesFrequency balance, presets, and broad tone shapingSpatial virtualization plus preset reverb on the active session
PersistenceOften depends on the app staying openA foreground service keeps the effect chain alive
User experienceFeels like a utilityFeels like a system-level audio patch

A prototype with a premium skin

There is not much public lore around this repository. The README is a placeholder, the footprint is thin, and the project appears to have a single maintainer. That is not a weakness in the article, it is the story.

What remains is a compact proof that Android exposes enough surface area to do something surprisingly elegant. With one receiver, one foreground service, and two effects, cafeg turns a hidden platform hook into a product-shaped audio trick.