Skip to content

Commit

Permalink
renaming online histogram methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Böck committed Jul 23, 2017
1 parent 75b56ae commit 48d0cf8
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions madmom/features/tempo.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def process_online(self, activations, reset=True, **kwargs):
# iterate over all activations
for activation in activations:
# build the tempo histogram depending on the chosen method
histogram = self.online_interval_histogram(activation, reset=reset)
histogram = self.interval_histogram_online(activation, reset=reset)
# smooth the histogram
histogram = smooth_histogram(histogram, self.hist_smooth)
# detect the tempo and append it to the found tempi
Expand Down Expand Up @@ -387,14 +387,14 @@ def interval_histogram(self, activations):
"""
raise NotImplementedError('Must be implemented by subclass.')

def online_interval_histogram(self, activation, reset=True):
def interval_histogram_online(self, activations, reset=True):
"""
Compute the histogram of the beat intervals for online mode.
Needs to be implemented by subclass.
Parameters
----------
activation : numpy float
activations : numpy float
Beat activation function processed frame by frame.
reset : bool, optional
Reset the TempoEstimationProcessor to its initial state before
Expand Down Expand Up @@ -699,14 +699,14 @@ def interval_histogram(self, activations):
return interval_histogram_comb(activations, self.alpha,
self.min_interval, self.max_interval)

def online_interval_histogram(self, activation, reset=True):
def interval_histogram_online(self, activations, reset=True):
"""
Compute the histogram of the beat intervals using a resonating
comb filter bank for online mode.
Parameters
----------
activation : numpy float
activations : numpy float
Beat activation function processed frame by frame.
reset : bool, optional
Reset the CombTempoEstimationProcessor to its initial state before
Expand All @@ -718,14 +718,15 @@ def online_interval_histogram(self, activation, reset=True):
Bins of the tempo histogram.
histogram_delays : numpy array
Corresponding delays [frames].
"""
# reset to initial state
if reset:
self.reset()
# expand the activation for every tau
activation = np.full(len(self.intervals), activation, dtype=np.float)
activations = np.full(len(self.intervals), activations, dtype=np.float)
# append it to the comb filter matrix
self.combfilter_matrix.append(activation)
self.combfilter_matrix.append(activations)
# online feed backward comb filter
min_tau = self.min_interval
for t in self.intervals:
Expand Down Expand Up @@ -874,14 +875,14 @@ def interval_histogram(self, activations):
return interval_histogram_acf(activations, self.min_interval,
self.max_interval)

def online_interval_histogram(self, activation, reset=True):
def interval_histogram_online(self, activations, reset=True):
"""
Compute the histogram of the beat intervals using auto-correlation in
online mode.
Parameters
----------
activation : numpy float
activations : numpy float
Beat activation function processed frame by frame.
reset : bool, optional
Reset the ACFTempoEstimationProcessor to its initial state before
Expand Down Expand Up @@ -1004,14 +1005,14 @@ def interval_histogram(self, activations):
# build a histogram together with the intervals and return it
return bins, self.dbn.st.intervals

def online_interval_histogram(self, activation, reset=True):
def interval_histogram_online(self, activations, reset=True):
"""
Compute the histogram of the beat intervals using a DBN and the
forward algorithm.
Parameters
----------
activation : numpy float
activations : numpy float
Beat activation function processed frame by frame.
reset : bool, optional
Reset the DBNTempoEstimationProcessor to its initial state before
Expand All @@ -1029,7 +1030,7 @@ def online_interval_histogram(self, activation, reset=True):
if reset:
self.reset()
# use forward path to get best state
fwd = self.dbn.hmm.forward(activation, reset=reset)
fwd = self.dbn.hmm.forward(activations, reset=reset)
# choose the best state for each step
states = np.argmax(fwd, axis=1)
intervals = self.dbn.st.state_intervals[states]
Expand Down

0 comments on commit 48d0cf8

Please sign in to comment.