librosax.feature.rms

rms(*, y: ~jax.Array | None = None, S: ~jax.Array | None = None, frame_length: int = 2048, hop_length: int = 512, center: bool = True, pad_mode: str = 'constant', dtype: ~numpy.dtype = <class 'jax.numpy.float32'>) Array[source]

Compute root-mean-square (RMS) value for each frame.

Computing the RMS value from audio samples is faster as it doesn’t require a STFT calculation. However, using a spectrogram will give a more accurate representation of energy over time because its frames can be windowed.

Parameters:
  • y

    (optional) Audio time series. The last axis must be time.

    • (T,) - single waveform

    • (B, T) - batch of waveforms

  • S – (optional) Spectrogram magnitude with shape (..., F, N)

  • frame_length – Length of analysis frame (in samples) for energy calculation

  • hop_length – Hop length for STFT

  • center – If True and operating on time-domain input (y), pad the signal by frame_length//2 on either side. Has no effect on spectrogram input.

  • pad_mode – Padding mode for centered analysis

  • dtype – Data type of the output array

Returns:

RMS value with shape (..., 1, N).

  • (T,)(1, N)

  • (B, T)(B, 1, N)