Add SoundFonts’ names and licences (and score copyright) to waveform file metadata

• Mar 7, 2018 - 13:52
Type
Functional
Severity
S5 - Suggestion
Status
active
Regression
No
Workaround
Yes
Project

In order to fulfil the requirements of the MIT licence for our standard soundfont, as well as the requests of the soundfont creators, I propose the following:

For all soundfonts, collect the INAM and ICOP chunks (SF2/SF3; someone should look how this is dealt with in SFZ). Then, create a metadata string like this (pseudocode; might also need to convert from some foreign text encoding to Unicode):

… heh. We could even add the copyright from the score! Changed pseudocode to include it:


String sfmeta = rtrim(score->meta->copyright, "\n");
foreach (sountfont in soundfonts_used_in_playback) {
sfmeta += "\n\nMade using the soundfont " + soundfont.INAM + ":\n\n";
foreach (line in '\n'.split(soundfont.ICOP)) {
sfmeta += "| " + line + "\n";
}
}

Then, embed sfmeta into the resulting waveform files:

  • WAV: perhaps an INFO chunk with an ICOP chunk inside, containing this (might need to convert to some foreign text encoding)
  • MP3: perhaps an ID3v2 tag (at the end of file, not at the beginning, as this breaks some MP3 players) with it (ID3v2.4 uses Unicode for encoding TTBOMK)
  • OGG Vorbis, FLAC: no idea, but they will likely support metadata as well

Samuel Gossner from Versilian Studios indicated that soundfont providers wish to find music others did using their soundfonts, and that e.g. a keyword search on Soundcloud would help them to find that. Perhaps this metadata would show up there. In any way, it will massively help users in automatically fulfilling most attribution requirements.


Comments

The ICOP chunk is limited to 255 ASCII bytes (plus a NUL byte for padding), so we’d need to put the full licence info into the ICMT chunk (which, according to SF2 format version 2.04, has 65535 bytes available); I also don’t feel as bad putting UTF-8 into ICMT and keeping ICOP to pure ASCII.

For example, I’d patch the standard soundfont (2.315) as packaged in Debian like this:


CHUNK b'ICOP'(124): b'Copyright (c) Frank Wen, Michael Cowgill, and others; see ICMT chunk or Debian fluidr3mono-gm-soundfont for entire licence\x00\x00'
CHUNK b'IENG'(32): b'Mono version by Church Organist\x00'
CHUNK b'ICMT'(1848): b'Fluid (R3) Mono GM SoundFont\n\nOriginal Stereo version (Fluid (R3) SoundFont)\nCopyright \xc2\xa9 2000-2002, 2008 Frank Wen \nInclusion into Debian derivatives \xc2\xa9 2008 Toby Smithe\nDebian packaging \xc2\xa9 2018 Thorsten Glaser \n\nTemple Blocks instrument Copyright \xc2\xa9 2002 Ethan Winer\nDrumline Percussion Copyright \xc2\xa9 2016 Michael Schorsch\n\nMono version Copyright \xc2\xa9 2014-17 Michael Cowgill\n\nFluid was constructed in part from samples found in the public\ndomain that I [Frank Wen] edited/cleaned/remixed/programmed and\nlargely from recordings of my own and in conjunction with the\npeople below who helped along the way: Suren M. Seron,\nScott Hanan, Steve Aupperle, Chris Gillman, Alex Taubr,\nChris Prola, Andrew Klenk, Winfried Hubbe, Dylan, Tim, Gort,\nUros Katic, Ethan Winer (http://www.ethanwiner.com)\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the "Software"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\x00\x00'

I’ve actually just written a Python3 script (ouch…) that patches a RIFF file like this.

With a soundfont annotated like this, only the ICMT chunk is needed (ICOP and IENG are just partial summaries, ICMT contains the entire information). However, external/third-party soundfonts might not do that, or not have an ICMT chunk at all, so all three might be relevant.

Regression No
Workaround No

Incidentally, I have started on this and have some code already, but it’s nowhere near complete. Just wanted to update the status here in case anyone sees this.

