class_docstr: Beat tracking with RNNs and a dynamic Bayesian network (DBN) approximated
  by a Hidden Markov Model (HMM).
  
  Parameters
  ----------
  min_bpm : float, optional
      Minimum tempo used for beat tracking [bpm].
  max_bpm : float, optional
      Maximum tempo used for beat tracking [bpm].
  num_tempi : int, optional
      Number of tempi to model; if set, limit the number of tempi and use a
      log spacing, otherwise a linear spacing.
  transition_lambda : float, optional
      Lambda for the exponential tempo change distribution (higher values
      prefer a constant tempo from one beat to the next one).
  observation_lambda : int, optional
      Split one beat period into `observation_lambda` parts, the first
      representing beat states and the remaining non-beat states.
  threshold : float, optional
      Threshold the observations before Viterbi decoding.
  correct : bool, optional
      Correct the beats (i.e. align them to the nearest peak of the beat
      activation function).
  fps : float, optional
      Frames per second.
  online : bool, optional
      Use the forward algorithm (instead of Viterbi) to decode the beats.
  
  Notes
  -----
  Instead of the originally proposed state space and transition model for
  the DBN [1]_, the more efficient version proposed in [2]_ is used.
  
  References
  ----------
  .. [1] Sebastian Böck, Florian Krebs and Gerhard Widmer,
         "A Multi-Model Approach to Beat Tracking Considering Heterogeneous
         Music Styles",
         Proceedings of the 15th International Society for Music Information
         Retrieval Conference (ISMIR), 2014.
  .. [2] Florian Krebs, Sebastian Böck and Gerhard Widmer,
         "An Efficient State Space Model for Joint Tempo and Meter Tracking",
         Proceedings of the 16th International Society for Music Information
         Retrieval Conference (ISMIR), 2015.
  
  Examples
  --------
  Create a DBNBeatTrackingProcessor. The returned array represents the
  positions of the beats in seconds, thus the expected sampling rate has to
  be given.
  
  >>> proc = DBNBeatTrackingProcessor(fps=100)
  >>> proc  # doctest: +ELLIPSIS
  <madmom.features.beats.DBNBeatTrackingProcessor object at 0x...>
  
  Call this DBNBeatTrackingProcessor with the beat activation function
  returned by RNNBeatProcessor to obtain the beat positions.
  
  >>> act = RNNBeatProcessor()('tests/data/audio/sample.wav')
  >>> proc(act)
  array([0.1 , 0.45, 0.8 , 1.12, 1.48, 1.8 , 2.15, 2.49])
class_docstr_tok: ["Beat","tracking","with","RNNs","and","a","dynamic","Bayesian","network","(","DBN",")","approximated","by","a","Hidden","Markov","Model","(","HMM",")",".","Parameters","--","--","--","--","--","min_bpm",":","float",",","optional","Minimum","tempo","used","for","beat","tracking","[","bpm","]",".","max_bpm",":","float",",","optional","Maximum","tempo","used","for","beat","tracking","[","bpm","]",".","num_tempi",":","int",",","optional","Number","of","tempi","to","model",";","if","set",",","limit","the","number","of","tempi","and","use","a","log","spacing",",","otherwise","a","linear","spacing",".","transition_lambda",":","float",",","optional","Lambda","for","the","exponential","tempo","change","distribution","(","higher","values","prefer","a","constant","tempo","from","one","beat","to","the","next","one",")",".","observation_lambda",":","int",",","optional","Split","one","beat","period","into","`","observation_lambda","`","parts",",","the","first","representing","beat","states","and","the","remaining","non-beat","states",".","threshold",":","float",",","optional","Threshold","the","observations","before","Viterbi","decoding",".","correct",":","bool",",","optional","Correct","the","beats","(","i.e",".","align","them","to","the","nearest","peak","of","the","beat","activation","function",")",".","fps",":","float",",","optional","Frames","per","second",".","online",":","bool",",","optional","Use","the","forward","algorithm","(","instead","of","Viterbi",")","to","decode","the","beats",".","Notes","--","--","-","Instead","of","the","originally","proposed","state","space","and","transition","model","for","the","DBN","[","1","]","_",",","the","more","efficient","version","proposed","in","[","2","]","_","is","used",".","References","--","--","--","--","--","..","[","1","]","Sebastian","B\u00f6ck",",","Florian","Krebs","and","Gerhard","Widmer",",","``","A","Multi-Model","Approach","to","Beat","Tracking","Considering","Heterogeneous","Music","Styles","''",",","Proceedings","of","the","15th","International","Society","for","Music","Information","Retrieval","Conference","(","ISMIR",")",",","2014",".","..","[","2","]","Florian","Krebs",",","Sebastian","B\u00f6ck","and","Gerhard","Widmer",",","``","An","Efficient","State","Space","Model","for","Joint","Tempo","and","Meter","Tracking","''",",","Proceedings","of","the","16th","International","Society","for","Music","Information","Retrieval","Conference","(","ISMIR",")",",","2015",".","Examples","--","--","--","--","Create","a","DBNBeatTrackingProcessor",".","The","returned","array","represents","the","positions","of","the","beats","in","seconds",",","thus","the","expected","sampling","rate","has","to","be","given",".",">",">",">","proc","=","DBNBeatTrackingProcessor","(","fps=100",")",">",">",">","proc","#","doctest",":","+ELLIPSIS","<","madmom.features.beats.DBNBeatTrackingProcessor","object","at","0x","...",">","Call","this","DBNBeatTrackingProcessor","with","the","beat","activation","function","returned","by","RNNBeatProcessor","to","obtain","the","beat","positions",".",">",">",">","act","=","RNNBeatProcessor","(",")","(","'tests\/data\/audio\/sample.wav","'",")",">",">",">","proc","(","act",")","array","(","[","0.1",",","0.45",",","0.8",",","1.12",",","1.48",",","1.8",",","2.15",",","2.49","]",")"]
docstr: Detect the beats in the given activation function with the forward
  algorithm.
  
  Parameters
  ----------
  activations : numpy array
      Beat activation for a single frame.
  reset : bool, optional
      Reset the DBNBeatTrackingProcessor to its initial state before
      processing.
  
  Returns
  -------
  beats : numpy array
      Detected beat position [seconds].
