Skip to content

logFrequencySpectrum

logFrequencySpectrum(y, sr, hop_length?, fmin?, n_bins?, tuning?, bins_per_octave?): Float32Array<ArrayBufferLike>[]

Defined in: packages/pleco-xa/src/feature/chroma.js:345

Log-frequency spectrum by nearest-FFT-bin sampling.

HONESTY NOTE: this is NOT a constant-Q transform (no wavelet basis, no per-bin Q resolution). It frames the signal, takes one large FFT per hop (n_fft = 2^ceil(log2(4*sr/fmin))) and picks the magnitude of the nearest FFT bin for each log-spaced frequency. Formerly (mis)named constant_q_transform in xa-chroma.js; kept as a fast approximation.

any[] | Float32Array<ArrayBufferLike>

time series

number

sample rate

number = 512

hop between frames

number = null

minimum frequency (default C1 = 32.7 Hz)

number = 84

number of log-frequency bins

number = 0.0

tuning offset in cents

number = 12

log-frequency bins per octave

Float32Array<ArrayBufferLike>[]

time-major [n_frames][n_bins]