def main():
    """
    This example shows how to parse a music mxl file (music21 and musescore/finale required) 
    and create a simple oracle representation. The output is a reshuffled midi stream shown
    in either musescore or finale based on your installation of music21. 
    
    OPTIONAL ARGS:
        seq_len: an integer for the length of the output sequence. 
        p: a float of the probability using the forward links.
        k: an integer for the starting state.
        LRS: an integer for the lower limit of the LRS of sfx/rsfx allowed to 
            jump to.
        weight:
            None: choose uniformly among all the possible sfx/rsfx given 
                current state.
            "max": always choose the sfx/rsfx having the longest LRS.
            "weight": choose sfx/rsfx in a way that favors longer ones than 
            shorter ones.        
    """
    filename = os.path.abspath('') + '/../files/Suite_No_1_for_Cello_M1_Prelude.mxl'
    s = music21.converter.parse(filename)
    c = s.getElementById('Violoncello')
    m = c.flat.notes
    note_obj_seq = [x for x in m if type(x) is music21.note.Note]    
    bo = vmo.build_oracle(note_obj_seq,'f')
    bo.name = 'bach_cello_example'
    
    if len(sys.argv) == 1:
        b, kend, ktrace = gen.generate(bo, len(note_obj_seq), 0.0, 0, LRS=2, weight='weight')
    else:
        seq_len = int(sys.argv[1])
        if seq_len == 0:
            seq_len = len(note_obj_seq)
        p = float(sys.argv[2])
        k = int(sys.argv[3])
        LRS = int(sys.argv[4])
        weight = sys.argv[5]
        b, kend, ktrace = gen.generate(bo, seq_len, p, k, LRS=LRS, weight=weight)

    stream1 = music21.stream.Stream()
    x = [bo.data[i] for i in b]
    for i in range(len(x)):
        _n = music21.note.Note(x[i][0].nameWithOctave)
        _n.duration.type = x[i][0].duration.type
        _n.duration = x[i][0].duration 
        stream1.append(_n)

    s.show()
    stream1.show()