Filter node

Pitch Detection

Polyphonic pitch detection (Spotify basic-pitch ML model). Notes/Onsets are 88-bin arrays (A0…C8) — Notes smoothed both ways, Onsets are attack peaks (instant rise, Fall Smoothing tail); Chroma folds to 12 pitch classes, Dominant Note is hysteresis-stabilized, Note On is a 1-frame pulse. Rise Smoothing acts while values grow, Fall Smoothing while they decay (0–1 as time feel: 0.3 ≈ 135 ms, 1.0 = 1.5 s; Fall > Rise = soft-fall meter). Min/Max Note fence the frequency range in Hz; Update Rate sets the inference cadence in ms (floor 50 ms = fastest). Wire Audio Analysis Beat into Drum Gate to suppress fake Note Ons on drum hits (set Beat Hold ~100 ms). ~150–350 ms latency — a melody/harmony tool, not a beat detector.

Inputs

PortTypeDefault
Audio DataThe sound to analyse. Cable the same Audio Data port that Audio FFT uses — Audio Input, Audio Player or any node carrying an audio ring.structure—
EnableOff silences every output and forgets the smoothing, so re-enabling starts clean.booltrue
Note SensHow readily a note counts as sounding — higher hears quiet and uncertain notes, lower keeps only confident ones. Useful across 0.05…0.95; beyond that the threshold stops moving.float0.5
Onset SensHow readily an attack fires Note On and the Onsets peaks. Useful across 0.05…0.95; higher means more triggers and more false ones.float0.5
Drum GateWhile this is true no Note On can fire, so drum transients cannot fake notes. Wire an Audio Analysis Beat here with a hold of about 100 ms.boolfalse
Min NoteLowest frequency to listen to, in Hz; everything below is zeroed in all outputs. Values under about 27.5 make no difference, that is the model's bottom note.float55
Max NoteHighest frequency to listen to, in Hz. Values above about 4186 make no difference, that is the model's top note.float4200
Rise SmoothingHow gently note values climb when a note appears. Clamped to 0…1 read as time — 0 is instant, 0.3 is roughly 135 ms, 1 is about 1.5 s.float0.1
Fall SmoothingHow slowly note values and onset peaks fade after a note stops. Clamped to 0…1 as time, up to about 1.5 s; set it above Rise Smoothing for the classic fast-attack, soft-fall meter.float0.3
Update RateMilliseconds between model inferences — lower is more responsive, higher is lighter on the CPU. Clamped to 50…2000.float250

Outputs

PortType
Notesfloat
Onsetsfloat
Chromafloat
Contourfloat
Dominant Hzfloat
Dominant Noteint
Note Namestring
Note Onbool
Velocityfloat
Voicesint
Levelfloat

Live Anatomy

Interactive — 88-note activation strip with Note On pulses

How It Works

Pitch Detection runs Spotify's open-source basic-pitch neural network fully on-device: the incoming audio (any source that carries the shared Audio currency — Audio Input, Audio Player, Video Player audio) is resampled to 22,050 Hz, sliced into overlapping two-second windows, and pushed through a tiny Core ML model on the CPU (~12 ms per inference). The model answers three questions at ~86 analysis frames per second: which of the 88 piano notes are sounding (Notes), which just started (Onsets), and where exactly the pitch sits between semitones (Contour, 3 bins per semitone).

Several Pitch Detection nodes listening to the same source share one inference engine — three nodes cost one model run. The engine loads asynchronously (no project-open hitch), sleeps whenever no enabled node listens, and skips inference entirely while the source is idle.

This is a melody and harmony instrument, not a beat detector: practical latency is ~150–350 ms depending on Update Rate. For rhythm, pair it with Audio Beat Detection — the two are designed to work together (see Drum Gate below).

Outputs in Depth

OutputWhat it carries
Notes88 activations 0–1, A0…C8 (MIDI 21–108). Smoothed by Rise/Fall Smoothing. The main output — feed Replicator (88 copies), Notes to Points, or MIDI Sender's poly input.
Onsets88 raw attack peaks — they jump to full strength the instant a note starts and decay along Fall Smoothing. Deliberately NOT rise-smoothed: a smoothed attack would never cross downstream thresholds.
Chroma12 pitch classes (C…B), the Notes array folded across octaves — perfect for hue mapping and geometric layouts.
Contour264-bin fine pitch salience (3 bins per semitone) for vibrato-level visualization.
Dominant Hz / Dominant Note / Note NameThe strongest note as interpolated frequency (~cent precision), MIDI number (−1 = silence) and text ("A4"). Hysteresis-stabilized: the current dominant keeps its crown until a challenger clearly overtakes it, so it never flickers between neighboring semitones.
Note On1-frame pulse when any new note starts (150 ms per-semitone refractory). Wire to Do Once, Counter, particle bursts.
Velocity / Voices / LevelStrength of the last attack · number of currently sounding notes · overall activity 0–1.

Parameters in Depth

ParameterMeaning
Note Sens / Onset Sens (0–1)Detection sensitivity: higher = more notes/events pass. Internally the threshold is 1 − sensitivity.
Drum Gate (bool)While true, Note On pulses are suppressed — wire Audio Beat Detection's Onset (or Audio Analysis Beat with ~100 ms hold) here so drum transients cannot fake melody events. Suppressed events do not arm the refractory, so a real note right after a kick still fires.
Min / Max Note (Hz)A hard frequency fence. Raise Min to ~120 Hz to keep bass out of the note map, or lower Max to isolate only the bass register.
Rise / Fall Smoothing (0–1)Time-based asymmetric smoothing: Rise acts while values grow, Fall while they decay. The knob maps to a real time constant — 0.1 ≈ 15 ms, 0.3 ≈ 135 ms, 1.0 = 1.5 s. Fall > Rise gives the classic fast-attack / soft-fall meter.
Update Rate (ms)Inference cadence — the latency/CPU dial. 250 ms default ≈ 5% of one core; the floor is 50 ms (fastest).

Use Cases

  • Melody-driven geometry — Notes → Notes to Points (Noise Field) → Plexus: an organism of 88 points where sounding notes surge through the flock.
  • Play your synths from the mic — Notes → MIDI Sender's poly Notes input (velocity from Onsets): Grafit becomes a live polyphonic MIDI instrument.
  • Chromatic color — Chroma → Array Get(index) → color hue, or Dominant Note → Remap → HSL Color Hue: the scene's palette follows the key of the music.
  • Note-triggered events — Note On → Do Once / Counter / particle Spawn burst; Velocity → emission strength.
  • Bass-only reactivity — Max Note 200 Hz, then Level drives a slow background pulse while Audio Beat Detection handles the rhythm layer.

Tips

  • Generators react best to Notes + Fall Smoothing ≈ 0.3–0.5; use raw Onsets only for triggers and retriggers.
  • On a full mix with drums, always close the loop: Audio Beat Detection Onset → Drum Gate. Kick drums have real pitch (an 808 IS a note) — the gate is what keeps the melody map clean.
  • Dominant Note outputs −1 in silence — Compare against 0 before driving parameters that must hold their last value (or route through Hold Value).
  • The model's ceiling is ~C8 and its frequency world ends at ~10 kHz — brightness/air analysis stays the job of Audio FFT. The two paths complement each other.
  • On-device and App Store clean: the bundled model is Apache 2.0 (see the app's About → Acknowledgments); audio never leaves the machine.

Open Pitch Detection in the interactive catalog →

Pitch Detection is one of 381 nodes in Grafit Pro.

Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.

More Filter nodes