dsh-rail-equalizer: Making the navigation rail pulse with system audio

Introduction

During long conversations in DSH Desktop, the “Turn Navigation” rail on the right side facilitates quick jumping between multiple conversation turns. By default, it is a static scale and has no connection to the audio currently playing on the machine. If you want to add lightweight visual feedback within the interface, the common browser-side approach is to capture audio via the microphone or screen sharing—the former often fails to capture system mix-outs when wearing headphones, while the latter requires re-selecting the sharing target every time in Chrome/Edge, and permissions are not persistent.

dsh-rail-equalizer (Maintainer: yuanyiHY, Community Category: Fun/Cosmetic Tweaks) targets a different need: as long as sound comes from the Windows default playback device, it makes the official rail pulse in real-time without patching the official chat UI components. The following section describes its capture method, the browser-side approach, as well as installation and daily usage.

What is this

The full plugin name is dsh-rail-equalizer, Version 0.1.0 (MIT). In one sentence: On Windows, it reads PCM from the default playback device via WASAPI loopback in the host process, pushes it to the browser via SSE; the browser side merely marks the rail, injects stylesheets and CSS variables, and inserts a sidebar control row, without modifying the official component code within @deepseek-ai/dsh-client-ui-chat.

Audio data is only processed for levels in memory and is not written to disk; it requests no microphone access, performs no screen recording, and pops up no authorization windows. It works equally well when wearing headphones, as long as the system default output is functioning normally.

Where the sound comes from

Browser APIs cannot satisfy the requirement of “authorizing once, capturing system mix-outs long-term.” Therefore, the heavy lifting is done on the DSH host (Node) side: using koffi to call the Windows Core Audio COM API to perform loopback capture on the default rendering endpoint. The mechanism is similar to how OBS captures desktop audio.

The typical call chain is as follows (from source materials):

IMMDeviceEnumerator.GetDefaultAudioEndpoint(eRender)
  → IMMDevice.Activate(IAudioClient)
  → IAudioClient.Initialize(AUDCLNT_STREAMFLAGS_LOOPBACK)
  → IAudioClient.GetService(IAudioCaptureClient)
  → Poll GetBuffer / ReleaseBuffer

Key points:

  • It only reads the data sent to the sound card by the mixer; it does not change volume or affect other programs.
  • It follows the default playback device set in the system; if a specific player specifies an independent output, that audio stream cannot be captured.
  • Pre-compiled binaries are distributed via the optional dependency @koromix/koffi-win32-x64. The README states it works out-of-the-box upon installation, without relying on Visual Studio or node-gyp.

package.json declares "os": ["win32"]; package managers will refuse installation on non-Windows systems rather than letting it crash after installation.

Why it doesn’t “touch original components”

The official rail is still rendered by @deepseek-ai/dsh-client-ui-chat. The plugin does not fork or patch it. The browser side only does four things: adds data-dsh-eq to the rail <nav>; injects a <style> tag using CSS overrides; writes --dsh-eq-* variables to document.documentElement; and uses insertBefore to insert a “Pulse” control row in the sidebar, with the settings panel utilizing the official shell.overlay slot.

The pulsing effect only overlays scale, filter, and box-shadow, without changing width, height, opacity, or background-color. It also excludes turns currently being generated (with aria-busy="true"). When turned off, it removes attributes and stylesheets and clears variables, restoring the rail to a state identical to when it was not installed.

Core Features

A “Pulse” (律动) switch row appears in the sidebar, directly above the official “Workspace” section. Clicking the row (excluding the switch) expands/collapses the settings; clicking the switch on the right directly turns the feature on/off.

Settings items (from README table) include:

Item Description
Master Switch Removes stylesheets when off, not just zeroing values
Motion Mode Spectrum / Pulsate / Swing / Traveling Wave (choose one of four)
Sensitivity 0.4–3.0
Intensity 0.2–2.0
Low-frequency Impact 0–2.0
Traveling Wave Traveling Wave mode only: if off, ticks fluctuate in place
Wave Speed Traveling wave period 0.46×–2.4× (Slider 2600–500ms)

Settings are saved in the browser’s localStorage under the key dsh-rail-eq:settings:v1. At the bottom of the panel, there is a real-time level meter and backend status (device format, connection, errors).

Four Motion Modes

