class_docstr: Downbeat tracking with RNNs and a dynamic Bayesian network (DBN)
  approximated by a Hidden Markov Model (HMM).
  
  Parameters
  ----------
  beats_per_bar : int or list
      Number of beats per bar to be modeled. Can be either a single number
      or a list or array with bar lengths (in beats).
  min_bpm : float or list, optional
      Minimum tempo used for beat tracking [bpm]. If a list is given, each
      item corresponds to the number of beats per bar at the same position.
  max_bpm : float or list, optional
      Maximum tempo used for beat tracking [bpm]. If a list is given, each
      item corresponds to the number of beats per bar at the same position.
  num_tempi : int or list, optional
      Number of tempi to model; if set, limit the number of tempi and use a
      log spacing, otherwise a linear spacing. If a list is given, each
      item corresponds to the number of beats per bar at the same position.
  transition_lambda : float or list, optional
      Lambda for the exponential tempo change distribution (higher values
      prefer a constant tempo from one beat to the next one).  If a list is
      given, each item corresponds to the number of beats per bar at the
      same position.
  observation_lambda : int, optional
      Split one (down-)beat period into `observation_lambda` parts, the first
      representing (down-)beat states and the remaining non-beat states.
  threshold : float, optional
      Threshold the RNN (down-)beat activations before Viterbi decoding.
  correct : bool, optional
      Correct the beats (i.e. align them to the nearest peak of the
      (down-)beat activation function).
  fps : float, optional
      Frames per second.
  
  References
  ----------
  .. [1] Sebastian Böck, Florian Krebs and Gerhard Widmer,
         "Joint Beat and Downbeat Tracking with Recurrent Neural Networks"
         Proceedings of the 17th International Society for Music Information
         Retrieval Conference (ISMIR), 2016.
  
  Examples
  --------
  Create a DBNDownBeatTrackingProcessor. The returned array represents the
  positions of the beats and their position inside the bar. The position is
  given in seconds, thus the expected sampling rate is needed. The position
  inside the bar follows the natural counting and starts at 1.
  
  The number of beats per bar which should be modelled must be given, all
  other parameters (e.g. tempo range) are optional but must have the same
  length as `beats_per_bar`, i.e. must be given for each bar length.
  
  >>> proc = DBNDownBeatTrackingProcessor(beats_per_bar=[3, 4], fps=100)
  >>> proc  # doctest: +ELLIPSIS
  <madmom.features.downbeats.DBNDownBeatTrackingProcessor object at 0x...>
  
  Call this DBNDownBeatTrackingProcessor with the beat activation function
  returned by RNNDownBeatProcessor to obtain the beat positions.
  
  >>> act = RNNDownBeatProcessor()('tests/data/audio/sample.wav')
  >>> proc(act)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
  array([[0.09, 1. ],
         [0.45, 2. ],
         ...,
         [2.14, 3. ],
         [2.49, 4. ]])
