Skip to main content

slice_weights

Function slice_weights 

Source
pub fn slice_weights(
    slices: &[MeasureSlice],
    meter: &TimeSignature,
    padding_left: FloatType,
    weigher: &SliceWeigher,
    allowable: &[Vec<u8>],
    forbidden: &[Vec<u8>],
) -> Result<Vec<(Vec<u8>, FloatType)>>
Expand description

What each set of sorted pitch classes sounding among slices weighs, in the order they are met: music21’s sliceWeights.

Each slice is weighed by weigher, given its length, the meter’s accent where it starts – read past the measure’s padding_left, so that a pickup is accented as the end of a bar – whether it is the last that sounds, and whether it is consonant as is_consonant reads it with the allowable and forbidden interval-class sets.

§Errors

A meter that cannot weigh where a slice starts.