Audio Analyzer Path (Allergic)
Point it at any audio file, get back BPM, key, and a real AUDIO tensor
- AUDIO
- bpm
- key
- scale
- keyscale
ComfyUI got good at making sound before it got good at telling you what sound it's looking at. This node is the boring-but-useful answer to the second half: paste a file path to any audio file and it hands back the BPM, the musical key, the scale, and a plain AUDIO output you can route anywhere else in the graph. It's the "for minimalists" half of the two-node AllergicAudio pack by usrname0 - the one for people who type paths instead of picking files.
How it works
Under the hood it's a small, honest script. It loads the file with librosa, runs librosa's beat tracker to get a tempo, then computes a chroma (pitch-class) distribution with chroma_cqt and correlates it against the classic Krumhansl–Schmuckler key profiles - twelve rotations of the major and minor templates, whichever correlation wins decides the key. That's the textbook music-theory algorithm, not a learned model, so there's no model download and no GPU involved. You could reproduce the math in a notebook; this just drops it into a ComfyUI node.
The AUDIO output is built with PyAV and returned in the exact {"waveform": tensor, "sample_rate": int} shape ComfyUI's built-in LoadAudio produces, so anything that accepts an AUDIO input will take it. One honest caveat: PyAV isn't in the pack's declared requirements - only librosa is. It works because ComfyUI ships av anyway, but it's one of those quietly-undeclared dependencies you'd only notice in a stripped-down environment.
The input and outputs
The node is minimal by design. There's exactly one input:
file_path(STRING) - a raw filesystem path in plain text. No picker, no drag-and-drop; paste it in and run.
The path gets run through the pack's sanitize_path helper, which strips surrounding quotes, preserves Windows drive letters, and drops the characters Windows forbids in filenames. Outputs:
AUDIO- decoded audio as a ComfyUI AUDIO tensor, same format as LoadAudiobpm(INT) - rounded tempokey(STRING) andscale(STRING) - e.g."G"and"minor"keyscale(COMBO) - the two combined as"G minor". It's deliberately typed as a COMBO so it'll plug into dropdown/combo inputs on other nodes that expect a value from a list.
Installing it
The whole pack installs one way regardless of which node you use. Easiest: ComfyUI Manager, search "Allergic Audio", install, restart - Manager handles the one declared dependency, librosa. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/usrname0/ComfyUI-AllergicAudio.git
cd ComfyUI-AllergicAudio
pip install .
On the Windows portable build, replace pip with ..\..\..\python_embeded\python.exe -m pip install .. Note librosa is a heavyweight - it drags in numba, llvmlite, scipy and friends, so the first install takes a few minutes and the first analyze run compiles numba JIT code and can stall for a moment. That's normal; the second run is fast.
Gotchas
The name Path is doing real work: this node reads any path the ComfyUI machine can reach, not just your input folder - handy for scripting or API-driven workflows. But the path must be valid from the server's point of view, not your browser's; if ComfyUI runs in Docker or on another box, that's the filesystem that matters.
One trap worth knowing: sanitize_path is Windows-flavored. It rewrites forward slashes to backslashes and collapses duplicates, which is fine on Windows but means a path like /home/you/loop.wav gets mangled into a literal backslash filename on Linux or macOS. If you're not on Windows, the Upload sibling in this same pack (file-picker UI, no path typing) is the safer route - or just accept that this node was tuned for the platform its sanitizer was written for.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| file_path | STRING | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| AUDIO | AUDIO | — |
| bpm | INT | — |
| key | STRING | — |
| scale | STRING | — |
| keyscale | COMBO | — |