Nodes/XB_ToolBox/XB-BOX - 🔊 播放声音
ComfyUI Node

XB-BOX - 🔊 播放声音

The beep that tells you the queue is finally done

By wjluoxiao·Created 6 months ago·Updated 5 days ago· 351
XB-BOX - 🔊 播放声音
  • any
  • any
◄modealways►
◄volume0.5►
◄filenotify.mp3►

What it's for

You queue eight images and go do something else. Ten minutes later you check back and it finished seven minutes ago. This node plays a sound in your browser when it runs, so you don't babysit a progress bar.

That's the whole feature, and nobody writes about nodes like this - "PlaySound" turns up in about fifteen threads across two years of r/comfyui and r/StableDiffusion combined. It's the kind of thing people quietly install. It's also a reimplementation of the PlaySound node from pysssss's ComfyUI-Custom-Scripts, so if you already run that pack you have an equivalent node; this one is worth having if you're running XB_ToolBox anyway.

How it works, and why that matters

The Python side does nothing. Literally: the node's function is called nop, and all it does is hand your input back with an empty ui payload. The sound comes from the pack's frontend JavaScript (js/xb_play_sound.js), which hooks the node's onExecuted and calls new Audio(url).play().

Two consequences worth knowing before you wire it up. First, the sound comes out of whatever machine has the ComfyUI tab open - browser audio, not server audio. ComfyUI on a headless box in the basement, laptop on the couch: the ding plays on the couch. Usually what you wanted. Second, the browser's autoplay policy applies. If you've never clicked inside the ComfyUI tab, the play() call is rejected and the only trace is a warning in the browser console. Click the page once, then queue.

The node also returns float("NaN") from its IS_CHANGED method, which is the standard ComfyUI way of saying "run me every single time" - a normal value lets the cache skip it. Exactly right here, and because this node sits at the end of the graph, the usual cost of that trick (defeating the cache for everything downstream) doesn't bite.

Inputs and the single output

  • any - a wildcard input: hook it to the last node in your chain and whatever you plug in passes straight through unchanged. Use it as the end of the line; the output is a list-typed socket rather than one clean value.
  • mode - always fires every execution. on empty queue fires once, when the whole queue is done: the difference between eight dings and one on a batch. The JavaScript checks ComfyUI's queue size, waits half a second and re-checks if it's still busy, then gives up silently. Use on empty queue for batches, always when you're stepping through a workflow by hand.
  • volume - 0.0 to 1.0, default 0.5. A multiplier on the browser's own volume, not a system volume.
  • file - default notify.mp3, which ships inside the pack so it works with zero setup. A bare filename is looked up in the pack's js/assets/; subfolder/name.wav resolves relative to the pack's js/; a full https:// URL is used as-is.

The one output, any, is your data back out.

Install, and using your own sound

Manager → search XB_ToolBox → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/WJLUOXIAO/XB_ToolBox.git

Then hard-refresh the browser tab so the extension's JS loads. No models to download.

For your own clip, drop it inside the pack:

ComfyUI/custom_nodes/XB_ToolBox/js/assets/ding.wav

and set file to ding.wav. Subfolders work the same way: js/mysounds/ding.wav means file = mysounds/ding.wav. Note what does not work - an absolute path like C:\sounds\ding.wav. The resolver builds a URL relative to the pack's own JS file, so a Windows path becomes nonsense that 404s with a console warning. Keep files inside the pack, or host one and paste the full https:// URL. Either way keep a copy: a Manager reinstall or update of XB_ToolBox can overwrite the directory.

Common issues

  • Silence, plus a console warning about autoplay. Click somewhere in the ComfyUI tab once, re-queue. This is the number one cause and it isn't a bug in the node.
  • Silence, no warning. The file wasn't found (the JS logs the URL it tried), or the tab is muted, or the browser is routed to another output device. Filenames are case-sensitive on Linux.
  • Nothing happens at all. The node has to execute, so wire something into any.
  • The node isn't there, and other pack nodes are missing too. XB_ToolBox's __init__.py imports its whole node set inside one try/except, so a single missing dependency (PyAV, easyocr, onnxruntime) prints 🚨 [XB-BOX] FATAL ERROR: XB_ToolBox Loading Failed! and registers nothing - including this one. Install via Manager, which handles the pack's requirements, and check the console on startup.
CategoryXB_ToolBox/Utils

Inputs (4)

NameTypeDefaultDescription
any*任意类型输入,仅用于挂载到工作流执行链上(数据原样透传)
modeCOMBOalwaysalways: 每次执行都播放 on empty queue: 仅当整个队列跑完后播放一次(批量出图只响一次)
volumeFLOAT0.50–1播放音量 (0.0 ~ 1.0)
fileSTRINGnotify.mp3音频文件名(默认读取 js/assets/notify.mp3) 可填: notify.mp3 / 子目录/xx.wav / https://... 完整网址

Outputs (1)

NameTypeDescription
any*—