msaf.features.Features

class msaf.features.Features(file_struct, sr, hop_length, feat_type)[source]

This is the base class for all the features in MSAF.

It contains functions to automatically estimate beats, read annotated beats, compute beat-synchronous features, read and write features.

It should be straightforward to add features in MSAF, simply by writing classes that inherit from this one.

The features getter does the main job, and it returns a matrix (N, F), where N is the number of frames an F is the number of features per frames.

__init__(file_struct, sr, hop_length, feat_type)[source]

Init function for the base class to make sure all features have at least these parameters as attributes.

Parameters:

file_struct: `msaf.input_output.FileStruct`

Object containing the paths to the files.

sr: int > 0

Sampling rate of the audio file.

hop_length: int > 0

Hop in frames of the features to be computed.

feat_type: `FeatureTypes`

Enum containing the type of feature.

Methods

__init__(file_struct, sr, hop_length, feat_type) Init function for the base class to make sure all features have at least these parameters as attributes.
compute_HPSS() Computes harmonic-percussive source separation.
compute_beat_sync_features(beat_frames, ...) Make the features beat-synchronous.
compute_features()
estimate_beats() Estimates the beats using librosa.
get_id()
get_param_names() Returns the parameter names for these features, avoiding the global parameters.
read_ann_beats() Reads the annotated beats if available.
read_features([tol]) Reads the features from a file and stores them in the current object.
select_features(features_id, file_struct, ...) Selects the features from the given parameters.
write_features() Saves features to file.

Attributes

features This getter will compute the actual features if they haven’t been computed yet.
frame_times This getter returns the frame times, for the corresponding type of features.