class_docstr: Turn a normal STFT into a mel frequency STFT, using a conversion
  matrix.  This uses triangular filter banks.
  User can control which device the filter bank (fb) is (e.g. fb.to(spec_f.device)).
  Args:
      n_mels (int, optional): Number of mel filterbanks. (Default: 128)
      sample_rate (int, optional): Sample rate of audio signal. (Default: 16000)
      f_min (float, optional): Minimum frequency. (Default: 0.)
      f_max (float or None, optional): Maximum frequency.
          (Default: sample_rate // 2)
      n_stft (int, optional): Number of bins in STFT. Calculated from first input
          if None is given.  See n_fft in :class:Spectrogram.
          (Default: None)
class_docstr_tok: ["Turn","a","normal","STFT","into","a","mel","frequency","STFT",",","using","a","conversion","matrix",".","This","uses","triangular","filter","banks",".","User","can","control","which","device","the","filter","bank","(","fb",")","is","(","e.g",".","fb.to","(","spec_f.device",")",")",".","Args",":","n_mels","(","int",",","optional",")",":","Number","of","mel","filterbanks",".","(","Default",":","128",")","sample_rate","(","int",",","optional",")",":","Sample","rate","of","audio","signal",".","(","Default",":","16000",")","f_min","(","float",",","optional",")",":","Minimum","frequency",".","(","Default",":","0",".",")","f_max","(","float","or","None",",","optional",")",":","Maximum","frequency",".","(","Default",":","sample_rate","\/\/","2",")","n_stft","(","int",",","optional",")",":","Number","of","bins","in","STFT",".","Calculated","from","first","input","if","None","is","given",".","See","n_fft","in",":","class",":","Spectrogram",".","(","Default",":","None",")"]
code: def __init__(
      self,
      n_mels: int = 128,
      sample_rate: int = 24000,
      f_min: float = 0.0,
      f_max: Optional[float] = None,
      n_stft: Optional[int] = None,
  ) -> None:
      super(MelScale, self).__init__()
      self.n_mels = n_mels
      self.sample_rate = sample_rate
      self.f_max = (
          f_max if f_max is not None else float(sample_rate // 2)
      )
      self.f_min = f_min
  
      assert f_min <= self.f_max, "Require f_min: %f < f_max: %f" % (
          f_min,
          self.f_max,
      )
  
      fb = (
          torch.empty(0)
          if n_stft is None
          else create_fb_matrix(
              n_stft,
              self.f_min,
              self.f_max,
              self.n_mels,
              self.sample_rate,
          )
      )
      self.register_buffer("fb", fb)
  
imports: import logging
  import math
  from typing import Any, Dict, List, Optional
  import numpy
  import torch
  import torch.nn.functional
  from espnet2.gan_svs.visinger2.ddsp import remove_above_nyquist, scale_function, upsample
  from espnet2.gan_tts.hifigan import HiFiGANMultiPeriodDiscriminator, HiFiGANMultiScaleDiscriminator, HiFiGANMultiScaleMultiPeriodDiscriminator, HiFiGANPeriodDiscriminator, HiFiGANScaleDiscriminator
  from espnet2.gan_tts.hifigan.residual_block import ResidualBlock
label_desc: Use image node_id 1 to create a new MelScale object from inherited base classes: torch.nn with example: obj = MelScale(n_mels, sample_rate, f_min, f_max, n_stft)