auditok.signal.calculate_energy_single_channel

auditok.signal.calculate_energy_single_channel(data, sample_width)[source]

Calculate the energy of mono audio data. Energy is computed as:

\[energy = 20 \log(\sqrt({1}/{N}\sum_{i}^{N}{a_i}^2)) % # noqa: W605\]

where a_i is the i-th audio sample and N is the number of audio samples in data.

Parameters:
  • data (bytes) – single-channel audio data.
  • sample_width (int) – size in bytes of one audio sample.
Returns:

energy – energy of audio signal.

Return type:

float