dsh-piano: A Sliding Piano in the DSH Interface

DSH supports plugin extensions, and dsh-piano is one such plugin that adds a piano keyboard to the interface. It uses the Web Audio API to synthesize sound in real-time, without requiring external samples or network requests.

What Is It

dsh-piano is a plugin maintained by 439436269-ctrl, categorized as “Fun & Cosplay.” It provides an interactive piano keyboard that supports playing individual notes by clicking or producing sound via hold-and-slide (glissando).

Core Features

  • Floating Keyboard Panel: Shown centered at the bottom by default, includes a volume slider and octave transposition buttons (− / +).
  • White and Black Keys: Full keyboard layout supporting click and drag-hold interactions.
  • Glissando: Press and horizontally slide the mouse or trackpad; whichever key you pass over will sound.
  • Draggable Button: The 🎹 activation button in the lower-left corner is draggable; its position is stored in localStorage.
  • Local Persistence: Volume and octave settings are saved and persist after page refresh.

Installation

Use the official installation command to add the plugin to the desktop profile:

dsh plugin --profile desktop add dsh-piano

After installation, the 🎹 button appears in the lower-left corner. The plugin supports hot-loading and typically does not require a restart; if it doesn’t take effect, refreshing the page usually resolves it.

Typical Usage

  1. Open the panel: Click the 🎹 button in the lower-left corner.
  2. Play a single note: Click a key to sound its pitch.
  3. Glissando: Press and slide horizontally with the mouse or trackpad for a continuous gliding effect.
  4. Adjust parameters: Use the volume slider and octave transposition buttons to modify the sound.

Technical Notes and Caveats

  • Zero dependencies: Sounds are synthesized in real-time via Web Audio, with no sample files or third-party libraries.
  • User gesture required: Browsers require a user gesture (click or key press) for the first sound. If AudioContext is unsupported, no sound will play.
  • Compatibility: Works with DSH >=0.2.0-rc.1 and Node >=22.

Conclusion

dsh-piano offers a quick way to interact and have fun within the DSH interface, suitable for developers who need visual feedback or occasional breaks.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye