Esempio n. 1
0
def meanTimbre(segments, beats): 
    """ 
    Returns a timbre vector that is the mean of the timbre vectors of any segments  
    that overlap this AudioQuantum. 
    """ 
    timbre = []
    for beat in beats:
        temp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        segs = segments.that(selection.are_contained_by(beat))
        if(len(segs) == 0): segs = segments.that(selection.start_during(beat))
        if(len(segs) == 0): segs = segments.that(selection.overlap(beat))
        for seg in segs:
            for index, tim in enumerate(seg.pitches): 
                temp[index] = temp[index] + tim
        timbre.append([float(tim / len(segs)) for tim in temp])
    return timbre
Esempio n. 2
0
def meanLoudness(segments, beats): 
    """ 
    Returns a loudness vector that is the mean of the loudness values of any segments  
    that overlap this AudioQuantum. 
    """ 
    loudness = []
    for beat in beats:
        segs = segments.that(selection.are_contained_by(beat))
        if(len(segs) == 0): segs = segments.that(selection.start_during(beat))
        if(len(segs) == 0): segs = segments.that(selection.overlap(beat))
        values = [seg.loudness_max for seg in segments.that(selection.are_contained_by
                                                            (beat))]
        loudness.append([sum(values)/len(segs)]*6)
    return loudness

    """
Esempio n. 3
0
def meanPitches(segments, beats): 
    """ 
    Returns a pitch vector that is the mean of the pitch vectors of any segments
    that overlap this AudioQuantum. 
    """ 
    pitches = []
    for beat in beats:
        temp_pitches = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        segs = segments.that(selection.are_contained_by(beat))
        if(len(segs) == 0): segs = segments.that(selection.start_during(beat))
        if(len(segs) == 0): segs = segments.that(selection.overlap(beat))
        for seg in segs:
            for index, pitch in enumerate(seg.pitches): 
                temp_pitches[index] = temp_pitches[index] + pitch 
        pitches.append([float(pitch / len(segs)) for pitch in temp_pitches])
    return pitches