def _preprocess(self, valid_features=["hpcp", "tonnetz", "mfcc", "cqt", "tempogram"], normalize=True): """This method obtains the actual features.""" # Read features if self.features is None: self.features = io.get_features(self.audio_file, annot_beats=self.annot_beats, framesync=self.framesync) # Use specific feature if self.feature_str not in valid_features: raise RuntimeError("Feature %s in not valid for algorithm: %s " "(valid features are %s)." % (self.feature_str, __name__, valid_features)) else: try: F = self.features[self.feature_str] except KeyError: raise RuntimeError("Feature %s in not supported by MSAF" % (self.feature_str)) # Normalize if needed if normalize: F = U.lognormalize_chroma(F) return F
def _preprocess(self, valid_features=["hpcp", "tonnetz", "mfcc", "cqt"], normalize=True): """This method obtains the actual features.""" # Read features if self.features is None: self.features = io.get_features(self.audio_file, annot_beats=self.annot_beats, framesync=self.framesync) # Use specific feature if self.feature_str not in valid_features: raise RuntimeError("Feature %s in not valid for algorithm: %s " "(valid features are %s)." % (self.feature_str, __name__, valid_features)) else: try: F = self.features[self.feature_str] except KeyError: raise RuntimeError("Feature %s in not supported by MSAF" % (self.feature_str)) # Normalize if needed if normalize: F = U.lognormalize_chroma(F) return F
def _preprocess(self, valid_features=["hpcp", "tonnetz", "mfcc", "cqt", "gmt"], normalize=True): """This method obtains the actual features.""" # Read features self.hpcp, self.mfcc, self.tonnetz, self.cqt, self.gmt, beats, dur, self.anal = \ io.get_features(self.audio_file, annot_beats=self.annot_beats, framesync=self.framesync, pre_features=self.features) # Use specific feature if self.feature_str not in valid_features: raise RuntimeError("Feature %s in not valid for algorithm: %s " "(valid features are %s)." % (self.feature_str, __name__, valid_features)) else: try: F = eval("self." + self.feature_str) except: raise RuntimeError("Feature %s in not supported by MSAF" % (self.feature_str)) # Normalize if needed if normalize: F = U.lognormalize_chroma(F) return F
def _preprocess(self, valid_features=["hpcp", "tonnetz", "mfcc", "cqt"], normalize=True): """This method obtains the actual features.""" # Read features self.hpcp, self.mfcc, self.tonnetz, self.cqt, beats, dur, self.anal = \ io.get_features(self.audio_file, annot_beats=self.annot_beats, framesync=self.framesync, pre_features=self.features) # Use specific feature if self.feature_str not in valid_features: raise RuntimeError("Feature %s in not valid for algorithm: %s " "(valid features are %s)." % (self.feature_str, __name__, valid_features)) else: try: F = eval("self." + self.feature_str) except: raise RuntimeError("Feature %s in not supported by MSAF" % (self.feature_str)) # Normalize if needed if normalize: F = U.lognormalize_chroma(F) return F
def _preprocess(self, valid_features=["hpcp", "tonnetz", "mfcc"], normalize=True): """This method obtains the actual features, their frame times, and the boundary indeces in these features if needed.""" # Read features if self.features is None: # Features stored in a json file self.hpcp, self.mfcc, self.tonnetz, beats, dur, anal = \ io.get_features(self.audio_file, annot_beats=self.annot_beats, framesync=self.framesync) else: # Features passed as parameters feat_prefix = "" if not self.framesync: feat_prefix = "bs_" self.hpcp = self.features["%shpcp" % feat_prefix] self.mfcc = self.features["%smfcc" % feat_prefix] self.tonnetz = self.features["%stonnetz" % feat_prefix] beats = self.features["beats"] dur = self.features["anal"]["dur"] anal = self.features["anal"] # Store analysis parameters self.anal = anal # Use correct frames to find times frame_times = beats if self.framesync: frame_times = U.get_time_frames(dur, anal) # Read input bounds if necessary bound_idxs = None if self.in_bound_times is not None: bound_idxs = io.align_times(self.in_bound_times, frame_times) bound_idxs = np.unique(bound_idxs) # Use specific feature if self.feature_str not in valid_features: raise RuntimeError("Feature %s in not valid for algorithm: %s " "(valid features are %s)." % (self.feature_str, __name__, valid_features)) else: try: F = eval("self." + self.feature_str) except: raise RuntimeError("Feature %s in not supported by MSAF" % (self.feature_str)) # Normalize if needed if normalize: F = U.lognormalize_chroma(F) return F, frame_times, dur, bound_idxs
def _preprocess( self, valid_features=["pcp", "tonnetz", "mfcc", "cqt", "tempogram"], normalize=True): """This method obtains the actual features.""" # Use specific feature if self.feature_str not in valid_features: raise RuntimeError("Feature %s in not valid for algorithm: %s " "(valid features are %s)." % (self.feature_str, __name__, valid_features)) else: try: F = self.features.features except KeyError: raise RuntimeError("Feature %s in not supported by MSAF" % (self.feature_str)) # Normalize if needed if normalize: F = U.lognormalize_chroma(F) return F