pytimbre.spectral.timbral_model.timbral_util.sample_and_hold_envelope_calculation

pytimbre.spectral.timbral_model.timbral_util.sample_and_hold_envelope_calculation(audio_samples, fs, decay_time=0.2, hold_time=0.01)

Calculates the envelope of audio_samples with a ‘sample and hold’ style function. This ensures that the minimum attack time is not limited by low-pass filtering, a common method of obtaining the envelope.

Parameters:
  • audio_samples – audio array

  • fs – sampling frequency

  • decay_time – decay time after peak hold

  • hold_time – hold time when identifying a decay

Returns:

envelope of audio_samples