home/ modules/ detecting-beats-onsets-and-pitch

Detecting Beats, Onsets and Pitch for Event Triggers

  • learner can fire a reliable beat/onset event from live audio using amplitude thresholds with debouncing
  • learner can detect pitch by autocorrelation and locate note onsets via energy or spectral flux
  • learner can sync events to a pre-rendered track using timestamped offline analysis and compare its accuracy against live detection

Build an event detector that emits a clean beat trigger (adaptive threshold + hold window), an onset flag, and a detected pitch from live audio; then run it against a pre-rendered track using timestamped analysis and compare live vs offline accuracy.

Continuous loudness and spectrum curves are fine for wobbling a blob, but a live audiovisual set lives or dies on discrete events: the flash that lands exactly on the kick, the scene cut on a drop, the glyph that spawns when the vocalist enters. This module turns the raw features from the prerequisite module into a trustworthy event stream — the difference between visuals that feel synced and visuals that feel coincidental, whether you are VJing in a club with a noisy DI feed or scoring a browser piece against a known track.

The arc starts supported: wire a naive detector using beat detection via amplitude threshold against a steady four-on-the-floor loop, and watch it fail on sustained passages and quiet intros. That failure motivates the decaying-cutoff-plus-hold-window pattern from robust beat detection, which you tune (floor, hold frames, decay rate) until double-triggers vanish. From there you generalize: onset detection by energy and spectral flux catches events a bass-band threshold misses, and autocorrelation gives you a pitch readout by finding the lag where the signal resembles itself. The capstone assembles all three into one detector and then confronts it with ground truth — pre-rendered, timestamped analysis of the same track — so you can measure where your live detector drifts, mis-fires, or lags.

Every required atom gates that build: the two threshold procedures produce the clean beat trigger, onset detection and autocorrelation produce the flag and pitch outputs, and pre-rendered analysis supplies the offline comparison leg. As supporting context, the MIR overview frames your hand-rolled features as the front end of a much larger machine-listening pipeline — useful perspective when judging what live vs offline accuracy actually means. Drill the threshold-tuning loop until it is reflexive; you will redo it for every new track and room.

Atoms in this module

Required — these gate the capstone

Beat detection via amplitude threshold fires a visual event when RMS crosses a set level
Procedure L2 First instrument JH
Robust beat detection uses a decaying cutoff plus a hold window to debounce triggers
Procedure L3 Craft JH
Onset detection locates the start of new sound events in an audio signal by finding rapid increases in energy or spectral flux
Concept L3 Craft JB
Autocorrelation detects pitch by finding the lag at which a signal most resembles itself
Concept L3 Craft JB
Pre-rendered audio analysis APIs supply timestamped beats and pitch for offline sync
Concept L3 Craft JH

Supporting — enrichment, not gating

MIR uses content-based audio feature extraction and machine learning to automate musical analysis and similarity search
Concept L3 Craft JF