class_docstr: The SpectralOnsetProcessor class implements most of the common onset
  detection functions based on the magnitude or phase information of a
  spectrogram.
  
  Parameters
  ----------
  onset_method : str, optional
      Onset detection function. See `METHODS` for possible values.
  kwargs : dict, optional
      Keyword arguments passed to the pre-processing chain to obtain a
      spectral representation of the signal.
  
  Notes
  -----
  If the spectrogram should be filtered, the `filterbank` parameter must
  contain a valid Filterbank, if it should be scaled logarithmically, `log`
  must be set accordingly.
  
  References
  ----------
  .. [1] Paul Masri,
         "Computer Modeling of Sound for Transformation and Synthesis of
         Musical Signals",
         PhD thesis, University of Bristol, 1996.
  .. [2] Sebastian Böck and Gerhard Widmer,
         "Maximum Filter Vibrato Suppression for Onset Detection",
         Proceedings of the 16th International Conference on Digital Audio
         Effects (DAFx), 2013.
  
  Examples
  --------
  
  Create a SpectralOnsetProcessor and pass a file through the processor to
  obtain an onset detection function. Per default the spectral flux [1]_ is
  computed on a simple Spectrogram.
  
  >>> sodf = SpectralOnsetProcessor()
  >>> sodf  # doctest: +ELLIPSIS
  <madmom.features.onsets.SpectralOnsetProcessor object at 0x...>
  >>> sodf.processors[-1]  # doctest: +ELLIPSIS
  <function spectral_flux at 0x...>
  >>> sodf('tests/data/audio/sample.wav')
  ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
  array([ 0. , 100.90121, ..., 26.30577, 20.94439], dtype=float32)
  
  The parameters passed to the signal pre-processing chain can be set when
  creating the SpectralOnsetProcessor. E.g. to obtain the SuperFlux [2]_
  onset detection function set these parameters:
  
  >>> from madmom.audio.filters import LogarithmicFilterbank
  >>> sodf = SpectralOnsetProcessor(onset_method='superflux', fps=200,
  ...                               filterbank=LogarithmicFilterbank,
  ...                               num_bands=24, log=np.log10)
  >>> sodf('tests/data/audio/sample.wav')
  ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
  array([ 0. , 0. , 2.0868 , 1.02404, ..., 0.29888, 0.12122], dtype=float32)
class_docstr_tok: ["The","SpectralOnsetProcessor","class","implements","most","of","the","common","onset","detection","functions","based","on","the","magnitude","or","phase","information","of","a","spectrogram",".","Parameters","--","--","--","--","--","onset_method",":","str",",","optional","Onset","detection","function",".","See","`","METHODS","`","for","possible","values",".","kwargs",":","dict",",","optional","Keyword","arguments","passed","to","the","pre-processing","chain","to","obtain","a","spectral","representation","of","the","signal",".","Notes","--","--","-","If","the","spectrogram","should","be","filtered",",","the","`","filterbank","`","parameter","must","contain","a","valid","Filterbank",",","if","it","should","be","scaled","logarithmically",",","`","log","`","must","be","set","accordingly",".","References","--","--","--","--","--","..","[","1","]","Paul","Masri",",","``","Computer","Modeling","of","Sound","for","Transformation","and","Synthesis","of","Musical","Signals","''",",","PhD","thesis",",","University","of","Bristol",",","1996",".","..","[","2","]","Sebastian","B\u00f6ck","and","Gerhard","Widmer",",","``","Maximum","Filter","Vibrato","Suppression","for","Onset","Detection","''",",","Proceedings","of","the","16th","International","Conference","on","Digital","Audio","Effects","(","DAFx",")",",","2013",".","Examples","--","--","--","--","Create","a","SpectralOnsetProcessor","and","pass","a","file","through","the","processor","to","obtain","an","onset","detection","function",".","Per","default","the","spectral","flux","[","1","]","_","is","computed","on","a","simple","Spectrogram",".",">",">",">","sodf","=","SpectralOnsetProcessor","(",")",">",">",">","sodf","#","doctest",":","+ELLIPSIS","<","madmom.features.onsets.SpectralOnsetProcessor","object","at","0x","...",">",">",">",">","sodf.processors","[","-1","]","#","doctest",":","+ELLIPSIS","<","function","spectral_flux","at","0x","...",">",">",">",">","sodf","(","'tests\/data\/audio\/sample.wav","'",")","...","#","doctest",":","+NORMALIZE_WHITESPACE","+ELLIPSIS","array","(","[","0.",",","100.90121",",","...",",","26.30577",",","20.94439","]",",","dtype=float32",")","The","parameters","passed","to","the","signal","pre-processing","chain","can","be","set","when","creating","the","SpectralOnsetProcessor",".","E.g",".","to","obtain","the","SuperFlux","[","2","]","_","onset","detection","function","set","these","parameters",":",">",">",">","from","madmom.audio.filters","import","LogarithmicFilterbank",">",">",">","sodf","=","SpectralOnsetProcessor","(","onset_method='superflux","'",",","fps=200",",","...","filterbank=LogarithmicFilterbank",",","...","num_bands=24",",","log=np.log10",")",">",">",">","sodf","(","'tests\/data\/audio\/sample.wav","'",")","...","#","doctest",":","+NORMALIZE_WHITESPACE","+ELLIPSIS","array","(","[","0.",",","0.",",","2.0868",",","1.02404",",","...",",","0.29888",",","0.12122","]",",","dtype=float32",")"]
code: def __init__(self, onset_method="spectral_flux", **kwargs):
      import inspect
      from ..audio.signal import SignalProcessor, FramedSignalProcessor
      from ..audio.stft import ShortTimeFourierTransformProcessor
      from ..audio.spectrogram import (
          SpectrogramProcessor,
          FilteredSpectrogramProcessor,
          LogarithmicSpectrogramProcessor,
      )
  
      # for certain methods we need to circular shift the signal before STFT
      if any(odf in onset_method for odf in ("phase", "complex")):
          kwargs["circular_shift"] = True
      # always use mono signals
      kwargs["num_channels"] = 1
      # define processing chain
      sig = SignalProcessor(**kwargs)
      frames = FramedSignalProcessor(**kwargs)
      stft = ShortTimeFourierTransformProcessor(**kwargs)
      spec = SpectrogramProcessor(**kwargs)
      processors = [sig, frames, stft, spec]
      # filtering needed?
      if (
          "filterbank" in kwargs.keys()
          and kwargs["filterbank"] is not None
      ):
          processors.append(FilteredSpectrogramProcessor(**kwargs))
      # scaling needed?
      if "log" in kwargs.keys() and kwargs["log"] is not None:
          processors.append(LogarithmicSpectrogramProcessor(**kwargs))
      # odf function
      if not inspect.isfunction(onset_method):
          try:
              onset_method = globals()[onset_method]
          except KeyError:
              raise ValueError(
                  "%s not a valid onset detection function, "
                  "choose %s." % (onset_method, self.METHODS)
              )
          processors.append(onset_method)
      # instantiate a SequentialProcessor
      super(SpectralOnsetProcessor, self).__init__(processors)
  
imports: from __future__ import absolute_import, division, print_function
  import numpy
  from scipy.ndimage import maximum_filter, minimum_filter, uniform_filter
  from ..audio.signal import smooth
  from ..processors import BufferProcessor, OnlineProcessor, ParallelProcessor, SequentialProcessor
  from ..utils import combine_events
label_desc: Use image node_id 1 to create a new SpectralOnsetProcessor object from inherited base classes: SequentialProcessor with example: obj = SpectralOnsetProcessor(onset_method)