Skip to main content

Function: peakResponseDb()

function peakResponseDb(gainsDb: readonly number[], bandwidthOctaves?: number): number;

Defined in: packages/player/src/equalizer-presets.ts:294

The true peak of a curve's combined magnitude response, in dB.

This is the part a naive graphic EQ gets wrong. The bands are one octave apart and one octave wide, so neighbours overlap and their gains add: five adjacent sliders at +6 dB do not produce a +6 dB shelf, they produce roughly +9 dB in the middle. Taking the largest slider as the headroom figure would therefore under-attenuate by several dB and clip exactly on the presets that boost hardest.

So the response is evaluated properly — every band summed at 1/6-octave steps across 20 Hz to 20 kHz — and the largest value is what equalizerPresetChain attenuates by. Same thing a mastering EQ's auto-gain does.

Parameters

ParameterTypeDefault valueDescription
gainsDbreadonly number[]undefinedOne gain per band of EQUALIZER_BANDS.
bandwidthOctavesnumber1Bell width used for every band.

Returns

number

The peak gain in dB (may be negative for a cut-only curve).