Constant / note data
key() returns the current MIDI note number normalized to the 0.0..1.0 range. MIDI note 0 returns 0.0, MIDI note 127 returns 1.0, and middle C is about 60/127 = 0.472.
Use it when a sound should change naturally across the keyboard without using expensive repeated pitch calculations. It is especially useful for acoustic-style models: high notes can have shorter envelopes and darker high partials, while low notes can keep longer body and stronger harmonic weight.
No arguments.
env((1.4-0.7*key()),0)*sin(X) env((1.0-0.5*key()),1)*(1.2-0.9*key())*sin(8*X)
Shorten high-note envelope movement:
env((1.7+param(0))*(1.25-0.65*key()),0)
Damp high partials on high notes, while allowing more body in low notes:
(1.18-0.90*key())*sin(10*X)
Make filter cutoff gently follow the played key:
moog(saw(X), 0.08 + 0.35*key(), 0.2)
key() is based on the played MIDI note, not on pitch-bend or MPE glide. This makes it stable for keyboard balancing, piano damping, and per-note timbre correction. For actual frequency-following calculations use notefq(); for older pitch-ratio formulas use tone().