-
Notifications
You must be signed in to change notification settings - Fork 8
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
[myank] Chord at end of range converts to note #71
Comments
Also ties disappear at the end of an extracted range: **kern
*M4/4
=1
1c 1e 1g
=2
1d 1f 1a
=3
[1e [1g [1b
=4
1e] 1g] 1b]
=5
1g 1b 1dd
==
*- Probably other elements such as articulations will be removed as well. In any case, when a full measure is extracted at the end of a range, the extra processing that you (@WolfgangDrescher) are doing to select partial measures should be disabled (full measure extraction does not need any data editing at the end of a range other than if the ending note(s) have durations that extend past the extracted ending barline.). |
This happens due to HumNum dur = lastLineDurationsFromNoteStart[i];
string recip = Convert::durationToRecip(dur);
string pitch;
HumRegex hre;
if (hre.search(resolvedToken, "([rRA-Ga-gxyXYn#-]+)")) {
pitch = hre.getMatch(1);
}
string tokenText;
if (resolvedToken->getDuration() > dur) {
tokenText += "[";
}
tokenText += recip + pitch;
token->setText(tokenText);
lineChange = true; I had similar issues as you when I lost terminal long notes in Am I missing rhythm related characters if I strip away I will try to make a PR in the following days.
This will cause problems with the verovio rendering when the last bar of the example has overfilling noted: Have a look at measure 6 of this score (Bassus): **kern **text **kern **text **kern **text
*staff3 *staff3 *staff2 *staff2 *staff1 *staff1
*Ivox * *Ivox * *Ivox *
*I"Bassus * *I"Tenor * *I"Cantus *
*I'B * *I'T * *I'C *
*clefC4 * *clefC3 * *clefC1 *
*k[] * *k[] * *k[] *
*e:phr * *e:phr * *e:phr *
*M2/1 * *M2/1 * *M2/1 *
*met(C|) * *met(C|) * *met(C|) *
*MM180 * *MM180 * *MM180 *
=1 =1 =1 =1 =1 =1
0r . 1A Straff 00r .
. . 2A mich . .
. . 2A Herr . .
=2 =2 =2 =2 =2 =2
2r . 2c nit . .
2E Straff 2c im . .
2E mich 4B ei- . .
. . 4A . . .
2E Herr 4G . . .
. . 4A . . .
=3 =3 =3 =3 =3 =3
2G nicht 4B . 0r .
. . 4c . . .
2G im 2.d . . .
2F ei- . . . .
. . 4c . . .
2F -ffer- 4A . . .
. . 4B . . .
=4 =4 =4 =4 =4 =4
1E -mut/ 4c . 1e Straff
. . 4B . . .
. . 4c . . .
. . 4G . . .
1r . 4A . 2e mich
. . 4B . . .
. . 2.c . 2e Herr
=5 =5 =5 =5 =5 =5
0r . . . 2g nit
. . 4B . . .
. . 1e . 2g im
. . . . 2f ei-
. . 2d -fer- 2f -ffer-
=6 =6 =6 =6 =6 =6
2r . 2.g -mut 1e -mut/
2E wañ . . . .
. . 4f . . .
2A dein 2e . 2r .
2A. zorn 2c wenn 2e Wenn
== == == == == ==
*- *- *- *- *- *- VHV does not display such an invalid score. However verovio will actually render it like this: I'm not sure if this a bug in verovio or if it is humdrum related. So I think it's good that myank will calculate a valid duration for such overfilled notes. However it should of course keep subtokens and not touch anything of the token beside rhythm related characters. |
Off topic but I ran into it while debugging this issue: We talked about this briefly somewhere else, but running Could something like |
Yes, that is related to my parenthetical comment:
In these cases, the duration of the notes extending past the end of the measure must be truncated. I do not allow under/over filling of measures when parsing Humdrum scores. In Humlib, the overfilling of measures is allowed, with the understanding that the overfill extends into the following measure, as you are doing in the full example. But at the end of the music, all parts must end together. This is for error checking: Humdrum is for analysis as its primary scope. Allowing over/underfilled measures most likely means a data error rather than something intentional, so it is not allowed. It is allowed in Humdrum in some sense, but not in any of my parsers because of the error likelyhood. Verovio does not check for over/underfilling directly, I think. But it will assign the duration of the measure to the longest part's measure (so verovio always assumes underfilling). In Finale, there can be under- or overfilling since the duration of the measure is set to the time signature. Musescores behaves intermediate to Finale and verovio: it will add invisible rests to pad the measure to the longest part. But it will put an invisible plus sign above the staff warn you that it has added some padding rest, or the duration of the measure does not match the time signature. What you want to do in this situations (there are also other styles such as cutting the note to the duration of the measure and adding a hanging tie) is to add a layout instruction for the note to indicate that it has a different visual duration from the logical one: !LO:N:vis=2.
2A This means that the duration is a half note, but it looks like a dotted-half note. Here is the full example: Click to view Humdrum data for above example**kern **text **kern **text **kern **text
*staff3 *staff3 *staff2 *staff2 *staff1 *staff1
*Ivox * *Ivox * *Ivox *
*I"Bassus * *I"Tenor * *I"Cantus *
*I'B * *I'T * *I'C *
*clefC4 * *clefC3 * *clefC1 *
*k[] * *k[] * *k[] *
*e:phr * *e:phr * *e:phr *
*M2/1 * *M2/1 * *M2/1 *
*met(C|) * *met(C|) * *met(C|) *
*MM180 * *MM180 * *MM180 *
=1 =1 =1 =1 =1 =1
0r . 1A Straff 00r .
. . 2A mich . .
. . 2A Herr . .
=2 =2 =2 =2 =2 =2
2r . 2c nit . .
2E Straff 2c im . .
2E mich 4B ei- . .
. . 4A . . .
2E Herr 4G . . .
. . 4A . . .
=3 =3 =3 =3 =3 =3
2G nicht 4B . 0r .
. . 4c . . .
2G im 2.d . . .
2F ei- . . . .
. . 4c . . .
2F -ffer- 4A . . .
. . 4B . . .
=4 =4 =4 =4 =4 =4
1E -mut/ 4c . 1e Straff
. . 4B . . .
. . 4c . . .
. . 4G . . .
1r . 4A . 2e mich
. . 4B . . .
. . 2.c . 2e Herr
=5 =5 =5 =5 =5 =5
0r . . . 2g nit
. . 4B . . .
. . 1e . 2g im
. . . . 2f ei-
. . 2d -fer- 2f -ffer-
=6 =6 =6 =6 =6 =6
2r . 2.g -mut 1e -mut/
2E wañ . . . .
. . 4f . . .
2A dein 2e . 2r .
!LO:N:vis=2. ! ! ! ! !
2A zorn 2c wenn 2e Wenn
=- =- = = = =
*- *- *- *- *- *- Another possibility is to leave the dotted-half note as it is, and then add filler invisible rests: Click to view Humdrum data for above example.**kern **text **kern **text **kern **text
*staff3 *staff3 *staff2 *staff2 *staff1 *staff1
*Ivox * *Ivox * *Ivox *
*I"Bassus * *I"Tenor * *I"Cantus *
*I'B * *I'T * *I'C *
*clefC4 * *clefC3 * *clefC1 *
*k[] * *k[] * *k[] *
*e:phr * *e:phr * *e:phr *
*M2/1 * *M2/1 * *M2/1 *
*met(C|) * *met(C|) * *met(C|) *
*MM180 * *MM180 * *MM180 *
=1 =1 =1 =1 =1 =1
0r . 1A Straff 00r .
. . 2A mich . .
. . 2A Herr . .
=2 =2 =2 =2 =2 =2
2r . 2c nit . .
2E Straff 2c im . .
2E mich 4B ei- . .
. . 4A . . .
2E Herr 4G . . .
. . 4A . . .
=3 =3 =3 =3 =3 =3
2G nicht 4B . 0r .
. . 4c . . .
2G im 2.d . . .
2F ei- . . . .
. . 4c . . .
2F -ffer- 4A . . .
. . 4B . . .
=4 =4 =4 =4 =4 =4
1E -mut/ 4c . 1e Straff
. . 4B . . .
. . 4c . . .
. . 4G . . .
1r . 4A . 2e mich
. . 4B . . .
. . 2.c . 2e Herr
=5 =5 =5 =5 =5 =5
0r . . . 2g nit
. . 4B . . .
. . 1e . 2g im
. . . . 2f ei-
. . 2d -fer- 2f -ffer-
=6 =6 =6 =6 =6 =6
2r . 2.g -mut 1e -mut/
2E wañ . . . .
. . 4f . . .
2A dein 2e . 2r .
2A. zorn 2c wenn 2e Wenn
=- =- = = = =
. . 4ryy . 4ryy .
*- *- *- *- *- *- In this case the overfilling in one measure is counterbalanced with extra padding after the barline in the other parts. Alternately you could add the padding rests inside of the barline: 2A. zorn 2c wenn 2e Wenn
. . 4ryy . 4ryy .
=- =- = = = =
*- *- *- *- *- *- This would visually look like the first example, but no need for a Visually this is close, although the padding rests to fill in the underflow are causing the measure to be slightly wider than in the first example. (These solutions were discussed in the initial myank discussion in some other issue). |
Note that the
|
Yes, you are missing For example: triplet whole notes are 2/3rds of a whole note, so the **kern **kern
3%2c 1cc
3%2c .
. 1cc
3%2c .
1c 1cc
= =
*- *- |
HumNum dur = lastLineDurationsFromNoteStart[i];
string recip = Convert::durationToRecip(dur);
string pitch;
HumRegex hre;
if (hre.search(resolvedToken, "([rRA-Ga-gxyXYn#-]+)")) {
pitch = hre.getMatch(1);
}
string tokenText;
if (resolvedToken->getDuration() > dur) {
tokenText += "[";
}
tokenText += recip + pitch;
token->setText(tokenText);
lineChange = true; Here is the way this code should be rewritten (might be some rough spots as I have not compiled or tested it): HumNum dur = lastLineDurationsFromNoteStart[i];
string recip = Convert::durationToRecip(dur);
HumRegex hre;
if (resolvedToken->getDuration() > dur) {
string tokenText = *token;
// Split the **kern token into separate notes:
vector<string> pieces = token->getSubtokens();
// Change the duration of each note:
for (int i=0; i<(int)pieces.size(); i++) {
string recipRE = R"re(([\d%.]+))re";
if (hre.search(pieces[i], recipRE) {
string before = hre.getPrefix();
string after = hre.getSuffix();
// Remove any residual **recip characters after match
// due to split **recip data:
hre.replaceDesctructive(after, "", recipRE, "g");
string newpiece;
// Add a tie start if not already in a tie group:
if (!hre.search(pieces[i], "[_[]")) {
newpiece += "[";
}
// Replace the old duration with the clipped one:
newpiece += before + recip + after;
}
}
string outText;
for (int i=0; i<(int)pieces.size(); i++) {
outText += pieces[i];
if (i < (int)pieces.size() - 1) {
outText += " ";
}
}
token->setText(outText);
lineChange = true;
} Algorithm in English(somewhat): If a To do that, the duration of the note before the barline will replace the original duration to remove the overflow duration from the note. When the note has an overflow, then a tie start will be added to the note, unless it is already in a tie group. To update the duration of the note, assume that it is a chord and split into separate single-note strings. Replace the old duration with the new one, but remove any non-contiguous Note that there is a shorthand for rhythms on chords that I allow (and which I think I have seen you use): 4c e g which is shorthand for 4c 4e 4g The above algorithm should be able to handle such shorthands since the The above code also fixes cases such as: 4A. Since the |
I haven't fully tracked down such cases, but when I do, it has always been a data error. The problem is that a null token has had some non-numeric text appended to it. This makes the null token no longer a null token, and the null is interpreted as an augmentation dot. But there is no number part of the rhythm, so a very strange rhythm is generated when converting to MEI/verovio which results in the notation going crazy. So since it is the result of a data error, I haven't tried to fix it (but it can be difficult to find the error, particularly if you don't know the likely cause of the funny notation). |
The root of the problem is how I organized the makefile(s). The original intent of humlib was to insert into verovio, and I wanted to do that as a single A better solution would be to rewrite the makefiles in humlib so that Probably a new makefile called makefile-combined should be created to compile There is currently an intermediate solution: make lib && make programs the
|
Regarding this highlighting box: How are you implementing it? There is another issue where you commented that I insert such highlighting into the SVG rather than showing with an HTML-based solution. The benefit of inserting into the SVG rather than as an HTML element is that a PDF file created from the SVG will contain the highlighting, which the HTML solution will not be convertible into a PDF (with PDFkit). Also note that you are overlaying the box. This causes the notes inside of the box to become reddish. Better would be to place the box under the notation so that it does not affect the color of the notation that it overlaps with. Ideally you would enhance the basic code that I have for this in the VHV repository: I call the class HnpMarkup since I want to eventually move it to the Humdrum Notation Plugin repo: Related to this, I will probably add an issue to |
Thank you I fixed this in my files. Is there a tool to check for a valid humdrum syntax? the |
This is actually just a box I added to the screenshot with the Apple Preview app. But I have implemented this feature now in several tools. The last one being my tricinium project when you navigate to the "Kern" tab of a tricinium and click on the tokens in the code editor. Or the cadence highlighting. Basically a For the box highlighting to can have a look at those components:
Is this currently working in VHV? When I click "Save as PDF" the selections will not be added. |
Have a look at my PR. For now it does not handle overfilling measures with hidden rests, |
It must not be implemented yet. I also use a MutationObserver to watch the SVG on the main page. This should work when downloading SVG images from the File menu on VHV. But for PDF files, I generate them directly from SVG images created with verovio, so they are never placed on the VHV page, so the markup is currently not being applied to the SVG images before they are converted to PDF (I should fix that). |
By illegal, I mostly mean aesthetically illegal. Here is a webpage that lists the "canonical" ordering of parameters in a https://www.humdrum.org/Humdrum/representations/kern.html Add to this I also have mostly co-opted
A tool/filter that adjusts I have a tool called http://extras.humdrum.org/man/prettystar Also somewhat related is the
|
In
myank
, chords turn into single notes when extracting a range of measures.Example input data:
https://verovio.humdrum.org?t=KiprZXJuCipNNC80Cj0xCjFjIDFlIDFnCj0yCjFkIDFmIDFhCj0zCjFlIDFnIDFiCj00CjFmIDFhIDFjYwo9NQoxZyAxYiAxZGQKPT0KKi0K
running the filter
myank -m 2-3
:https://verovio.humdrum.org/?filter=myank%20-m%202-3&t=KiprZXJuCipNNC80Cj0xCjFjIDFlIDFnCj0yCjFkIDFmIDFhCj0zCjFlIDFnIDFiCj00CjFmIDFhIDFjYwo9NQoxZyAxYiAxZGQKPT0KKi0K
The third measure only contains a single
E4
and is missingG4
andB4
.Only the first note in the token is processed (so not pitch related):
Extracting a single measure does not have a problem:
The text was updated successfully, but these errors were encountered: