Exemplo n.º 1
0
def predict(input_file):
    model = HMMPredictor(feature_type     = "crp",
                         model_path       = os.path.join(MODEL_DIR, "uniformcrp"),
                         lda              = None,
                         window_size      = 4410,
                         variance_filter  = 0.16,
                         min_frames       = 4,
                         plot_variance    = False,
                         frame_split      = None,
                         group_filter     = 4,
                         max_count_filter = True)

    predictions = model.run(input_file)

    if predictions is not None and len(predictions):
        return chord.decode(int(predictions[0]));
    else:
        return ""
Exemplo n.º 2
0
    # same as model = default_crp()
    model = HMMPredictor(feature_type     = "crp",
                         model_path       = os.path.join(MODEL_DIR, "uniformcrp"),
                         lda              = None,
                         window_size      = 4410,
                         variance_filter  = 0.16,
                         min_frames       = 4,
                         plot_variance    = False,
                         frame_split      = None,
                         group_filter     = 4,
                         max_count_filter = True)
    
    predictions = model.run(input_file)

    if predictions is not None and len(predictions):
        print chord.decode(int(predictions[0]));
    else:
        print ""

    # parameters can be changed here and parts of the model rerun.
    #
    # update number of frames to group:
    #
    # predictions.frame_split = 7
    # predictions.process_features()
    # predictions.predict()
    # 
    # update group filter:
    #
    # predictions.group_filter = 5
    # predictions.predict()