- class maelzel.scoring.renderer.Renderer(score, options)[source]¶
Renders a quantizedscore to a given format
This is an abstract base class for different backend renderers (lilypond, musicxml, etc)
- musicxml()[source]¶
Returns the rendered score as musicxml if supported
- Return type:
str|None- Returns:
either the musicxml as str, or None if not supported by this renderer
-
options:
RenderOptions¶ The render options used
-
quantizedScore:
QuantizedScore¶ The quantized score used for rendering
- abstract render(options=None)[source]¶
Render the quantized score
Note
The result is internally cached so calling this method multiple times only performs the rendering once as long as the options used do not change
- Parameters:
options (
Optional[RenderOptions]) – if given, these options override the own options- Return type:
str- Returns:
the rendered score, as text. This will be lilypond text if the renderer is a LilypondRenderer, or musicxml text in the case of a MusicxmlRenderer
- show(fmt='png', external=False, scalefactor=1.0)[source]¶
Display the rendered score
- Parameters:
fmt – one of ‘png’, ‘pdf’
external – if True, for the use of an external app to open the rendered result. Otherwise, if running inside jupyter this command will try to display the result inline
scalefactor – a factor to scale the generated image when shown inline
- Return type:
None
-
struct:
ScoreStruct¶ The ScoreStruct used for rendering
- abstract write(outfile, fmt='', removeTemporaryFiles=False)[source]¶
Write the rendered score to a file
- Parameters:
outfile (
str) – the path to the written filefmt – if given, this will be used as format for the output, independent of the extension used in outfile. The possible values depend on the formats supported by this Renderer (see
Renderer.writeFormats())removeTemporaryFiles – if True, removes any temporary files generated during the rendering/writing process
- Return type:
None