Bug 22581 - Add support for Plaine & Easie musical incipits rendering in OPAC
Summary: Add support for Plaine & Easie musical incipits rendering in OPAC
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low new feature (vote)
Assignee: Agustín Moyano
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-26 12:14 UTC by verolencinas
Modified: 2023-08-25 01:31 UTC (History)
7 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This development adds support for displaying Plaine & Easie musical incipits in the OPAC. With this feature enabled, when a cataloguer adds incipits codes to the 031 MARC21 fields they will display as musical scores and optionally include a short audio clip.
Version(s) released in:
19.11.00


Attachments
Bug 22581: Add new system preferences (4.77 KB, patch)
2019-10-29 20:11 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 22581: Add new system preferences (4.77 KB, patch)
2019-10-29 20:12 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 22581: Add new system preferences (4.82 KB, patch)
2019-11-01 14:03 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description verolencinas 2019-03-26 12:14:52 UTC
Marc tag 031 includes the musical incipit (first compases of a melody) as code. Musical catalogs such as MUSCAT (http://muscat-project.org) use this information to display the incipit in musical code and to allow to search for incipits.
Since it is possible to export MUSCAT data and import it in Koha, for music libraries it would be very helpful to display the incipit in the OPAC. MUSCAT uses an external libray, Verovio (https://www.verovio.org/) to do this. If the tag 031 is present, Verovio should be used to show the incipit in musical notation.
Comment 1 Martin Renvoize 2019-03-26 15:02:38 UTC
A while back I was looking into something similar.. `Plaine and Easie` rings a bell - https://www.iaml.info/plaine-easie-code
Comment 2 Martin Renvoize 2019-03-26 15:06:07 UTC
Cool, looks like Verovio support it :)
Comment 3 Martin Renvoize 2019-10-24 14:46:02 UTC
Would love to see this one happen.. perhaps one for targetting 20.05?
Comment 4 Martin Renvoize 2019-10-28 10:02:56 UTC
Tomas said you might get to this any moment Agustin, so I'm marking it as 19.11 possible.. be great to see it in.
Comment 5 Agustín Moyano 2019-10-29 20:11:15 UTC
Created attachment 94855 [details] [review]
Bug 22581: Add new system preferences

This patch adds 2 new system preferences:
1. OPACShowMusicalInscripts - to toggle musical inscripts to appear in opac's detail page
2. OPACPlayMusicalInscripts - to toggle musical inscripts to be transformed and payed in midi. Depends on OPACShowMusicalInscripts to be enabled.

To test:
1. apply this patch
2. perl installer/data/mysql/updatedatabase.pl
3. search for this new preferences in admin module
SUCCESS => they appear in OPAC section.
4. sign off

Sponsored-by: Biblioteca Provincial Fr. Mamerto Esquiú (Provincia Franciscana de la Asunción)
Comment 6 Agustín Moyano 2019-10-29 20:12:44 UTC
Created attachment 94856 [details] [review]
Bug 22581: Add new system preferences

This patch adds 2 new system preferences:
1. OPACShowMusicalInscripts - to toggle musical inscripts to appear in opac's detail page
2. OPACPlayMusicalInscripts - to toggle musical inscripts to be transformed and payed in midi. Depends on OPACShowMusicalInscripts to be enabled.

To test:
1. apply this patch
2. perl installer/data/mysql/updatedatabase.pl
3. search for this new preferences in admin module
SUCCESS => they appear in OPAC section.
4. sign off

Sponsored-by: Biblioteca Provincial Fr. Mamerto Esquiú (Provincia Franciscana de la Asunción)
Comment 7 Agustín Moyano 2019-10-29 20:22:33 UTC
Library with piano data is too big to be attached, please apply patches from 

https://gitlab.com/thekesolutions/Koha/tree/bug-22581
Comment 8 Katrin Fischer 2019-10-29 21:31:07 UTC
Could you add a sample record or an example on how to catalog this?
Comment 9 Tomás Cohen Arazi 2019-10-29 21:33:49 UTC
(In reply to Katrin Fischer from comment #8)
> Could you add a sample record or an example on how to catalog this?

I saw the commit on the branch has an example.
Comment 10 Agustín Moyano 2019-10-30 03:15:37 UTC
(In reply to Katrin Fischer from comment #8)
> Could you add a sample record or an example on how to catalog this?

I'll paste the comment on the second commit (that I couldn't upload):


This patch adds musical inscripts to OPAC's detail page

To test:
1. run previous patch test plan
2. apply this patch
3. edit a the marc structure of a MARC bibliographic framework, and in tag 031 enable the following subfiels to be visible in editor: 2, g, n, o, p, u
4. search the catalog for a record that belongs to that framework, and edit tag 031 with the following:
   * 2:pe
   * g:G-2
   * n:xFCGD
   * o:3/8
   * p:'6B/{8B+(6B''E'B})({AFD})/{6.E3G},8B-/({6'EGF})({FAG})({GEB})/4F6-
   * u:http://nonexistent.org/url/of/a/midi
5. save and click in opac view
CHECK => even though you add a 031 tag there is no musical inscript shown in opac view
6. in admin module enable OPACShowMusicalInscripts preference
7. refresh opac view
SUCCESS => it takes a few seconds to load, but you see a link that says 'Audio file' pointing to the URL you placed in 'u' subfield, and below you see the musical inscript
8. in admin module enable OPACPlayMusicalInscripts preference
9. refresh opac view
SUCCESS => You see a play button below the musical inscript, and when you click, the song is played
10. sign off

Sponsored-by: Biblioteca Provincial Fr. Mamerto Esquiú (Provincia Franciscana de la Asunción)
Comment 11 Martin Renvoize 2019-10-30 07:30:23 UTC
So far so good, I've left a comment about using `Koha.Preference(` in the templates as an alterative to adding preference called inside the controller. 

I'll continue to test here.. going to load on of our music libraries catalogues in and see how that looks..
Comment 12 Martin Renvoize 2019-10-30 08:14:58 UTC
Minor QA comments.

* We appear to load the verovio css regardless of the syspref settings
* I think we seem to load the midi player JS even if we're only interested in displaying the musical notation (this might be me just not understanding the way the library code works)
* The clips seem to play very quickly to me.. I'm no musician though so perhaps they're playing at the proper speed?
* I'm sure how the $u subfield is intended to work.. you suggest in the test plan that it is required for this feature.. or is that simply to prove that $u still displays correctly when the verovio incipit are in place?

Generally, I really like this feature and think we can probably do some cleaning up in followups. 

I'm going to let this one slip past the Slush deadline a little so we should still make it before the freeze.
Comment 13 Agustín Moyano 2019-10-30 13:51:02 UTC
(In reply to Martin Renvoize from comment #12)
> Minor QA comments.

Hi Martin, I'll reply your comments
 
> * We appear to load the verovio css regardless of the syspref settings

Yes, I didn't notice that one

> * I think we seem to load the midi player JS even if we're only interested
> in displaying the musical notation (this might be me just not understanding
> the way the library code works)

No, midi player JS is wrapped by an IF statement


    [% IF playMusicalInscripts %]
        [% Asset.js("lib/verovio/000_acoustic_grand_piano.js") | $raw %]
        [% Asset.js("lib/verovio/midiplayer.js") | $raw %]
    [% END %]


> * The clips seem to play very quickly to me.. I'm no musician though so
> perhaps they're playing at the proper speed?

I really don't know.. the midi player library has no options to control playing speed

> * I'm sure how the $u subfield is intended to work.. you suggest in the test
> plan that it is required for this feature.. or is that simply to prove that
> $u still displays correctly when the verovio incipit are in place?

$u subfield it's really not related to the musical inscripts.. if it's not set, you simply don't get a link. 

I tought that it was very little effort to add a link if someone defined a url to the audio file

Regarding your previous comment, I'll change the preferences to use ' Koha.Preference('

Thanks
Comment 14 Agustín Moyano 2019-10-30 22:38:34 UTC
I've updated the commits in gitlab, with Owen Leonard's code and suggestion (Thanks Owen!)

I didn't realize that the midi player didn't play nice if multiple 031 were present.

Thanks again Owen!
Comment 15 Martin Renvoize 2019-11-01 07:15:52 UTC
All works as expected for me and I 'think' my comments have all been resolved.

Marking as Signed off.. (Will add SO line to patches on push)
Comment 16 Katrin Fischer 2019-11-01 13:30:59 UTC
Having a go here.
Comment 17 Katrin Fischer 2019-11-01 14:03:02 UTC
Created attachment 94952 [details] [review]
Bug 22581: Add new system preferences

This patch adds 2 new system preferences:
1. OPACShowMusicalInscripts - to toggle musical inscripts to appear in opac's detail page
2. OPACPlayMusicalInscripts - to toggle musical inscripts to be transformed and payed in midi. Depends on OPACShowMusicalInscripts to be enabled.

To test:
1. apply this patch
2. perl installer/data/mysql/updatedatabase.pl
3. search for this new preferences in admin module
SUCCESS => they appear in OPAC section.
4. sign off

Sponsored-by: Biblioteca Provincial Fr. Mamerto Esquiú (Provincia Franciscana de la Asunción)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 18 Katrin Fischer 2019-11-01 14:04:28 UTC
The written music is very pretty. How is the code in 031 generated? (out of interest) Passing QA on this one.

Do we need to add something to the about page for the new JavaScript libraries used here?
Comment 19 Katrin Fischer 2019-11-01 14:05:30 UTC
We might to improve the display later slightly - maybe move it further up, move the link closer to the written music, include a label.. but works for now nicely and is an optional feature.
Comment 20 Katrin Fischer 2019-11-01 14:07:37 UTC
Tiny thing: <xsl:text> Play this sample</xsl:text> - the space might get lost with the translation tools.
Comment 21 Martin Renvoize 2019-11-03 08:12:19 UTC
Nice work!

Pushed to master for 19.11.00
Comment 22 Bernardo Gonzalez Kriegel 2020-02-18 00:06:22 UTC
Question: Why 'inscripts' instead of 'incipits'?
I'm referring to the name of the preference and the displayed text.

Came to this doing translation.
Incipits makes sense, inscripts not so much.
Comment 23 Agustín Moyano 2020-02-18 14:47:39 UTC
(In reply to Bernardo Gonzalez Kriegel from comment #22)
> Question: Why 'inscripts' instead of 'incipits'?
> I'm referring to the name of the preference and the displayed text.
> 
> Came to this doing translation.
> Incipits makes sense, inscripts not so much.

Ups!.. misread the title of the bug!

I'll correct them in following bug
Comment 24 David Cook 2023-08-25 01:31:56 UTC
Btw this is a very cool feature that I never noticed before.

I'm removing on the onclick attribute event handlers using bug 34613 although I'm going to see if upstream will accept a pull request too...