@a2f0/dnbm

中文文档
0.4.34发布于 2026/11/07UNLICENSEDTypeScriptES Module零依赖构建来源已验证近 30 天下载 5488

A dark drum and bass sequencer, mixer and player with a WebAssembly audio engine, ready to embed in a page

原始使用文档
文档目录5 节
  1. Quick start
  2. Layout
  3. Songs
  4. Package
  5. Development

dnbm

A dark drum and bass sequencer and mixer in the browser. Program patterns on a step grid, arrange them into a song, mix them with per-track filters, drive and sends, and save songs as plain text that diffs and merges cleanly in Git. This repo is available on the web at https://dnbm.a2f0.net. Its player, at https://dnbm.a2f0.net/player/, plays the example songs as a playlist.

The sound comes from a Rust engine compiled to WebAssembly and run in an AudioWorklet. Every drum and bass sound is synthesized, not sampled; steps land on the exact sample they fall on; and the same engine renders WAV files offline. A song sounds the same in the browser, in an export and from the command line.

The standalone site uses CT click tracking. Embedded apps leave tracking to their host.

Quick start

Install mise and rustup; rustup installs the toolchain and WebAssembly target pinned in rust-toolchain.toml on first use.

mise install                      # Bun, Node, ShellCheck and wasm-opt (see .mise.toml)
bun install
bun run hooks:install             # once per clone
bun run dev                       # http://localhost:8174 (player: /player/)

The editor opens on the example song Undertow; press space to play.

Layout

PathWhat
packages/sequencer/The editor and mixer, served at the site's root
packages/player/The playlist player, served at /player/
packages/synth/The shared synthesizer: the Rust engine, its AudioWorklet host and the song format
src/The entrypoints of the @a2f0/dnbm package
songs/The example songs

Architecture describes how the packages fit together.

Songs

Songs are .dnbm.json files. Each pattern row is one line, so changing a step changes one line of the file:

"rows": {
  "kick": "X... .... ..X. .... | ..X. .... ..X. ....",
  "snare": ".... X... .... X... | .... X... .... X...",
  "reese": "F-1 --- --- ---  --- --- ... F-1  --- ... F-1 ---  F#1 --- --- ... | ..."
}

In Chromium, Save writes back to the file you opened, so a song in a Git checkout can be edited, saved and committed in place. The song format describes every field.

bun run render songs/undertow.dnbm.json   # render to undertow.wav (24-bit, 48 kHz)
bun run songs:fmt                         # rewrite songs/ canonically
bun run songs:check                       # fail on an invalid or non-canonical song

The example songs in songs/ open from the editor's examples menu, and the player plays them all. Undertow is a 172 BPM roller in F minor: syncopated sub and reese bass, dry backbeats, ghost snares and sparse, filtered dub echoes. Its 36 bars move from a short intro through four-bar variations, a half-time break and a heavier return. Ten darker songs, from Bathyal's slow pressure and Oubliette's bare cell to Corrosion's industrial grind and Sever's techstep cuts, are each longer than Undertow and all built from the same synthesized kit: drones and stabs come from the pad instrument, detuned saw pairs an interval apart under a slow, resonant filter.

Package

dnbm is also published to npm as @a2f0/dnbm, to embed the whole app in another page or app, such as a mini-app window:

import { copyDnbmAssets } from "@a2f0/dnbm/build"; // in a build script
await copyDnbmAssets("./public/dnbm");

import { mountDnbm } from "@a2f0/dnbm"; // in the browser
const dnbm = mountDnbm(container, { assetsUrl: "/dnbm/" });
await dnbm.ready; // it shows

import { mountDnbmPlayer } from "@a2f0/dnbm"; // or just the player
const player = mountDnbmPlayer(container, { assetsUrl: "/dnbm/", songs });

The app renders in the host's own document, inside a shadow root that keeps its styles and the host's apart, and takes only the keys pressed inside it. A host's own controls, such as a window's menus and toolbar, can drive it: each instance runs commands (dnbm.run("save")), reports its state (playing, the song's title, unsaved changes, which commands are available) and tells subscribers when it changes, and actions: false leaves out the app's own buttons for those commands. The package guide covers embedding and releases.

Development

bun run check   # everything CI checks; the pre-push hook runs it too; needs Google Chrome
bun run test    # build the engine, then the TypeScript tests
bun run engine:check   # rustfmt, clippy and cargo test
bun run fix     # format TypeScript, Rust and songs

See development for layout, script ownership and validation, package releases for publishing, and dependency maintenance for upgrade procedures and active constraints.

版本与发布记录

@a2f0/dnbm 共发布 45 个版本,首次发布于 2026/10/07;过去 12 个月发布了 45 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.34latest2026/11/07今天
0.4.332026/11/061 天前
0.4.322026/11/061 天前
0.4.312026/11/061 天前
0.4.302026/11/061 天前
0.4.292026/11/061 天前

关于 @a2f0/dnbm 的常见问题

@a2f0/dnbm 是什么?

A dark drum and bass sequencer, mixer and player with a WebAssembly audio engine, ready to embed in a page

如何安装 @a2f0/dnbm?

在项目目录运行 npm install @a2f0/dnbm,或使用 pnpm add / yarn add / bun add。

@a2f0/dnbm 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@a2f0/dnbm 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@a2f0/dnbm 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@a2f0/dnbm 可以商用吗?

@a2f0/dnbm 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@a2f0/dnbm 的下载量有多少?

根据 npm 官方下载统计,@a2f0/dnbm 在 2026/10/05 – 2026/11/03 这 30 天内被下载 5,488 次,日均约 183 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@a2f0/dnbm 还在维护吗?

最新版本 0.4.34 发布于 2026/11/07(今天);至今共发布 45 个版本,其中过去 12 个月发布了 45 个;首次发布于 2026/10/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。