DivinumOfficium / divinum-officium

The Divinum Officium Project: Traditional Roman Missal and Breviary Texts
http://www.divinumofficium.com/
299 stars 191 forks source link

Integration with GregoBase #1375

Open ahinkley opened 4 years ago

ahinkley commented 4 years ago

Something I would love to see is for the Divinum Officium project to be integrated with GregoBase so that the Divinum Officium can display both text and chant. using the Caeciliae font or exsurge, and retrieve the GABC data from GregoBase. I'm more than happy to manually enter all the GregoBase links to the Divinum Officium source files if someone can add the code to display chant.

benyanke commented 4 years ago

I don't currently have the time to implement this, but I'd love to see it as an option - I'd personally love to see chant notation for all the texts which could be sung, provided the UI is streamlined.

For web-browser display, I'd highly suggest checking out Benjamin Bloomfield's jgabc project, a more-or-less complete GABC rendering engine in javascript. https://github.com/bbloomf/jgabc

He also has a small site using the library, to show off what you can do with it:

https://bbloomf.github.io/compline/ image

The output is quite high quality.

igneus commented 3 years ago

I'm more than happy to manually enter all the GregoBase links to the Divinum Officium source files if someone can add the code to display chant.

It should be possible to largely automate this task. See my project doing something very similar for a Czech LOTH web application and a corpus of vernacular plainchant composed by myself https://github.com/igneus/eantifonar

Geremia commented 2 years ago

This wouldn't be too hard to do with inline GABC code:


We'd just need to write some GABC renderer code, which already exists; cf. @benyanke's site above.

jperon commented 1 year ago

Jgabc would be great for the browser display, but wouldn’t work (I guess) for epub output. Should anyone seriously work on this, I could help for generating images of scores that could be integrated into the epub, in the same vein as this pandoc lua filter.

igneus commented 1 year ago

Some time ago I prepared a POC of the principle mentioned above (add a piece of JS code which knows how to find chant texts in the HTML page, on page load scans the page, asks an API if it has any music for the texts found, and if it has, inserts them in the page) https://github.com/igneus/eantifonar2 It's quite fun, even if it doesn't get everything 100% by the book (especially when the antiphonal contains multiple tunes for the same text, to be used according to some rule), but so far I haven't shipped it to the public (and don't plan to do so in near future) for being too lazy to set up and maintain a public instance of the API.

Geremia commented 1 year ago

@jperon SVG support is required in the EPUB 3 specs.

jperon commented 1 year ago

@Geremia Sure, but epub3 implementation in ereaders is far from perfect yet. I’d be curious to see whether such scores would be read on KOReader, for example.

Geremia commented 1 year ago

@jperon KOReader Version v2023.01 (95513) displays the SVG in this EPUB 3 properly: svg_test.epub. (I needed to name it .zip to upload it; change it to .epub.)

jperon commented 1 year ago

@Geremia Good news! The more I use KOReader, the more I like it.

Geremia commented 1 year ago

@jperon Yes, it's an excellent app. I use it on my BOOX Leaf.

FAJ-Munich commented 1 year ago

I've started in a branch on my own to integrate GABC into Divinum Officium and, in principle, with a bit of tweaking here and there, it is possible to make the site display the gabc and even multiples thereof. gabc-test.pdf

However, to make it available in a satisfactorial manner. There would be a lot of work to be done to ensure (inter alia)

  1. finding a suitable method to make the gabc notation stop interfering with the way the perl script is handling the current text database
  2. correctly combining doubled or non-doubled antiphons with the psalms in the correct psalm tone.
  3. ensuring the correct festal or simple or ... version is linked depending on the day of the year ( even hymns have different tones and, at the moment these are hard coded once and for all in the psalterium or orde etc.)

I am happy to work more on this topic but I think co-ordination and assistance on some matter with one or more of the regular contributors to this project is indespensable.

Surrexit Dominus vere, allelúia!

ksandigo commented 8 months ago