class_docstr_tok: ["Downbeat","tracking","with","RNNs","and","a","dynamic","Bayesian","network","(","DBN",")","approximated","by","a","Hidden","Markov","Model","(","HMM",")",".","Parameters","--","--","--","--","--","beats_per_bar",":","int","or","list","Number","of","beats","per","bar","to","be","modeled",".","Can","be","either","a","single","number","or","a","list","or","array","with","bar","lengths","(","in","beats",")",".","min_bpm",":","float","or","list",",","optional","Minimum","tempo","used","for","beat","tracking","[","bpm","]",".","If","a","list","is","given",",","each","item","corresponds","to","the","number","of","beats","per","bar","at","the","same","position",".","max_bpm",":","float","or","list",",","optional","Maximum","tempo","used","for","beat","tracking","[","bpm","]",".","If","a","list","is","given",",","each","item","corresponds","to","the","number","of","beats","per","bar","at","the","same","position",".","num_tempi",":","int","or","list",",","optional","Number","of","tempi","to","model",";","if","set",",","limit","the","number","of","tempi","and","use","a","log","spacing",",","otherwise","a","linear","spacing",".","If","a","list","is","given",",","each","item","corresponds","to","the","number","of","beats","per","bar","at","the","same","position",".","transition_lambda",":","float","or","list",",","optional","Lambda","for","the","exponential","tempo","change","distribution","(","higher","values","prefer","a","constant","tempo","from","one","beat","to","the","next","one",")",".","If","a","list","is","given",",","each","item","corresponds","to","the","number","of","beats","per","bar","at","the","same","position",".","observation_lambda",":","int",",","optional","Split","one","(","down-",")","beat","period","into","`","observation_lambda","`","parts",",","the","first","representing","(","down-",")","beat","states","and","the","remaining","non-beat","states",".","threshold",":","float",",","optional","Threshold","the","RNN","(","down-",")","beat","activations","before","Viterbi","decoding",".","correct",":","bool",",","optional","Correct","the","beats","(","i.e",".","align","them","to","the","nearest","peak","of","the","(","down-",")","beat","activation","function",")",".","fps",":","float",",","optional","Frames","per","second",".","References","--","--","--","--","--","..","[","1","]","Sebastian","B\u00f6ck",",","Florian","Krebs","and","Gerhard","Widmer",",","``","Joint","Beat","and","Downbeat","Tracking","with","Recurrent","Neural","Networks","''","Proceedings","of","the","17th","International","Society","for","Music","Information","Retrieval","Conference","(","ISMIR",")",",","2016",".","Examples","--","--","--","--","Create","a","DBNDownBeatTrackingProcessor",".","The","returned","array","represents","the","positions","of","the","beats","and","their","position","inside","the","bar",".","The","position","is","given","in","seconds",",","thus","the","expected","sampling","rate","is","needed",".","The","position","inside","the","bar","follows","the","natural","counting","and","starts","at","1",".","The","number","of","beats","per","bar","which","should","be","modelled","must","be","given",",","all","other","parameters","(","e.g",".","tempo","range",")","are","optional","but","must","have","the","same","length","as","`","beats_per_bar","`",",","i.e",".","must","be","given","for","each","bar","length",".",">",">",">","proc","=","DBNDownBeatTrackingProcessor","(","beats_per_bar=","[","3",",","4","]",",","fps=100",")",">",">",">","proc","#","doctest",":","+ELLIPSIS","<","madmom.features.downbeats.DBNDownBeatTrackingProcessor","object","at","0x","...",">","Call","this","DBNDownBeatTrackingProcessor","with","the","beat","activation","function","returned","by","RNNDownBeatProcessor","to","obtain","the","beat","positions",".",">",">",">","act","=","RNNDownBeatProcessor","(",")","(","'tests\/data\/audio\/sample.wav","'",")",">",">",">","proc","(","act",")","#","doctest",":","+ELLIPSIS","+NORMALIZE_WHITESPACE","array","(","[","[","0.09",",","1",".","]",",","[","0.45",",","2",".","]",",","...",",","[","2.14",",","3",".","]",",","[","2.49",",","4",".","]","]",")"]
code: def __init__(
      self,
      beats_per_bar,
      min_bpm=MIN_BPM,
      max_bpm=MAX_BPM,
      num_tempi=NUM_TEMPI,
      transition_lambda=TRANSITION_LAMBDA,
      observation_lambda=OBSERVATION_LAMBDA,
      threshold=THRESHOLD,
      correct=CORRECT,
      fps=None,
      **kwargs,
  ):
      # pylint: disable=unused-argument
      # pylint: disable=no-name-in-module
      # expand arguments to arrays
      beats_per_bar = np.array(beats_per_bar, ndmin=1)
      min_bpm = np.array(min_bpm, ndmin=1)
      max_bpm = np.array(max_bpm, ndmin=1)
      num_tempi = np.array(num_tempi, ndmin=1)
      transition_lambda = np.array(transition_lambda, ndmin=1)
      # make sure the other arguments are long enough by repeating them
      # TODO: check if they are of length 1?
      if len(min_bpm) != len(beats_per_bar):
          min_bpm = np.repeat(min_bpm, len(beats_per_bar))
      if len(max_bpm) != len(beats_per_bar):
          max_bpm = np.repeat(max_bpm, len(beats_per_bar))
      if len(num_tempi) != len(beats_per_bar):
          num_tempi = np.repeat(num_tempi, len(beats_per_bar))
      if len(transition_lambda) != len(beats_per_bar):
          transition_lambda = np.repeat(
              transition_lambda, len(beats_per_bar)
          )
      if not (
          len(min_bpm)
          == len(max_bpm)
          == len(num_tempi)
          == len(beats_per_bar)
          == len(transition_lambda)
      ):
          raise ValueError(
              "`min_bpm`, `max_bpm`, `num_tempi`, `num_beats` "
              "and `transition_lambda` must all have the same "
              "length."
          )
      # get num_threads from kwargs
      num_threads = min(
          len(beats_per_bar), kwargs.get("num_threads", 1)
      )
      # init a pool of workers (if needed)
      self.map = map
      if num_threads != 1:
          import multiprocessing as mp
  
          self.map = mp.Pool(num_threads).map
      # convert timing information to construct a beat state space
      min_interval = 60.0 * fps / max_bpm
      max_interval = 60.0 * fps / min_bpm
      # model the different bar lengths
      self.hmms = []
      for b, beats in enumerate(beats_per_bar):
          st = BarStateSpace(
              beats, min_interval[b], max_interval[b], num_tempi[b]
          )
          tm = BarTransitionModel(st, transition_lambda[b])
          om = RNNDownBeatTrackingObservationModel(
              st, observation_lambda
          )
          self.hmms.append(HiddenMarkovModel(tm, om))
      # save variables
      self.beats_per_bar = beats_per_bar
      self.threshold = threshold
      self.correct = correct
      self.fps = fps
  
imports: from __future__ import absolute_import, division, print_function
  import sys
  import warnings
  import numpy
  from .beats import threshold_activations
  from .beats_hmm import BarStateSpace, BarTransitionModel, GMMPatternTrackingObservationModel, MultiPatternStateSpace, MultiPatternTransitionModel, RNNBeatTrackingObservationModel, RNNDownBeatTrackingObservationModel
  from ..ml.hmm import HiddenMarkovModel
  from ..processors import ParallelProcessor, Processor, SequentialProcessor
  from ..utils import string_types
label_desc: Use image node_id 1 to create a new DBNDownBeatTrackingProcessor object from inherited base classes: Processor with example: obj = DBNDownBeatTrackingProcessor(beats_per_bar, min_bpm, max_bpm, num_tempi, transition_lambda, observation_lambda, threshold, correct, fps)