In dynamic lighting design, simple audio amplitude meters only tell part of the story. A volume meter reacts instantly to every loud crash, but music is built on rhythmic bars, tempos, and repeating downbeats. The **BPM Node** (`BpmNode`) transforms raw audio FFT spectrum streams into a structured, musical clock that drives procedural lighting automation in tight lockstep with the beat.

![BpmNode Interface - Procedural audio tempo tracking node showing master clock steering, musical fraction multipliers, frequency bandpass filtering, and trigger outputs](https://unilighter.cc/info/docs/node-graphs/bpm/node_bpm_702bbc24.png)

---

## 🧠 How Audio Beat Detection Works

### 1. Spectral Flux Analysis
Rather than relying on simple volume peaks, `BpmNode` calculates spectral flux across consecutive audio frames, measuring how rapidly energy shifts across frequency bands.

### 2. Bandpass Isolation (`Min Freq` / `Max Freq`)
Defaults to `40 Hz – 200 Hz`. By focusing the detector strictly on kick drum transients and bass energy, the node ignores high-frequency percussion, vocals, and synth leads that could otherwise trigger false beats.

### 3. Inter-Onset Interval (IOI) Median Tracking
The node computes the statistical median of time intervals between consecutive acoustic onsets. This eliminates syncopation errors and irregular rhythms, converging on the true underlying musical tempo.

### 4. Confidence Metric & BPM Bounding
Displays a real-time `Confidence %` metric indicating tracking stability. The `Min BPM` and `Max BPM` sliders (e.g. `60` to `180`) prevent octave doubling or halving (such as jumping from 130 BPM to 65 BPM during a breakdown).

---

## 👑 Master Project Tempo Steering (`Control tempo`)

When the **Control tempo** toggle is active, `BpmNode` takes ownership of Unilighter's central `BPMManager`, synchronizing the entire show to the incoming live music.

- **Smooth Phase Preservation (`changeBpmPreservePhase`)**: A critical engineering feature: unlike a manual TAP button that resets the beat phase to 0 on every press, `BpmNode` smoothly scales the master timebase. Running keyframe animations, sweeping matrix choreographies, and rhythmic step chases smoothly adapt their speed without stuttering, jumping, or skipping steps.
- **Operator Steal Protection**: If an operator manually taps tempo in the top navigation bar, clicks a `x2 / /2` button, or adjusts BPM via a mapped hardware MIDI knob, the manual action immediately steals tempo ownership and disengages the node's control toggle. This guarantees that live operator decisions always override automated audio algorithms.

---

## 🔌 Sockets & Musical Fractions Reference

| Socket | Direction | Data Type | Description |
| :--- | :--- | :--- | :--- |
| **Audio FFT** | Input | `Spectrum` | Raw FFT frequency stream from an [Audio Input Node](https://unilighter.cc/info/for-ai/docs/node-graphs/audio.md). |
| **Min Freq (Hz)** | Input / Setting | `Number` | Lower frequency boundary for transient detection (`40 Hz`). |
| **Max Freq (Hz)** | Input / Setting | `Number` | Upper frequency boundary for transient detection (`200 Hz`). |
| **Sensitivity** | Input / Setting | `Number` | Detection threshold multiplier (`0.0 – 1.0`). |
| **BPM** | Output | `Number` | Live numerical tempo value. |
| **Frequency** | Output | `Number` | Clock frequency in Hertz calculated from the selected musical fraction (e.g. `120 BPM x1 = 2.000 Hz`). |
| **Trigger** | Output | `Trigger` | Clean Boolean pulse emitted precisely on every downbeat. Connect directly to [Gate Nodes](https://unilighter.cc/info/for-ai/docs/node-graphs/gate.md) or [Device Nodes](https://unilighter.cc/info/for-ai/docs/node-graphs/device.md) to pulse strobe blinder accents on the beat. |

### Fraction Multipliers
The **Fraction** dropdown multiplies or divides the clock output (`x4`, `x2`, `x1`, `/2`, `/4`, `/8`) for half-time sweeps, double-time strobes, or multi-bar evolution.

Read more in the **[Visual Node Graphs Guide](https://unilighter.cc/info/for-ai/docs/node-graphs.md)** and the **[Time Synchronization Guide](https://unilighter.cc/info/for-ai/docs/time-sync.md)**.

