Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove repetitions in MEI document by duplicating the measures [Feature Request] #3912

Open
andre2007 opened this issue Jan 10, 2025 · 2 comments

Comments

@andre2007
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I have Mei file containing repetitions. I want to produce a midi file which has all the repeated parts as noted in song. I also need for this midi file the timemap and svg.

Describe the solution you'd like
Please see example here. (I removed some parts, to avoid copyright issues).
image
The song has repetitions. My idea is, to have a function which returns a new Mei document as XML.

const char *vrvToolkit_flattenRepetitions(void *tkPtr, int maxRepeatCount = 0);

The new Mei XML document has the repetitions removed and instead the measures are duplicate exactly the way how you would play it if you follow the repetition symbols. With an optional argument maxRepeatCount you can control, that instead of 5 repetitions like in the example, it should repeat only e.g. 2 times.

For the given example with maxRepeatCount = 2, you will get a new Mei document with 33 measures.

The solution is more or less duplicating and rearranging the measures within the MEI xml document.
(And removing the repetition symbols from the xml document)

@lpugin
Copy link
Contributor

lpugin commented Jan 13, 2025

If I understand correctly, this is similar to what happens with the --expand option set. However, I think this goes further in the direction of data transformation, and this might be beyond what one would reasonably expect to be available in Verovio. It would be good to hear from @wergo since he knows more about the --expand implementation.

@andre2007
Copy link
Contributor Author

I didn't find an official documentation for the expand functionality. This is my understanding, what I found out by reading the open issues for --expand

  • This functionality is a console command only, it cannot be used from the API
  • The functionality requires that there are additional marker tags in thei MEI document which controls the repetition flow
  • These additional markers are not created by the functionality but they must exist

You are completely right, this does not belongs to the base functionality of Verovio but goes to data transformation. I try currently to build this in my client code, by not requiering special markers but by analysing the ending tags / jump instructions (da capo / dal
segno ...) and so on.

What I also see, for the flattened mei document it is interesting to know, which calculated measure belongs to which source measures. S.th. like that:

["ms1": ["mc1","mc2"], "ms2": ["mc3","mc4"]]

This gives me the information:

  • For source measure ms1, the calculated measures with IDs mc1 and mc2 were created
  • For source measure ms2, the calculated measures IDs mc3 and mc4 were created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants