cuthbertLab/music21

Control layout settings and scaling in renders

Closed this issue · 1 comments

music21 version
8.3.0

Problem summary
I want to control how images are rendered with show(). I use MuseScore 3 which should pay attention to layout parameters. I want to control the scaling of tenths in particular and the page width (to control how stretched bars are drawn)

Steps to reproduce
I tried both setting up a custom layout object and changing the scale parameter in the show method directly, but nothing affects the final render. Why doesn't MuseScore use these parameters? Does this work with other software like lilypond or am I just doing this the wrong way. Couldn't find anything in the docs about it.

score = converter.parse("some file.musicxml")

page_layout = layout.PageLayout(pageHeight=297, pageWidth=210, topMargin=40, bottomMargin=40, leftMargin=40, rightMargin=40, scalingTenths=30)
score.metadata.pageLayout = page_layout

score.show(scale=2)

pageLayout is not an attribute of the metadata object. Try inserting the PageLayout objects into your measures instead.

If you grep the codebase for "pageLayout" you'll see several doctests and sample files.