Reported version 2.2  
Workaround No Yes

I solved this differently for now, because it turns out it is massively too hard to get the actual soundfonts used during playback or waveform conversion, as they are loaded with MIDI CCs and pretty much on-demand, and I think it would incur massive performance overhead. (Too bad, I already had correct (and that wasn’t trivial, let me tell you) ID3 tag writing code.)

What I do now is:

  • assume, in my conversion script, that the pieces I am converting will only use the default MS_General
  • use python3 riffedit.py -i /usr/share/sounds/sf3/MuseScore_General.sf3 to dump the metadata of the soundfont in a format easily converted to XML by the conversion shell script (format is {tag} \xFE {tag-content} \xFF, tag is something like ICOP and tag-content is the content taken from the file, in a somewhat sensible encoding (converted to UTF-8 if it wasn’t, and characters not valid in XML removed)
  • transform that into XML (search for function do_soundfont in the conversion script) for each soundfont (in case they differ for MuseScore 2 vs. 3)
  • for each score, collect its metadata (using XSLT via xmlstarlet, look for function cvtf2meta) — all metaTag tags, programVersion, the filename — and add that with a list of all formats I export to and the aforementioned soundfont metadata to an XML file
  • tell users on the download site they have to acknowledge the licence terms shown in those XML files (the “associated documentation files”, as the MIT licence calls it); this is sufficient, and I don’t have to include it in the MP3 file any more

The XML files are hugely beta. I plan to eventually make a little brother of musescore.com with in-browser playback, but I’m not good with JavaScript. They currently look like this:

<MirseScoreMetaPreBeta>
    <export href="/music/free/Rheinberger%20--%20Abendlied.mscz">MuseScore</export>
    <export href="/music/free/Rheinberger%20--%20Abendlied.mid">Standard MIDI</export>
    <export href="/music/free/Rheinberger%20--%20Abendlied.xml">MusicXML</export>
    <export href="/music/free/Rheinberger%20--%20Abendlied.pdf">PDF</export>
    <export href="/music/free/Rheinberger%20--%20Abendlied.mp3">MPEG 1 or 2, layer Ⅲ audio</export>
    <score href="/music/free/Rheinberger%20--%20Abendlied.mscx">
        <madeWith>2.3.2</madeWith>
        <metaTag name="com:description">Re-engraving (by mirabilos) of the Abendlied (from Drei geistliche Gesänge, opus 69 No. 3) by Josef Rheinberger, SSATTB (or SAATTB) a cappella, ca. 1873.
 
Quelle: IMSLP #477468
 
Copyfree Ⓕ This score is published under The MirOS Licence: <a href="http://www.mirbsd.org/MirOS-Licence.htm">http://www.mirbsd.org/MirOS-Licence.htm</a>
 
MuseScore version: <a href="http://www.mirbsd.org/music/free/Rheinberger%20--%20Abendlied.mscx">http://www.mirbsd.org/music/free/Rheinberger%20--%20Abendlied.mscx</a></metaTag>
        <metaTag name="com:nice-link"><a href="https://musescore.com/mirabilos/abendlied">https://musescore.com/mirabilos/abendlied</a></metaTag>
        <metaTag name="com:tags">Abendlied, Drei geistliche Gesänge, Rheinberger, Josef Rheinberger, Open Source, DFSG-free, Open Knowledge, MirOS Licence, Copyfree, Free, German, Deutsch, SSATTB, SAATTB, a cappella, v2</metaTag>
        <metaTag name="com:title">Rheinberger — Abendlied</metaTag>
        <metaTag name="composer">Josef Rheinberger (1839–1901)</metaTag>
        <metaTag name="copyright">gemeinfrei; MuseScore-Notensatz © (wo anwendbar) 2017 mirabilos Ⓕ The MirOS Licence</metaTag>
        <metaTag name="creationDate">2017-03-02</metaTag>
        <metaTag name="licenceBody[MirBSD]">Provided that these terms and disclaimer and all copyright notices
are retained or reproduced in an accompanying document, permission
is granted to deal in this work without restriction, including un‐
limited rights to use, publicly perform, distribute, sell, modify,
merge, give away, or sublicence.
 
This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
the utmost extent permitted by applicable law, neither express nor
implied; without malicious intent or gross negligence. In no event
may a licensor, author or contributor be held liable for indirect,
direct, other damage, loss, or other issues arising in any way out
of dealing in the work, even if advised of the possibility of such
damage or existence of a defect, except proven that it results out
of said person’s immediate fault when using the work as intended.</metaTag>
        <metaTag name="licenceGrant">The MirOS Licence as a collective-work copyright on the digital score. No other restrictions apply.
 
Also available under CC-BY 4.0 from IMSLP.
 
Also available under CC0 from the MuseScore “community” website.</metaTag>
        <metaTag name="lyricist">Lk 24,29</metaTag>
        <metaTag name="musescore:title">Abendlied</metaTag>
        <metaTag name="platform">Linux</metaTag>
        <metaTag name="source"><a href="https://musescore.com/user/1853601/scores/3508686">https://musescore.com/user/1853601/scores/3508686</a></metaTag>
        <metaTag name="workTitle">Abendlied</metaTag>
    </score>
    <soundfont file="MuseScore_General_Full.sf2">
        <info name="INAM">MuseScore_General_Full.sf2</info>
        <info name="ICRD">Friday 23 March 2018, 13:27:43</info>
        <info name="IENG">MuseScore_General by S. Christian Collins; based on Fluid (R3) Mono by Church Organist</info>
        <info name="ICOP">Copyright (c) Frank Wen, Michael Cowgill, S. Christian Collins, and others; see ICMT chunk or Debian source package musescore-general-soundfont (= 0.1.9-1) for entire terms and the MIT licence</info>
        <info name="ICMT">MuseScore_General_HQ SoundFont
 
Original Stereo version (Fluid (R3) SoundFont)
Copyright © 2000-2002, 2008 Frank Wen &lt;getfrank@gmail.com&gt;
Inclusion into Debian derivatives © 2008 Toby Smithe
Debian packaging © 2018-2020 mirabilos &lt;m@mirbsd.org&gt;
 
Temple Blocks instrument Copyright © 2002 Ethan Winer
Drumline Cymbals (MIT) Copyright © 2016 Michael Schorsch
 
Fluid (R3) Mono GM SoundFont Copyright © 2014-2017 Michael Cowgill
 
Splendid Grand piano from AKAI S5000 (verified Public Domain)
 
Ensemble strings from Versilian Studios Chamber Orchestra (VSCO) 2.1.1
Community Edition (CC0) by Sam Gossner, Simon Dalzell, Elan Hickler/Soundemote
 
Marching Cymbals: open crash samples from Versilian Community Sample Library
<a href="https://github.com/sgossner/VCSL">https://github.com/sgossner/VCSL</a> (CC0) by Sam Gossner
 
MuseScore Drumline (MDL) samples (CC0) by S. Christian Collins &amp; Amir Oosman
 
Adaptation for MuseScore_General Copyright © 2018-2020 S. Christian Collins
 
Fluid was constructed in part from samples found in the public
domain that I [Frank Wen] edited/cleaned/remixed/programmed and
largely from recordings of my own and in conjunction with the
people below who helped along the way: Suren M. Seron,
Scott Hanan, Steve Aupperle, Chris Gillman, Alex Taubr,
Chris Prola, Andrew Klenk, Winfried Hubbe, Dylan, Tim, Gort,
Uros Katic, Ethan Winer (<a href="http://www.ethanwiner.com">http://www.ethanwiner.com</a>)
 
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the &#34;Software&#34;), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
 
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
 
THE SOFTWARE IS PROVIDED &#34;AS IS&#34;, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.</info>
    </soundfont>
</MirseScoreMetaPreBeta>

This format is subject to change, of course. For example, I’m not entirely sure I’m happy with the export tags, and I’m pretty certain there will be changes to it. Also, no DTD ☺ but something like this will be usable with AJAX, for example…