render

maelzel.scoring.render.render(obj, struct=None, options=None, backend='', quantizationProfile=None)[source]

Quantize and render the given object obj to generate musical notation

Parameters:
  • obj (UnquantizedPart | Notation | list[UnquantizedPart] | list[Notation]) – the object to render

  • struct (Optional[ScoreStruct]) – the structure of the resulting score. To create a simple score with an anitial time signature and tempo, use something like ScoreStructure.fromTimesig((4, 4), quarterTempo=52). If not given, defaults to a 4/4 score with tempo 60

  • options (Optional[RenderOptions]) – leave as None to use default render options, or create a RenderOptions object to specify things like page size, title, pitch resolution, etc.

  • backend – The backend used for rendering. Supported backends at the moment: ‘lilypond’, ‘musicxml’

  • quantizationProfile (Optional[QuantizationProfile]) – The quantization preset determines how events are quantized, which divisions of the beat are possible, how the best division is weighted and selected, etc. Not all options in a preset are supported by all backends (for example, the musicxml backend does not support nested tuples). See quant.presetQuantizationProfiles, which is a dict with some predefined profiles

Return type:

Renderer

Returns:

a Renderer. To produce a pdf or a png call :method:`Renderer.write` on the returned Renderer, like renderer.write('outfile.pdf')