Skip to content

Plugin: Equalizer

EqualizerPlugin (id 'equalizer') is a 10-band parametric equalizer plus a pre-gain stage, built from BiquadFilterNodes inserted into Audio Graph’s chain.

Options

OptionTypeDefaultPurpose
bandsEqBand[]DEFAULT_BANDS10 frequency bands. Element 0 must be the { frequency: 'Pre', gain } pseudo-band.
presetstringPreset name to apply on use().
presetsEqPreset[]Additional presets beyond the built-ins.
sliderValuesEqSliderValuesDEFAULT_SLIDER_VALUESMin/max/step/default per slider, for a UI to read directly.
persistKeystringStorage key. Omit to disable persistence.
autoLoad / autoSavebooleantrue / true when persistKey setLoad/save automatically through this.storage.
smoothingTimeConstantSecondsnumber0.05Ramp time for gain changes, avoids audible clicks.

EqBand is { frequency: number | 'Pre'; gain: number; q?: number; type?: BiquadFilterType }.

Events

ready, band:changed ({ band }), preset:changed ({ name }), change ({ bands, selectedPreset }), saved.

Rules & restrictions

  • static requires = [AudioGraphPlugin] — register Audio Graph first, the equalizer throws core:plugin/missing-dep otherwise.
  • bands[0] is a fixed contract: it must be the 'Pre' pseudo-band, not a real frequency.
  • Persistence goes through this.storage, the plugin’s own scoped, namespaced storage, never raw localStorage. Swapping the storage adapter moves equalizer persistence with it, same as everything else that uses this.storage.
  • Pre-gain has a sticky-zero snap: values within ±0.05 of zero round to exactly zero, so a UI slider settles cleanly at the middle instead of hovering at 0.0003.

How to extend it

TypeScript
import nmplayer from '@nomercy-entertainment/nomercy-video-player'; // nomercy-music-player's factory works identically
import { AudioGraphPlugin, EqualizerPlugin } from '@nomercy-entertainment/nomercy-player-core';

const player = nmplayer('player');

player.addPlugin(AudioGraphPlugin);
player.addPlugin(EqualizerPlugin, { persistKey: 'my-app-eq' });
await player.ready();

const eq = player.getPlugin(EqualizerPlugin);
eq!.band(1000, 4); // +4 dB at 1 kHz
eq!.preset('Rock');
eq!.save();

Next steps

  • Plugin: Mixer: the master gain and pan stage at the tail of the same chain.