I would also like to offer whatever help I can with this endeavor. My coding skills extend only as far as generating chant booklets using TeXworks, but matching antiphons, hymns, etc. from the Antiphonale Romanum to their proper days in Divinum Officium would be within my capabilities.

For rendering, following Benjamin Bloomfield's approach in his Propers Tool and Compline app would be advantageous. Apart from its clean presentation on browsers, I also appreciate the midi playback for learning and practicing the chant.

I've not dug in to how @igneus and @FAJ-Munich managed their beautiful demos, but one approach I propose is creating a "Latin-Grego" language profile that starts as a copy of the "Latin" whose text gets replace with GABC (copy-pasted or stored in a local folder) or GregoBase ID numbers (calling back to the website).

I agree that doubled vs. non-doubled antiphons is a quirky issue, on top of ensuring (if desired) that the Euouae is captured at the start but not at the end. As far as matching the correct psalm and psalm tone, there can be a local exported copy of the Psalm Tone Tool output that can be parsed with input of psalm number (based on the common or proper) and psalm tone (based on the antiphon). And as opposed to creating individual GABCs for readings, lessons, versicles, responsories, etc. they can instead (wherever possible) be generated in a way similar to how the Readings Tool works.

I've thought a lot about this on my own this past year and would love to collaborate with talented coders to make this a reality.

FAJ-Munich commented 8 months ago

I propose is creating a "Latin-Grego" language profile

indeed that is the approach I took for my "first steps"; I called the Language Latin-gabc

following Benjamin Bloomfield's approach in his Propers Tool and Compline app would be advantageous.

here's a short outline – you can see that from the four commits on my branch gabc

  1. I have added some of Benjamin's javascript files into a subfolder horas/js/ and made sure that horasjs.pl addresses these in the header of the programlet. Also I have added the necessary javascript there to recognize GABC content in the perl output to perform the rendering.
  2. I have added to webdia.pla recognition mechanism that would ensure that gabc text would be handled differently then ordinary database text:
        if ($lang =~ /gabc/i) {
            my $dId = 0;
            while($text =~ /\{(.*?)\(\:\:\)\}/is) {
                $dId++;
                $text =~ s/\{/<DIV ID="GABC$searchind$dId" class="GABC">/s;
                $text =~ s/\(\:\:\)\}/\(\:\:\)<\/DIV><DIV ID="GCHANT$searchind$dId" class="GCHANT"><\/DIV>/s;
            }
        } else {
  3. finally, I have added one test file ./Latin-gabc/Tempora/Quad6-4.txt and played around with it until I had achived what has been shared via screenshot.
ksandigo commented 7 months ago

It may entirely be the case something is wrong with my setup, but I cannot get the js scripts from the gabc branch to run. I'm on Ubuntu 22.04.3 LTS and Docker Desktop 4.26.1. After adding one closing bracket in Line 511 of webdia.pl (I received a System Error otherwise) I'm able to get the development site up and navigable. When I click on "Desktop" the following terminal output appears:

web-1 | XX.XX.XX.XX - - [18/Jan/2024:14:18:26 +0000] "GET /cgi-bin/horas/officium.pl HTTP/1.1" 200 4230

Followed immediately by:

web-1  | [Thu Jan 18 14:18:26.397065 2024] [cgi:error] [pid 10:tid 139662518740736] [client 172.19.0.1:58810] AH01215: (8)Exec format error: exec of '/var/www/web/cgi-bin/horas/js/util.js' failed: /var/www/web/cgi-bin/horas/js/util.js, referer: http://localhost:8080/cgi-bin/horas/officium.pl
web-1  | [Thu Jan 18 14:18:26.398715 2024] [cgi:error] [pid 10:tid 139662518740736] [client 172.19.0.1:58810] End of script output before headers: util.js, referer: http://localhost:8080/cgi-bin/horas/officium.pl
web-1  | XX.XX.XX.XX - - [18/Jan/2024:14:18:26 +0000] "GET /cgi-bin/horas/js/util.js HTTP/1.1" 500 608

These outputs are repeated for jquery.min.js and exsurge.js. When opening Matins for 4-6-2023 with Latin-gabc selected just the raw gabc appears.

I've attempted many solutions to no avail:

Thank you in advance for your patience with this amateur coder.

FAJ-Munich commented 7 months ago

Hi Kelvin, Unfortunately, it's been a while since I adapted the example andI have no idea about Docker tbh. I'm locally working on macOS with an Apache server running. So I guess quite different in setup. I remember I also had a hard time to adopt the js files from bbloomf\jgabc originally with weird changes necessary to make it work. Maybe you try replacing the JS files from my branch with the originals from Benjamin and/or try to make a fork of his repository work locally first. Since you have node already installed, I guess Benjamin's advice might not be sufficient either:

Users:
    See http://bbloomf.github.io/jgabc/ for a live example.

Developers:
To get started, install Node.js from: https://nodejs.org

On Linux/OSX:
    Verify node installation from terminal with:
        node -version
    Install npm with:
        sudo npm install npm@latest -g
    From the jgabc directory run:
        sudo npm install -g http-server
        sudo http-server -a localhost -p 80
    Visit the local directory from your browser:
        http://127.0.0.1
FAJ-Munich commented 6 months ago

Hi Kelvin, @ksandigo
I have finally had a chance to have a closer look at the issue with webdia.pl today. The development of the function activate_links() merged with my gabcdevelopment without merging issue but messed up the closing braces }. I've made my version running again by merging all the recent developments from masterfirst and then adding the commit 4547b1cce . This is moving the braces to the right position. Hope it works for you then as well!

