scamp_extensions.engraving.note_graph.PartNoteGraph

class scamp_extensions.engraving.note_graph.PartNoteGraph(performance_part: ~scamp.performance.PerformancePart, height_parameter: str = 'pitch', height_parameter_range: ~typing.Optional[~typing.Tuple[~numbers.Real, ~numbers.Real]] = None, width_parameter: str = 'volume', width_parameter_range: ~typing.Optional[~typing.Tuple[~numbers.Real, ~numbers.Real]] = None, width_range: ~typing.Tuple[~numbers.Real, ~numbers.Real] = (1, 20), color_parameter: ~typing.Optional[str] = None, color_parameter_range: ~typing.Optional[~typing.Tuple[~numbers.Real, ~numbers.Real]] = None, color_map: ~typing.Callable[[~numbers.Real], ~typing.Tuple[~numbers.Real, ~numbers.Real, ~numbers.Real]] = <function default_color_map>, time_range: ~typing.Optional[~typing.Tuple[~numbers.Real, ~numbers.Real]] = None, fill_color: str = 'black', outline_color: str = 'black', outline_width: ~numbers.Real = 1, guide_lines: ~typing.Sequence[~numbers.Real] = (), guide_line_width: ~numbers.Real = 2, guide_line_color: str = 'black', attack_only: bool = False)[source]

Bases: object

Class that takes a performance part and a bunch of drawing/visualization settings, and can render to a class:svgDraw.Drawing.

Parameters:
  • performance_part – the PerformancePart on which to base this note graph

  • height_parameter – the playback parameter of that governs each note’s height on the graph; defaults to pitch

  • height_parameter_range – range of values expected from the parameter that governs height. If the parameter is pitch, defaults to the min and max pitch found in the part. Otherwise defaults to (0, 1).

  • width_parameter – the playback parameter of that governs each note’s width on the graph; defaults to volume

  • width_parameter_range – range of values expected from the parameter that governs width. If the parameter is pitch, defaults to the min and max pitch found in the part. Otherwise defaults to (0, 1).

  • width_range – range of note widths mapped to in the drawing

  • color_parameter – the parameter governing note color, if any (overrides fill_color); inactive by default

  • color_parameter_range – range of values expected from the parameter that governs color. If the parameter is pitch, defaults to the min and max pitch found in the part. Otherwise defaults to (0, 1).

  • color_map – function from the interval [0, 1] to an RGB color tuple, where 0 represents the color parameter at the bottom of its range and 1 at the top.

  • time_range – time range to map horizontal space to; defaults to 0 to length of part

  • fill_color – the fill color of note glyphs; overridden by color parameter, if active

  • outline_color – note outline color

  • outline_width – note outline width

  • guide_lines – the values of the height parameter at which to draw horizontal guide lines.

  • guide_line_width – width of the guide lines

  • guide_line_color – color of the guide lines

  • attack_only – if true, only draw the attack of each note as a circle.

Methods

render(drawing, bottom_left, dimensions)

render_to_file(file_path, dimensions[, ...])

render(drawing: Drawing, bottom_left: Tuple[Real, Real], dimensions: Tuple[Real, Real])[source]
render_to_file(file_path, dimensions, bg_color=None, h_padding=100, v_padding=100, pixel_scale=2)[source]