WolfgangDrescher / lassus-geistliche-psalmen

Digital edition of «Geistliche Psalmen mit dreyen Stimmen» by Orlandus and Rudolphus Lassus. Encoded in Humdrum (Kern).
https://lassus.mh-freiburg.de
3 stars 1 forks source link

Reference record placement and !!!title: record #7

Open craigsapp opened 2 years ago

craigsapp commented 2 years ago

I will usually split the reference records into above and below the music. The ones above are basic records to identify the piece, and the ones below are more technical, bookkeeping or for computer processing. Which go above and below depends on how important you feel the records are. (Placing them all above or below is not a problem, however).

For example:

!!!COM: Lassus, Orlandus
!!!CDT: 1532-1594/06/14
!!!OPR: Geistliche Psalmen mit dreyen Stimmen
!!!OTL: Beatus vir
!!!OTL@DE: Selig zu preisen ist der mann
!!!LIB: Ulenberg, Caspar
!!!LIB-CDT: 1548/12/24-1617/02/16
!!!AGN: Psalm, Tricinium
!!!YOR: https://mdz-nbn-resolving.de/details:bsb00075346
!!!YOO: München, Bayerische Staatsbibliothek
!!!URL-scan: https://www.digitale-sammlungen.de/de/view/bsb00075346?page=11 Cantus
!!!URL-scan: https://www.digitale-sammlungen.de/de/view/bsb00075346?page=71 Tenor
!!!URL-scan: https://www.digitale-sammlungen.de/de/view/bsb00075346?page=127 Bassus
!!!EED: Wolfgang Drescher
!!!END: 2022/02/17
!!!ENC: Wolfgang Drescher
!!!EEV: 2022/03/05

I would split something like this:

Above the music:

!!!COM: Lassus, Orlandus
!!!CDT: 1532-1594/06/14
!!!OPR: Geistliche Psalmen mit dreyen Stimmen
!!!OTL: Beatus vir
!!!OTL@DE: Selig zu preisen ist der mann
!!!LIB: Ulenberg, Caspar
!!!LIB-CDT: 1548/12/24-1617/02/16

Below the music:

!!!RDF**kern: l = long note in original notation
!!!RDF**kern: i = editorial accidental
!!!AGN: Psalm, Tricinium
!!!YOR: https://mdz-nbn-resolving.de/details:bsb00075346
!!!YOO: München, Bayerische Staatsbibliothek
!!!URL-scan: https://www.digitale-sammlungen.de/de/view/bsb00075346?page=11 Cantus
!!!URL-scan: https://www.digitale-sammlungen.de/de/view/bsb00075346?page=71 Tenor
!!!URL-scan: https://www.digitale-sammlungen.de/de/view/bsb00075346?page=127 Bassus
!!!EED: Wolfgang Drescher
!!!END: 2022/02/17
!!!ENC: Wolfgang Drescher
!!!EEV: 2022/03/05

That makes it easier to view the start of the musical data.

Since I do not care about the lyricist, I would put him at the bottom 😄 :

!!!COM: Lassus, Orlandus
!!!CDT: 1532-1594/06/14
!!!OPR: Geistliche Psalmen mit dreyen Stimmen
!!!ONM: 1
!!!OTL: Beatus vir
!!!OTL@DE: Selig zu preisen ist der mann
!!!RDF**kern: l = long note in original notation
!!!RDF**kern: i = editorial accidental
!!!LIB: Ulenberg, Caspar
!!!LIB-CDT: 1548/12/24-1617/02/16
!!!AGN: Psalm, Tricinium
!!!YOR: https://mdz-nbn-resolving.de/details:bsb00075346
!!!YOO: München, Bayerische Staatsbibliothek
!!!URL-scan: https://www.digitale-sammlungen.de/de/view/bsb00075346?page=11 Cantus
!!!URL-scan: https://www.digitale-sammlungen.de/de/view/bsb00075346?page=71 Tenor
!!!URL-scan: https://www.digitale-sammlungen.de/de/view/bsb00075346?page=127 Bassus
!!!EED: Wolfgang Drescher
!!!END: 2022/02/17
!!!ENC: Wolfgang Drescher
!!!EEV: 2022/03/05

I also added an ONM (number) record to indicate the first work in the volume.

An additional non-standard reference record is !!!title:. This is used in VHV to display the title at the top of the page:

