pyntbci.envelope.envelope_rms

pyntbci.envelope.envelope_rms(audio: ndarray[Any, dtype[_ScalarType_co]], fs: int, fs_inter: int = 8000, fs_target: int = 32) ndarray[Any, dtype[_ScalarType_co]][source]

Compute the envelope of the audio as the root mean square (RMS) of the signal.

Parameters:
  • audio (NDArray) – A vector containing the raw audio sampled at fs.

  • fs (int) – The sampling frequency in Hz of the raw audio.

  • fs_inter (int (default: 8000)) – The sampling frequency in Hz to which the audio will be downsampled for computational efficiency.

  • fs_target (int (default: 32)) – The sampling frequency in Hz to which the envelope will be downsampled.

Returns:

envelope – The envelope using the RMS of the audio.

Return type:

NDArray