docstr_tok: ["Detect","the","beats","in","the","given","activation","function","with","the","forward","algorithm",".","Parameters","--","--","--","--","--","activations",":","numpy","array","Beat","activation","for","a","single","frame",".","reset",":","bool",",","optional","Reset","the","DBNBeatTrackingProcessor","to","its","initial","state","before","processing",".","Returns","--","--","--","-","beats",":","numpy","array","Detected","beat","position","[","seconds","]","."]
code: def process_online(self, activations, reset=True, **kwargs):
      """
      Detect the beats in the given activation function with the forward
      algorithm.
  
      Parameters
      ----------
      activations : numpy array
          Beat activation for a single frame.
      reset : bool, optional
          Reset the DBNBeatTrackingProcessor to its initial state before
          processing.
  
      Returns
      -------
      beats : numpy array
          Detected beat position [seconds].
  
      """
      # cast as 1-dimensional array
      # Note: in online mode, activations are just float values
      activations = np.array(
          activations, copy=False, subok=True, ndmin=1
      )
      # reset to initial state
      if reset:
          self.reset()
      # use forward path to get best state
      fwd = self.hmm.forward(activations, reset=reset)
      # choose the best state for each step
      states = np.argmax(fwd, axis=1)
      # decide which time steps are beats
      beats = self.om.pointers[states] == 1
      # the positions inside the beats
      positions = self.st.state_positions[states]
      # visualisation stuff (only when called frame by frame)
      if self.visualize and len(activations) == 1:
          beat_length = 80
          display = [" "] * beat_length
          display[int(positions * beat_length)] = "*"
          # activation strength indicator
          strength_length = 10
          self.strength = int(max(self.strength, activations * 10))
          display.append("| ")
          display.extend(["*"] * self.strength)
          display.extend([" "] * (strength_length - self.strength))
          # reduce the displayed strength every couple of frames
          if self.counter % 5 == 0:
              self.strength -= 1
          # beat indicator
          if beats:
              self.beat_counter = 3
          if self.beat_counter > 0:
              display.append("| X ")
          else:
              display.append("|   ")
          self.beat_counter -= 1
          # display tempo
          display.append("| %5.1f | " % self.tempo)
          sys.stderr.write("\r%s" % "".join(display))
          sys.stderr.flush()
      # forward path often reports multiple beats close together, thus report
      # only beats more than the minimum interval apart
      beats_ = []
      for frame in np.nonzero(beats)[0]:
          cur_beat = (frame + self.counter) / float(self.fps)
          next_beat = self.last_beat + 60.0 / self.max_bpm
          # FIXME: this skips the first beat, but maybe this has a positive
          #        effect on the overall beat tracking accuracy
          if cur_beat >= next_beat:
              # update tempo
              self.tempo = 60.0 / (cur_beat - self.last_beat)
              # update last beat
              self.last_beat = cur_beat
              # append to beats
              beats_.append(cur_beat)
      # increase counter
      self.counter += len(activations)
      # return beat(s)
      return np.array(beats_)
  
imports: from __future__ import absolute_import, division, print_function
  import sys
  import numpy
  from ..audio.signal import signal_frame, smooth
  from ..ml.nn import average_predictions
  from ..processors import OnlineProcessor, ParallelProcessor, Processor, SequentialProcessor
label_desc: Use image node_id 4 for calling the DBNBeatTrackingProcessor obj's underlying member method code with example usage: obj.process_online(activations, reset) and returns: np