/** * onset_detect() — fast spectral flux-based onset detection */ export function onsetDetect(audioData: any, sampleRate: any, { hopLength, frameLength, delta, wait }?: { hopLength?: number; frameLength?: number; delta?: number; wait?: number; }): { onsetTimes: number[]; onsetStrength: Float32Array; onsetFrames: number[]; }; /** * Fast STFT using our optimized FFT */ export function computeSTFT(audioData: any, frameLength?: number, hopLength?: number): Float32Array[]; /** * Compute spectral flux for onset detection * Much more accurate than simple RMS differences */ export function computeSpectralFlux(stft: any): Float32Array; /** * onset_strength() — log-power-mel onset strength envelope. * * S = power_to_db(melspectrogram(y, sr, n_fft, hop_length, fmax=sr/2)) * onset_env[t] = mean_f max(0, S[f, t] - ref[f, t - lag]) * padded left by lag + n_fft // (2 * hop_length) frames (center=true), * then trimmed to the frame count of S. * * Accepts either positional args `(y, sr, hop_length)` or an * options object `(y, { sr, hop_length, ... })`. * * @param {Float32Array|Array} y - 1-D audio signal (or null if opts.S given) * @param {Object|number} [opts] - Options object, or sr as a number * @param {number} [opts.sr=22050] sample rate (Hz) * @param {Array} [opts.S=null] pre-computed LOG-POWER spectrogram [freq][time] * @param {number} [opts.n_fft=2048] FFT size for the mel spectrogram * @param {number} [opts.hop_length=512] hop length * @param {number} [opts.lag=1] time lag for the difference * @param {number} [opts.max_size=1] frequency-local max filter size (1 = off) * @param {Array} [opts.ref=null] pre-computed reference spectrum * @param {boolean} [opts.detrend=false] remove DC via lfilter([1,-1],[1,-0.99]) * @param {boolean} [opts.center=true] compensate for centered STFT frames * @param {number} [opts.n_mels=128] mel bands for the default feature * @param {number} [opts.fmin=0] lowest mel frequency * @param {number} [opts.fmax=sr/2] highest mel frequency (default) * @param {boolean} [opts.htk=false] HTK mel scale * @param {string} [opts.aggregate='mean'] frequency aggregation: 'mean' * (default) or 'median' (used by beat_track, aggregate=np.median) * @param {number} [maybeHop] - hop_length when called positionally (y, sr, hop) * @returns {Float32Array} onset strength envelope */ export function onset_strength(y: Float32Array | any[], opts?: any | number, maybeHop?: number): Float32Array; /** * Peak picking for onset detection * Peak picking algorithm */ export function pickPeaks(onsetStrength: any, { delta, wait }?: { delta?: number; wait?: number; }): number[]; /** * Convert onset times to beat times * Simple version - just use onset spacing * Reports failure honestly: with fewer than 2 onsets there is no interval to * measure, so bpm is null (never a fabricated default). */ export function onsetsToBeats(onsetTimes: any): { bpm: number; beatTimes: any[]; interval: number; }; /** * Backtrack detected onset events to the nearest preceding local minimum of energy * @param {Array|Float32Array} events - Frame indices of detected onsets * @param {Array|Float32Array} energy - Energy envelope (e.g., RMS, onset strength) * @returns {Float32Array} Backtracked onset event frames */ export function onset_backtrack(events: any[] | Float32Array, energy: any[] | Float32Array): Float32Array; /** * Compute a spectral flux onset strength envelope across multiple channels * Useful for multi-channel or source-separated audio * @param {Float32Array|null} y - Audio time series * @param {number} sr - Sample rate * @param {Array|null} S - Pre-computed spectrogram [channels x freq x time] * @param {number} n_fft - FFT size * @param {number} hop_length - Hop length * @param {number} lag - Lag for onset detection * @param {number} max_size - Max filter size * @param {Array|null} ref - Reference power * @param {boolean} detrend - Remove DC component * @param {boolean} center - Center frames * @param {Function|null} feature - Feature extraction function * @param {Function|null} aggregate - Aggregation function across channels * @param {Array|null} channels - List of channel slices * @param {Object} kwargs - Additional arguments * @returns {Array} Multi-channel onset strength [channels x time] */ export function onset_strength_multi(y?: Float32Array | null, sr?: number, S?: any[] | null, n_fft?: number, hop_length?: number, lag?: number, max_size?: number, ref?: any[] | null, detrend?: boolean, center?: boolean, feature?: Function | null, aggregate?: Function | null, channels?: any[] | null, kwargs?: any): any[];