I am developing an application which requires me to render each measure of a piece separately so that I can flexibly position each measure on the screen.
Assume we have this sheet music:
Visualizing this within a single OSMD instance would like this:

I use the GeneralObjectExporter from music21 to extract the single measures as separate musicxml sheets so that I can render each measure as a separate OSMD instances. With this, I try to achieve visual entities that I can display and transition on the screen independent of each other:

I want to display each measure now with the same visual options, so that I can display them neatly next to each other as if they have been rendered in a single OSMD instance.
I assume, one of the biggest issues are the additional articulation elements and diminiuendo or crescendo, which require additional space. I do not care about overlapping, if that would be the other option.
I could not find any settings of OSMD's engravingRules which allows me to force the distance between the two staffs in this example.
In addition, I would like to remove the clefs and time signature, and only show it for the first measure, similar to this:

Can you provide me some further information, on how I could
1.: Force a common distance (incl. margin, padding) so that I can place all measure neatly next to each other?
2.: Use settings to remove unwanted elements (Clefs, Time & Key Signature)?
Any other ideas, on how I could achieve what I want?
edit:
this.fixStafflineBoundingBox = false; // TODO temporary workaround
I found this line in the EngravingRules class. Could this be used (if set to true) to fix the described issue?
dear @byebb thanks for your question and good description.
As OSMD is a Layout-Engine for complete sheets, it would not make very much sense to adapt for your use case. It would be quite some effort for us and i don't think many people will need the same options.
For me it sounds, as there would be a better way for what you are planning to do. So my question would be why you first want to split a musicXML into its measures to render them then finally next to each other again.
If you actually only want to know the coordinates of each measure: we have all coordinates of nearly all objects in the BoundingBox object which is a member in our GraphicalObjects (like each measure, staffentry, note...)
If you use our layout engine only for single measures, each measure will be layouted on its own and will have different vertical size - but switching off the layouting will lead to collisions of objects at some positions (e.g. low note in right hand staff - high note in left hand staff).
So maybe you could tell more what you finally want to achieve and then we might come to a much better solution (you can also email me, if it should not be public: [email protected])
I agree with @matt-uib, if you give 13 OSMD instances 13 individual MusicXML sheets, you will get 13 different (complete) sheets rendered.
OSMD isn't made for not rendering sheets. Circumventing all the logic that assumes this would be quite the effort. Also, it would be difficult to coordinate rendering to the same height across multiple OSMD renders/instances, plus we'd have to make Vexflow render to a certain height.
You can already make the time signature invisible though (print-object="no").
Maybe we could do the same for clef and key signature (see #390).
Here's a sample:
invisible_time_key_signature_clef.musicxml.txt
edit:
this.fixStafflineBoundingBox = false; // TODO temporary workaroundI found this line in the EngravingRules class. Could this be used (if set to true) to fix the described issue?
You can set this via osmd.EngravingRules.FixStafflineBoundingBox = true, but it will only lead to less wasted space below some systems with multiple stafflines (e.g. piano), it won't fix your issue.
If you don't care about the image output size, you can simply set:
EngravingRules.StaffDistance = 30 (or more)
EngravingRules.BetweenStaffDistance = 30 (or more)
Here what comes out for 20:

Still there are differences from system to system, so a little change in the OSMD code would still be required, to really always have the staves at equal y-positions per system.
I am developing an application which requires me to render each measure of a piece separately so that I can flexibly position each measure on the screen.
Assume we have this sheet music:
Visualizing this within a single OSMD instance would like this:
I use the GeneralObjectExporter from music21 to extract the single measures as separate musicxml sheets so that I can render each measure as a separate OSMD instances. With this, I try to achieve visual entities that I can display and transition on the screen independent of each other:
I want to display each measure now with the same visual options, so that I can display them neatly next to each other as if they have been rendered in a single OSMD instance.
I assume, one of the biggest issues are the additional articulation elements and diminiuendo or crescendo, which require additional space. I do not care about overlapping, if that would be the other option.I could not find any settings of OSMD's engravingRules which allows me to force the distance between the two staffs in this example.
In addition, I would like to remove the clefs and time signature, and only show it for the first measure, similar to this:
Can you provide me some further information, on how I could
1.: Force a common distance (incl. margin, padding) so that I can place all measure neatly next to each other?
2.: Use settings to remove unwanted elements (Clefs, Time & Key Signature)?Any other ideas, on how I could achieve what I want?
edit:
this.fixStafflineBoundingBox = false; // TODO temporary workaroundI found this line in the EngravingRules class. Could this be used (if set to true) to fix the described issue?
I think you have the same needs. You need to divide a score into pieces for practice. You can try this

I have some code which renders a score - puts the rendering into one frame, then renders the same or another score and lets you view or print both at the same time.
Would this be of help?
Most helpful comment
dear @byebb thanks for your question and good description.
As OSMD is a Layout-Engine for complete sheets, it would not make very much sense to adapt for your use case. It would be quite some effort for us and i don't think many people will need the same options.
For me it sounds, as there would be a better way for what you are planning to do. So my question would be why you first want to split a musicXML into its measures to render them then finally next to each other again.
If you actually only want to know the coordinates of each measure: we have all coordinates of nearly all objects in the BoundingBox object which is a member in our GraphicalObjects (like each measure, staffentry, note...)
If you use our layout engine only for single measures, each measure will be layouted on its own and will have different vertical size - but switching off the layouting will lead to collisions of objects at some positions (e.g. low note in right hand staff - high note in left hand staff).
So maybe you could tell more what you finally want to achieve and then we might come to a much better solution (you can also email me, if it should not be public: [email protected])