ksandigo commented 6 months ago

Hello @FAJ-Munich,

Thank you for providing a new commit integrating the latest developments from master. I've been trying to run this on my Ubuntu system for the past two weeks and whether hosting on Docker (which runs Apache2) or Python3 I still can only get to the point of displaying the raw gabc text. I see in the terminal outputs that the .js scripts are being called but not executed. In researching the problem, I'm coming across concepts I'm totally unfamiliar with like static vs. dynamic and server vs. client side.

As an aside, I can run Benjamin's jgabc website locally using Nodejs, but I cannot run the Perl scripts of Divinum Officium using Nodejs. Instead of loading a page it wants me to download the .pl file.

Do you possibly know what changes to your Apache environment (for example, editing / enabling / disabling .conf files) you made in order to get your server to run the Divinum Officium Perl website and use the Exsurge, Jquery and Util Javascript files?

FAJ-Munich commented 6 months ago

Hi @ksandigo I'll gather the configuration files and let you know then.

igneus commented 6 months ago

Isn't this thread largely made obsolete by the emergence of https://breviariumgregorianum.com/ ?

jperon commented 6 months ago

I think it would nevertheless be interesting, as it’s possible to generate epubs.

hcblassingame commented 6 months ago

I’ve never heard of breviariumgregorianum.com before now, but it only seems to support the 1962 office, and does not include Compline that I could see.

Get Outlook for iOShttps://aka.ms/o0ukef


From: jperon @.> Sent: Sunday, March 3, 2024 10:23:49 AM To: DivinumOfficium/divinum-officium @.> Cc: Subscribed @.***> Subject: Re: [DivinumOfficium/divinum-officium] Integration with GregoBase (#1375)

I think it would nevertheless be interesting, as it’s possible to generate epubs.

— Reply to this email directly, view it on GitHubhttps://github.com/DivinumOfficium/divinum-officium/issues/1375#issuecomment-1975213937, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANNIPFGV33IN52C3RH4GMPDYWNFBLAVCNFSM4KNDAQLKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJXGUZDCMZZGM3Q. You are receiving this because you are subscribed to this thread.Message ID: @.***>

FAJ-Munich commented 6 months ago

Do you possibly know what changes to your Apache environment (for example, editing / enabling / disabling .conf files) you made in order to get your server to run the Divinum Officium Perl website and use the Exsurge, Jquery and Util Javascript files?

When it comes to JavaScript, since it is executed by the browser not the server, the Exsurge, Jquery, etc. JSs should run just as well with Divinum Officium once you get the perl script being executed.

In setting up my Apache, I have more or less followed https://editrocket.com/articles/perl_apache_windows.html with an adaption to the fact, I am running on Mac OS. That is, in httpd.conf, to the line AddHandler cgi-script .cgi you have to add .pl at the end: AddHandler cgi-script .cgi .pl. Then, since I have cloned the repository into my Apache UserDirectory, I uncommented the line

Include /private/etc/apache2/extra/httpd-userdir.conf

Normally, I would also have uncommented

#LoadModule perl_module libexec/apache2/mod_perl.so

However, mod_perl is broken in Mac OSX 14; therefore, I uncommented the line with perl substituted with cgi instead. Luckily, that also works.

Then, in the users directory, I have added a username.conf file, with the following content:

<Directory "/Users/username/Sites/">
  AddHandler cgi-script .pl
  Options Indexes MultiViews FollowSymLinks ExecCGI
  AllowOverride None
  Require all granted
</Directory>

Of course, you could put this in the main httpd.conf also, just ensure that the Directory is the one you clone your repository into and that it's the directory the Apache Server looks for when accessing the localhost or localhost/~username/ in my case. Check the extra/httpd-userdir.conf for locating that directory.

At the end, don't forget to restart the server :wink:

Best of luck!

FAJ-Munich commented 5 months ago

as you can tell from the commit chain #3699 to #3702 and #3703 , there seems to be some issue with the website which I cannot reproduce locally. Whoever wants to try it out locally for themselves, please feel free to "fork" my branch https://github.com/FAJ-Munich/divinum-officium/tree/gabc-clean yourself and see if you can make it work. It's finished for the Triduum and "beta" version for everything else as of now. I am not going to open any more pull requests from this branch anytime soon.

MatthaeusRuber commented 4 months ago

Hello, I'm new to GitHub.com, but I had a correspondence with the people of Divinum Officium. I'm a singer and a former developer. For my personal use, I realised a HTML JavaScript webpage that transcribes 200 Gregorian Hymns from Gregobase to modern notation, harmonize them for 4 voices and allows them to be listened and learned easily. It was my intention to transcribe and harmonize the whole Divinum Officium. If my implementation can be useful (many of us don't know the square notation) , I would like to work with you and BreviariumGregorianum.com. my goal is to contribute to the spreading of the traditional liturgy and I would like to be able to sing the Divinum Officium with my family. My application works, but I have not enough knowledge to be sure that the melismas are transcribed correctly and, above all, I want to be very faithful with the command of Antiphonary 1960. So, please, let me know, what can I do? Where do I have share my little project?

Geremia commented 4 months ago

@MatthaeusRuber Interesting. Do you have a webpage or Git repo showcasing what you've done so far?

MatthaeusRuber commented 4 months ago

Still not. It is on my phone.

Geremia commented 4 months ago

@MatthaeusRuber I'm interested. Also, I didn't realize BreviariumGregorianum.com has been mostly (sans compline) implemented. That's nice to see. 👍

MatthaeusRuber commented 4 months ago

I will complete and publish my project. However, I need someone is able to check that everything is done according with the Antiphonary.

FAJ-Munich commented 4 months ago

However, I need someone is able to check that everything is done according with the Antiphonary.

As the experience with D. O. shows, no matter how many checks one has made, there will always be cases where something is still wrong and needs correction.

So do I understand correctly, you have implemented "modern music notation" in lieu of square notation?

In my repo, gabc-develop branch, I have continued working on the GABC integration focusing lately on the Ordinarium and Psalterium for Paschal season. The number of special cases and exceptions are plentiful.

MatthaeusRuber commented 4 months ago

My webpage takes 200 GABC Gregorian hymns and transcribe in modern notation. Then, the webpage, following my indications, harmonizes them for organ/4 voices. At the end, you can listen the tunes or the entire harmony by Midi.