Exemple #1
0
def EvalNotes(phrases, output_filepath=None):
    ''' 
    Plays the notes
    '''
    if output_filepath:
        a = ot.startRecording(output_filepath)
    masterlist = defaultdict(list) 
    for phrase in phrases:
        for instr in phrase.keys():
            masterlist[instr].extend(phrase[instr])
    commonTime = ot.getCommonTime()
    for index, notelist in enumerate(masterlist.values()):
        try:
            if index == len(masterlist.values()) - 1:
                ot.playNotes(notelist, True, commonTime, False)
            else:
                ot.playNotes(notelist, False, commonTime, False)
        except:
            pass
Exemple #2
0
def EvalNotes(phrases, output_filepath=None):
    '''
    Evaluates notes and plays them
    '''
    a = ot.startOvertone()

    if output_filepath:
        a = ot.startRecording(output_filepath)
    masterlist = defaultdict(list) 
    for phrase in phrases:
        # Add notes to the master notelist
        for instr in phrase.keys():
            masterlist[instr].extend(phrase[instr])
    # Get a common time
    commonTime = ot.getCommonTime()
    for index, notelist in enumerate(masterlist.values()):
        # Play the notes!
        try:
            if index == len(masterlist.values()) - 1:
                ot.playNotes(notelist, True, commonTime, True)
            else:
                ot.playNotes(notelist, False, commonTime, False)
        except Exception:
            pass