Skip to main content

weighted_bar

Function weighted_bar 

Source
pub fn weighted_bar(
    channel: Channel,
    scale: FloatType,
    shift: FloatType,
) -> (FloatType, FloatType)
Expand description

Where a bar of a weighted horizontal bar graph starts and how tall it is, scale of a full bar, shifted up or down by shift from -1 to 1: music21’s GraphHorizontalBarWeighted.renderSubplot.

use music21::graph::primitives::{Channel, weighted_bar};

let channel = Channel { start: 0.0, margin: 0.25, bar_height: 7.5 };
assert_eq!(weighted_bar(channel, 1.0, 0.0), (0.25, 7.5));
assert_eq!(weighted_bar(channel, 0.5, 0.0), (2.125, 3.75));