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",")"]
docstr: Add spectral onset detection arguments to an existing parser.
  
  Parameters
  ----------
  parser : argparse parser instance
      Existing argparse parser object.
  onset_method : str, optional
      Default onset detection method.
  
  Returns
  -------
  parser_group : argparse argument group
      Spectral onset detection argument parser group.
docstr_tok: ["Add","spectral","onset","detection","arguments","to","an","existing","parser",".","Parameters","--","--","--","--","--","parser",":","argparse","parser","instance","Existing","argparse","parser","object",".","onset_method",":","str",",","optional","Default","onset","detection","method",".","Returns","--","--","--","-","parser_group",":","argparse","argument","group","Spectral","onset","detection","argument","parser","group","."]
code: def add_arguments(cls, parser, onset_method=None):
      """
      Add spectral onset detection arguments to an existing parser.
  
      Parameters
      ----------
      parser : argparse parser instance
          Existing argparse parser object.
      onset_method : str, optional
          Default onset detection method.
  
      Returns
      -------
      parser_group : argparse argument group
          Spectral onset detection argument parser group.
  
      """
      # add onset detection method arguments to the existing parser
      g = parser.add_argument_group(
          "spectral onset detection arguments"
      )
      if onset_method is not None:
          g.add_argument(
              "--odf",
              dest="onset_method",
              default=onset_method,
              choices=cls.METHODS,
              help="use this onset detection function "
              "[default=%(default)s]",
          )
      # return the argument group so it can be modified if needed
      return g
  
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 2 for calling the SpectralOnsetProcessor obj's underlying member method code with example usage: obj.add_arguments(cls, parser, onset_method) and returns: g