Skip to content

onset_strength

onset_strength(y, opts?, maybeHop?): Float32Array<ArrayBufferLike>

Defined in: packages/pleco-xa/src/scripts/xa-onset.js:176

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, ... }).

any[] | Float32Array<ArrayBufferLike>

1-D audio signal (or null if opts.S given)

any = {}

Options object, or sr as a number

number

hop_length when called positionally (y, sr, hop)

Float32Array<ArrayBufferLike>

onset strength envelope