Mode Visual Effect Driver
Spectrum (Default) Ticks resemble player spectrum bars, arranged low to high Host 16-band logarithmic frequency bands → spread to N ticks
Pulsate The entire row scales in the same phase Global level + phase
Swing Ticks do not deform, the rail swings left and right Level × Swing Amount
Traveling Wave Phases are staggered, wave moves up along the track Level + Per-tick phase

In Spectrum mode, a 2048-point FFT + Hann window is performed on the host side, dividing 40Hz–16kHz logarithmically into 16 bands. If the client hot-reloads but the host hasn’t updated and lacks band data, the spectrum automatically degrades to moving as a single block; the self-check field bandsAvailable distinguishes this state.

Host Routing and Resources

Capture starts on-demand: it begins capturing only when a browser connects via SSE, and stops approximately 8 seconds after the last client disconnects; it consumes no CPU when the page is not open. Levels are pushed via SSE at roughly 30Hz, and the browser smooths them using requestAnimationFrame. When the system “Reduce motion” (prefers-reduced-motion) is enabled, only soft brightness changes are retained.

Debugging and operations interfaces (from source materials):

Route Purpose
GET /rail-eq/status Complete status, including clientReport
GET /rail-eq/level Single level snapshot, does not start capture
GET /rail-eq/stream SSE stream (used by browser side)
POST /rail-eq/restart Restart capture
POST /rail-eq/report Browser self-check feedback

Installation and Activation

Windows Only. Before installing, it is recommended to review the GitHub source code and MIT license yourself; the plugin runs with the permissions of the current DSH process.

Official installation command:

dsh plugin --profile desktop add github:yuanyiHY/dsh-rail-equalizer

After installation, restart DSH Desktop so the host loads the bundle and registers routes.

To develop from a local directory (path cannot contain spaces):

dsh plugin --profile desktop add link:<absolute path to clone>

Uninstallation:

dsh plugin --profile desktop remove dsh-rail-equalizer

After restarting, the host-side routes and capture will disappear; you can also simply turn off the sidebar switch to immediately stop visual effects.

Typical Usage

  1. On Windows, install via the command above and restart DSH Desktop.
  2. Open the conversation page and confirm that the “Pulse” row appears above “Workspace” in the sidebar.
  3. Turn on the switch on the right, play music, videos, or any sound going through the default output device, and observe the turn navigation rail change according to the audio levels.
  4. Expand the settings and adjust Sensitivity and Intensity based on hearing; keep “Spectrum” mode for frequency distribution; switch to corresponding motion modes for full-row breathing or traveling wave effects.
  5. If issues persist after changing the default playback device, you can POST a capture restart (replace <DSH_PORT> with the actual port):
curl -X POST http://127.0.0.1:<DSH_PORT>/rail-eq/restart

Use Cases and Notes

Who it is for: Users using DSH Desktop on Windows who want lightweight visual feedback on the chat interface rail for system playback sound, and do not want to deal with microphone or screen sharing authorization. It is categorized as “Fun/Cosmetic” in the community directory and does not alter conversation capabilities.

Important Notes:

  • macOS / Linux are not implemented; materials suggest macOS could theoretically use ScreenCaptureKit or virtual sound cards, but this repo does not do so.
  • Only supports the default playback device; virtual sound cards or exclusive mode may cause Initialize(LOOPBACK) to fail (e.g., 0x88890008), try switching the default output and retrying.
  • The mix format needs to be IEEE float32 or PCM16, otherwise “Unsupported mix format” may appear; changing to 16/24 bit, 44100/48000Hz usually resolves this.
  • If the rail DOM is significantly changed by the official client, the plugin may silently fail; troubleshoot by checking clientReport in GET /rail-eq/status (railFound, matched, tickCount, etc.).
  • Interface text is mixed Chinese/English and not integrated with DSH locales.

If the rail doesn’t move at all (README summary): First check the status at the bottom of the settings panel; confirm sound is going through the default device; confirm the turn navigation is still on the page; if still invalid, check clientReport.

Conclusion

The DSH ecosystem emphasizes “Everything is a plugin”; community directories like SkillHub are independent sites and have no official affiliation with DeepSeek / High-Flyer. dsh-rail-equalizer places WASAPI loopback in the host and confines visuals to the CSS variable layer, providing rail pulsing with zero authorization pop-ups on Windows, and restores official styles instantly upon closing.

  • Directory Page: https://www.skillhub.cn/plugins/yuanyiHY/dsh-rail-equalizer
  • Source Code & Docs: https://github.com/yuanyiHY/dsh-rail-equalizer
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye