autoRender? | boolean | Whether to automatically re-render when viewport or configuration changes. Default true |
autoResize? | boolean | Whether to automatically resize canvas pixel resolution when container dimensions change. Default true |
backend? | BackendMode | STFT compute execution backend: - “auto”: Prefers WebAssembly workers, falling back to main thread. - “wasm”: Fast WebAssembly computation. - “worker”: Web Worker background thread computation. - “main-thread”: Synchronous main thread computation. Default "auto" |
channel? | number | Audio channel index to analyze (0 for left/mono, 1 for right). Default 0 |
clampValues? | boolean | Whether to clamp intensity values strictly within [minDb, maxDb]. Default true |
colorMap? | ColorMapConfig | Colormap palette name (such as “inferno”, “viridis”, “magma”, “turbo”) or custom palette object. Default "viridis" |
devicePixelRatio? | boolean | number | Device pixel ratio scaling factor for HiDPI/Retina displays. Default window.devicePixelRatio |
fftSize? | number | FFT length in samples. Must be a power of two >= windowSize. Spectral magnitudes contain the first fftSize / 2 bins, normalized by fftSize, without one-sided or window coherent-gain compensation. Default 1024 |
frequencyScale? | FrequencyScale | Frequency scale mapping: “linear”, “mel”, or “log”. Default "linear" |
hopSize? | number | Hop size (step length) in samples between consecutive FFT frames. Default 256 |
maxCachedBytes? | number | Maximum estimated bytes retained by the computed tile cache. |
maxCachedTiles? | number | Maximum number of computed STFT tiles retained in memory cache. Default 64 |
maxDb? | number | Upper intensity limit mapped to the end of the colormap (in dB when valueMode is “db”). Default 0 |
minDb? | number | Lower intensity limit mapped to the start of the colormap (always specified in dB; converted internally for non-dB value modes). Default -100 |
prefetchTiles? | number | Number of tiles to prefetch and compute ahead of the visible viewport. Default 8 |
renderer? | RendererMode | Rendering engine: - “auto”: Uses WebGL2 if supported, falling back to Canvas 2D. - “webgl” / “webgl2”: Hardware-accelerated GPU shader renderer. - “canvas2d”: CPU Canvas 2D fallback renderer. - Custom object with shader program (`{ type: “webgl”, program: “normal” |
showLoadingPlaceholders? | boolean | Whether to draw loading placeholders over tiles that are still computing. |
tileMaxCells? | number | Maximum 2D STFT matrix cells (frameCount * binCount) budgeted per computation tile. Default 131_072 |
transforms? | SpectrogramTransform[] | Array of custom matrix transforms applied to STFT data before rendering. Default undefined |
valueGamma? | number | Power-law gamma exponent for dynamic range contrast adjustment. Default 1.0 |
valueMode? | ValueMode | Intensity scale representation: “db” (decibels), “magnitude”, or “power”. dB values use 20 * log10(max(magnitude, 1e-12)). Default "db" |
window? | WindowName | Window function applied before FFT: “hann”, “hamming”, “blackman”, or “rectangular”. Default "hann" |
windowSize? | number | STFT analysis window length in audio samples. Default 1024 |