scamp_extensions.engraving.note_graph.make_intensity_gradient

scamp_extensions.engraving.note_graph.make_intensity_gradient(envelope, start_x, end_x, color_map=<function default_color_map>, value_range=None)[source]

Create an SVG linear gradient that spans horizontally from start_x to end_x, taking its color at each point from the value of the given envelope there. Used to color a note whose color parameter changes over the course of that note.

Parameters:
  • envelope – the envelope whose value determines the color along the gradient

  • start_x – x coordinate at which the gradient starts

  • end_x – x coordinate at which the gradient ends

  • color_map – function from the interval [0, 1] to an (red, green, blue) tuple

  • value_range – the (min, max) range of envelope values to map onto that interval; if None, the envelope’s values are taken to already run from 0 to 1