!!!COM: Lassus, Orlandus
!!!CDT: 1532-1594/06/14
!!!OPR: Geistliche Psalmen mit dreyen Stimmen
!!!ONM: 1
!!!OTL: Beatus vir
!!!OTL@DE: Selig zu preisen ist der mann
!!!RDF**kern: l = long note in original notation
!!!RDF**kern: i = editorial accidental
!!!LIB: Ulenberg, Caspar
!!!LIB-CDT: 1548/12/24-1617/02/16
!!!AGN: Psalm, Tricinium
!!!YOR: https://mdz-nbn-resolving.de/details:bsb00075346
!!!YOO: München, Bayerische Staatsbibliothek
!!!URL-scan: https://www.digitale-sammlungen.de/de/view/bsb00075346?page=11 Cantus
!!!URL-scan: https://www.digitale-sammlungen.de/de/view/bsb00075346?page=71 Tenor
!!!URL-scan: https://www.digitale-sammlungen.de/de/view/bsb00075346?page=127 Bassus
!!!EED: Wolfgang Drescher
!!!END: 2022/02/17
!!!ENC: Wolfgang Drescher
!!!EEV: 2022/03/05
!!!title: @{ONM}. @{OTL} / <i>@{OTL@DE}</i>

Which has the added title record:

!!!title: @{ONM}. @{OTL} / <i>@{OTL@DE}</i>

@{ONM} is a template which will be filled in with the contents of the !!!ONM reference record.

This produces the title:

Screen Shot 2022-03-05 at 11 05 38 PM

The default title in VHV is "composer, @{OTL}", where the composer's last name is hardwired to be displayed, I think.

Screen Shot 2022-03-05 at 11 04 41 PM
WolfgangDrescher commented 2 years ago

Yes, I saw that there seems to be a convention to split meta data up. However I felt like keeping them all together as "headers" would not be a bad idea (I'm coming from web development). But I am, of course, ready to submit to this convention :) .

Is there a way to show first name and last name in the title? Since in my case compositions alternate between Orlandus and his son Rudolphus Lassus, so it would be a good idea to show which of the two.

Is there a good way or command to parse all metadata into a JSON so I can hydrate a database later on with this data? I startet implementing one in PHP a few months ago but it was not very sophisticated and could only parse a few important entries that I needed at that point.

craigsapp commented 2 years ago

There is no problem putting all of the reference records in one block, and if in a single block, then at the top makes the most sense (notice that there are some RDF**kern records at the bottom of the file).

Is there a way to show first name and last name in the title? Since in my case compositions alternate between Orlandus and his son Rudolphus Lassus, so it would be a good idea to show which of the two.

There may not be at the moment, I will have to check the code (and can allow altering the composer field in some way). There is a sneaky way, however: I automatically chop off the first name when the COM is given in last, first format:

!!!COM: Lassus, Orlandus

But if you do first last:

!!!COM: Orlandus Lassus

Then the title in VHV becomes:

Screen Shot 2022-03-06 at 7 08 08 AM

NB: it might be better to give his name like this:

!!!COM@LAT: Lassus, Orlandus

since that is his Latin name. In English he is usually called Orlando di Lasso (probably Italian), and on Wikipedia they are preferring Orlande de Lassus ) (French/Dutch?)

Is there a good way or command to parse all metadata into a JSON so I can hydrate a database later on with this data? I started implementing one in PHP a few months ago but it was not very sophisticated and could only parse a few important entries that I needed at that point.

Here is an example in Javascript:

function humref2json(humdrum) {
        let lines = humdrum.split(/\r?\n/);
        let output = {};
        for (let i=0; i<lines.length; i++) {
                matches = lines[i].match(/^!!!\s*([^:]+)\s*:\s*(.*)\s*$/);
                if (matches) {
                        output[matches[1]] = matches[2];
                }
        }
        return output;
}

A demo with the splash music in VHV:

Screen Shot 2022-03-06 at 6 23 23 AM

In PERL:

#!/usr/bin/env perl

my @contents = <>;
chomp @contents;
my %output;
foreach my $line (@contents) {
    if ($line =~ /^!!!\s*([^:]+)\s*:\s*(.*)\s*$/) {
        $output{$1} = $2;
    }
}

my @keys = keys(%output);
print "{\n";
for (my $i=0; $i<@keys; $i++) {
    my $value = $output{$keys[$i]};
    $value =~ s/"/\\"/g;
    print "\"$keys[$i]\": \"$value\"";
    print "," if $i < $#keys;
    print "\n";
}
print "}\n";

