Пример #1
0
def longBass(song):
    fitness = 0
    for note in song:
        pitch = midiNote.getPitch(note)
        dur = midiNote.getDur(note)
        if pitch > 59 and dur < 64: fitness += 1
        if pitch < 51 and dur > 92: fitness += 1 
    return fitness/float(len(song))*0.25
Пример #2
0
def writeNote(note, noteDict, f):
    track = midiNote.getTrack(note)
    channel = midiNote.getChan(note)
    noteStr = noteDict[midiNote.getPitch(note)]
    duration = (midiNote.getDur(note)) / 4 / 8.0
    fraction = duration.as_integer_ratio()
    wholeNum = (fraction[0]) / int(fraction[1])
    numer = fraction[0] % fraction[1]
    # output = "FOL   (BA %4d   CR %9.6f)   TR %2d   CH %2d   NT  %8s   %d+%d/%d\n"\
    #          % (bar, time, track, channel, noteStr, wholeNum, numer, fraction[1])
    output = "FOL  TR %2d   CH %2d   NT  %8s   %d+%d/%d\n" % (track, channel, noteStr, wholeNum, numer, fraction[1])
    f.write(output)