docstr: Energy/power based silence trimming using Librosa backend.
  Args:
      db_threshold: Audio frames at least db_threshold decibels below ref_amplitude will be
        considered silence.
      ref_amplitude: Amplitude threshold for classifying speech versus silence.
      speech_frame_threshold: Start and end of speech will be detected where there are at least
        speech_frame_threshold consecutive audio frames classified as speech. Setting this value higher
        is more robust to false-positives (silence detected as speech), but setting it too high may result
        in very short speech segments being cut out from the audio.
      trim_win_length: Length of audio frames to use when doing speech detection. This does not need to match
        the win_length used any other part of the code or model.
      trim_hop_length: Stride of audio frames to use when doing speech detection. This does not need to match
        the hop_length used any other part of the code or model.
      pad_seconds: Audio duration in seconds to keep before and after each speech segment.
        Set this to at least 0.1 to avoid cutting off any speech audio, with larger values
        being safer but increasing the average silence duration left afterwards.
      volume_norm: Whether to normalize the volume of audio before doing speech detection.
docstr_tok: ["Energy\/power","based","silence","trimming","using","Librosa","backend",".","Args",":","db_threshold",":","Audio","frames","at","least","db_threshold","decibels","below","ref_amplitude","will","be","considered","silence",".","ref_amplitude",":","Amplitude","threshold","for","classifying","speech","versus","silence",".","speech_frame_threshold",":","Start","and","end","of","speech","will","be","detected","where","there","are","at","least","speech_frame_threshold","consecutive","audio","frames","classified","as","speech",".","Setting","this","value","higher","is","more","robust","to","false-positives","(","silence","detected","as","speech",")",",","but","setting","it","too","high","may","result","in","very","short","speech","segments","being","cut","out","from","the","audio",".","trim_win_length",":","Length","of","audio","frames","to","use","when","doing","speech","detection",".","This","does","not","need","to","match","the","win_length","used","any","other","part","of","the","code","or","model",".","trim_hop_length",":","Stride","of","audio","frames","to","use","when","doing","speech","detection",".","This","does","not","need","to","match","the","hop_length","used","any","other","part","of","the","code","or","model",".","pad_seconds",":","Audio","duration","in","seconds","to","keep","before","and","after","each","speech","segment",".","Set","this","to","at","least","0.1","to","avoid","cutting","off","any","speech","audio",",","with","larger","values","being","safer","but","increasing","the","average","silence","duration","left","afterwards",".","volume_norm",":","Whether","to","normalize","the","volume","of","audio","before","doing","speech","detection","."]
code: def __init__(
      self,
      db_threshold: int = 50,
      ref_amplitude: float = 1.0,
      speech_frame_threshold: int = 1,
      trim_win_length: int = 2048,
      trim_hop_length: int = 512,
      pad_seconds: float = 0.1,
      volume_norm: bool = True,
  ) -> None:
      """Energy/power based silence trimming using Librosa backend.
      Args:
          db_threshold: Audio frames at least db_threshold decibels below ref_amplitude will be
            considered silence.
          ref_amplitude: Amplitude threshold for classifying speech versus silence.
          speech_frame_threshold: Start and end of speech will be detected where there are at least
            speech_frame_threshold consecutive audio frames classified as speech. Setting this value higher
            is more robust to false-positives (silence detected as speech), but setting it too high may result
            in very short speech segments being cut out from the audio.
          trim_win_length: Length of audio frames to use when doing speech detection. This does not need to match
            the win_length used any other part of the code or model.
          trim_hop_length: Stride of audio frames to use when doing speech detection. This does not need to match
            the hop_length used any other part of the code or model.
          pad_seconds: Audio duration in seconds to keep before and after each speech segment.
            Set this to at least 0.1 to avoid cutting off any speech audio, with larger values
            being safer but increasing the average silence duration left afterwards.
          volume_norm: Whether to normalize the volume of audio before doing speech detection.
      """
      assert db_threshold >= 0
      assert ref_amplitude >= 0
      assert speech_frame_threshold > 0
      assert trim_win_length > 0
      assert trim_hop_length > 0
  
      self.db_threshold = db_threshold
      self.ref_amplitude = ref_amplitude
      self.speech_frame_threshold = speech_frame_threshold
      self.trim_win_length = trim_win_length
      self.trim_hop_length = trim_hop_length
      self.pad_seconds = pad_seconds
      self.volume_norm = volume_norm
  
imports: from abc import ABC, abstractmethod
  from typing import Tuple
  import librosa
  import numpy
  import torch
  from nemo.collections.asr.models import EncDecClassificationModel
  from nemo.collections.tts.parts.utils.tts_dataset_utils import normalize_volume
  from nemo.utils import logging
label_desc: Use image node_id 1 to create a new EnergyAudioTrimmer object from inherited base classes: AudioTrimmer with example: obj = EnergyAudioTrimmer(db_threshold, ref_amplitude, speech_frame_threshold, trim_win_length, trim_hop_length, pad_seconds, volume_norm)