class_docstr: Vectorized version of the code in https://github.com/leo-so/VocalMelodyExtPatchCNN/blob/master/MelodyExt.py.
  This feature is described in 'Combining Spectral and Temporal Representations for Multipitch Estimation of Polyphonic Music'
  https://ieeexplore.ieee.org/document/7118691
  
  Parameters
  ----------
  fr : int
      Frequency resolution. The higher the number, the lower the resolution is.
      Maximum frequency resolution occurs when ``fr=1``. The default value is ``2``
  
  fs : int
      Sample rate of the input audio clips. The default value is ``16000``
  
  hop_length : int
      The hop (or stride) size. The default value is ``320``.
  
  window_size : str
      It is same as ``n_fft`` in other Spectrogram classes. The default value is ``2049``
  
  fc : int
      Starting frequency. For example, ``fc=80`` means that `Z` starts at 80Hz.
      The default value is ``80``.
  
  tc : int
      Inverse of ending frequency. For example ``tc=1/8000`` means that `Z` ends at 8000Hz.
      The default value is ``1/8000``.
  
  g: list
      Coefficients for non-linear activation function. ``len(g)`` should be the number of activation layers.
      Each element in ``g`` is the activation coefficient, for example ``[0.24, 0.6, 1]``.
  
  device : str
      Choose which device to initialize this layer. Default value is 'cpu'
  
  Returns
  -------
  Z : torch.tensor
      The Combined Frequency and Period Feature. It is equivalent to ``tfrLF * tfrLQ``
  
  tfrL0: torch.tensor
      STFT output
  
  tfrLF: torch.tensor
      Frequency Feature
  
  tfrLQ: torch.tensor
      Period Feature
  
  Examples
  --------
  >>> spec_layer = Spectrogram.Combined_Frequency_Periodicity()
  >>> Z, tfrL0, tfrLF, tfrLQ = spec_layer(x)
class_docstr_tok: ["Vectorized","version","of","the","code","in","https",":","\/\/github.com\/leo-so\/VocalMelodyExtPatchCNN\/blob\/master\/MelodyExt.py",".","This","feature","is","described","in","'Combining","Spectral","and","Temporal","Representations","for","Multipitch","Estimation","of","Polyphonic","Music'","https",":","\/\/ieeexplore.ieee.org\/document\/7118691","Parameters","--","--","--","--","--","fr",":","int","Frequency","resolution",".","The","higher","the","number",",","the","lower","the","resolution","is",".","Maximum","frequency","resolution","occurs","when","``","fr=1","``",".","The","default","value","is","``","2","``","fs",":","int","Sample","rate","of","the","input","audio","clips",".","The","default","value","is","``","16000","``","hop_length",":","int","The","hop","(","or","stride",")","size",".","The","default","value","is","``","320","``",".","window_size",":","str","It","is","same","as","``","n_fft","``","in","other","Spectrogram","classes",".","The","default","value","is","``","2049","``","fc",":","int","Starting","frequency",".","For","example",",","``","fc=80","``","means","that","`","Z","`","starts","at","80Hz",".","The","default","value","is","``","80","``",".","tc",":","int","Inverse","of","ending","frequency",".","For","example","``","tc=1\/8000","``","means","that","`","Z","`","ends","at","8000Hz",".","The","default","value","is","``","1\/8000","``",".","g",":","list","Coefficients","for","non-linear","activation","function",".","``","len","(","g",")","``","should","be","the","number","of","activation","layers",".","Each","element","in","``","g","``","is","the","activation","coefficient",",","for","example","``","[","0.24",",","0.6",",","1","]","``",".","device",":","str","Choose","which","device","to","initialize","this","layer",".","Default","value","is","'cpu'","Returns","--","--","--","-","Z",":","torch.tensor","The","Combined","Frequency","and","Period","Feature",".","It","is","equivalent","to","``","tfrLF","*","tfrLQ","``","tfrL0",":","torch.tensor","STFT","output","tfrLF",":","torch.tensor","Frequency","Feature","tfrLQ",":","torch.tensor","Period","Feature","Examples","--","--","--","--",">",">",">","spec_layer","=","Spectrogram.Combined_Frequency_Periodicity","(",")",">",">",">","Z",",","tfrL0",",","tfrLF",",","tfrLQ","=","spec_layer","(","x",")"]
code: def __init__(
      self,
      fr=2,
      fs=16000,
      hop_length=320,
      window_size=2049,
      fc=80,
      tc=1 / 1000,
      g=[0.24, 0.6, 1],
      NumPerOct=48,
  ):
      super().__init__()
  
      self.window_size = window_size
      self.hop_length = hop_length
  
      # variables for STFT part
      self.N = int(fs / float(fr))  # Will be used to calculate padding
      self.f = fs * np.linspace(
          0, 0.5, np.round(self.N // 2), endpoint=True
      )  # it won't be used but will be returned
      self.pad_value = self.N - window_size
      # Create window function, always blackmanharris?
      h = scipy.signal.blackmanharris(
          window_size
      )  # window function for STFT
      self.register_buffer("h", torch.tensor(h).float())
  
      # variables for CFP
      self.NumofLayer = np.size(g)
      self.g = g
      self.tc_idx = round(
          fs * tc
      )  # index to filter out top tc_idx and bottom tc_idx bins
      self.fc_idx = round(
          fc / fr
      )  # index to filter out top fc_idx and bottom fc_idx bins
      self.HighFreqIdx = int(round((1 / tc) / fr) + 1)
      self.HighQuefIdx = int(round(fs / fc) + 1)
  
      # attributes to be returned
      self.f = self.f[: self.HighFreqIdx]
      self.q = np.arange(self.HighQuefIdx) / float(fs)
  
      # filters for the final step
      (
          freq2logfreq_matrix,
          quef2logfreq_matrix,
      ) = self.create_logfreq_matrix(
          self.f, self.q, fr, fc, tc, NumPerOct, fs
      )
      self.register_buffer(
          "freq2logfreq_matrix",
          torch.tensor(freq2logfreq_matrix).float(),
      )
      self.register_buffer(
          "quef2logfreq_matrix",
          torch.tensor(quef2logfreq_matrix).float(),
      )
  
file_path: nnAudio/Installation/nnAudio/features/cfp.py
imports: import numpy
  import torch
  import torch.nn
  import time
  from ..utils import *
  import scipy
label_desc: Use image node_id 1 to create a new Combined_Frequency_Periodicity object from inherited base classes: nn with example: obj = Combined_Frequency_Periodicity(fr, fs, hop_length, window_size, fc, tc, g, NumPerOct)