Output for Beatus vir:

{
"EED": "Wolfgang Drescher",
"LIB": "Ulenberg, Caspar",
"OTL": "Beatus vir",
"YOO": "München, Bayerische Staatsbibliothek",
"YOR": "https://mdz-nbn-resolving.de/details:bsb00075346",
"COM": "Lassus, Orlandus",
"ENC": "Wolfgang Drescher",
"OTL@DE": "Selig zu preisen ist der mann",
"OPR": "Geistliche Psalmen mit dreyen Stimmen",
"CDT": "1532-1594/06/14",
"URL-scan": "https://www.digitale-sammlungen.de/de/view/bsb00075346?page=127 Bassus",
"LIB-CDT": "1548/12/24-1617/02/16",
"EEV": "2022/03/05",
"AGN": "Psalm, Tricinium",
"END": "2022/02/17",
"RDF**kern": "i = editorial accidental"
}

These programs assume no duplicate reference keys (note the problem with URL-scan, where only the last reference record with that key was preserved, as well as !!!RDF**kern). You could also convert to an array of key/value pairs to preserve the order, rather than a lookup table for random access to the key/value pairs.

I do have a Javascript Humdrum parser: https://js.humdrum.org

I use this on the demo website: https://chorales.sapp.org

which does do some reference record parsing (but not too much else).

WolfgangDrescher commented 2 years ago

NB: it might be better to give his name like this: !!!COM@LAT: Lassus, Orlandus since that is his Latin name. In English he is usually called Orlando di Lasso (probably Italian), and on Wikipedia they are preferring Orlande de Lassus ) (French/Dutch?)

Fair point. https://mdz-nbn-resolving.de/details:bsb00075346 also lists this name as suggested by you.

Bildschirmfoto 2022-03-07 um 15 24 40

Interestingly, Rudolph is listed as "de Lassus" and his father as "di Lasso". Also see the linked GND links:

https://portal.dnb.de/opac.htm?method=simpleSearch&cqlMode=true&query=nid%3D118569945 https://portal.dnb.de/opac.htm?method=simpleSearch&cqlMode=true&query=nid%3D123737125

Here is an example in Javascript

That is similar to what I was doing. But then there is no official parser yet, that also resolves e.g. !!!title: @{ONM}. @{OTL} / <i>@{OTL-incipit@@DE}</i>.

craigsapp commented 2 years ago

I use the RISM spellings:

Orlando di Lasso https://opac.rism.info/metaopac/search?View=rism&id=pe506

He didn't know how to spell his name:

Namensvarianten: Lassus, Rolando di Lasso, Orlando di Lasso, Orlandi di Di Lasso, Orlando Lassus, Orlando di Lasso, Orlando de DiLasso, Orlando Lassus, Orlandus di Lassus, Orlandus Lassus, Roland de Lassus, Orlande de Lassus, Rolando de Lassus, Rolland de

His son: Rudolph di Lasso https://opac.rism.info/metaopac/search?View=rism&id=pe30014045

They also have a son/brother who was also a composer: Ferdinand di Lasso https://opac.rism.info/metaopac/search?View=rism&id=pe30010768

craigsapp commented 2 years ago

That is similar to what I was doing. But then there is no official parser yet, that also resolves e.g. !!!title: @{ONM}. @{OTL} / <i>@{OTL-incipit@@DE}.

Here is what I do in VHV (Javascript):

https://github.com/humdrum-tools/verovio-humdrum-viewer/blob/12759c7/_includes/vhv-scripts/misc.js#L1510-L1535

function templateExpansion(title, records) {
    let matches = title.match(/@{(.*?)}/);
    if (!matches) {
        return title;
    }

    let replacement = getReferenceValue(matches[1], records);
    let rex = new RegExp("@{" + matches[1] + "}", "g");
    title = title.replace(rex, replacement);

    matches = title.match(/@{(.*?)}/);
    while (matches) {
        replacement = getReferenceValue(matches[1], records);
        rex = new RegExp("@{" + matches[1] + "}", "g");
        title = title.replace(rex, replacement);

        matches = title.match(/@{(.*?)}/);
    }

    return title;
}

This is a basic one. An enhancement might be to add a preferred language as input, for example (with possibly a list of fall-back languages, or a fallback preference for the original, etc.).

I also have formatting codes for the templates, which I will have to find, such as extracting only the last name of the composer, or extracting the first initial and last name, as well as extract only the year from a date.