App-Music-ChordPro
view release on metacpan or search on metacpan
lib/ChordPro/res/abc/abc2svg/mdnn-1.js view on Meta::CPAN
// mdnn.js - module to output Modernised Diatonic Numerical Notation
// (https://medium.com/@info_70544/the-case-for-numerical-music-notation-part-1-introduction-and-history-5f1543ca8a95)
//
// Copyright (C) 2020-2023 Jean-Francois Moine
//
// This file is part of abc2svg.
//
// abc2svg is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// abc2svg is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with abc2svg. If not, see <http://www.gnu.org/licenses/>.
//
// This module is loaded when "%%mdnn" appears in a ABC source.
//
// Parameters
// (none)
//
//fixme:nsk
// - Non Standard Key signature - other way to display the accidentals on key change
// polyfill
if (typeof Object.assign !== 'function') {
// Must be writable: true, enumerable: false, configurable: true
Object.defineProperty(Object, "assign", {
value: function assign(target, varArgs) { // .length of function is 2
'use strict';
if (target === null || target === undefined) {
throw new TypeError('Cannot convert undefined or null to object');
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource !== null && nextSource !== undefined) {
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
},
writable: true,
configurable: true
});
}
if (typeof abc2svg == "undefined")
var abc2svg = {}
abc2svg.mdnn = {
cde2fcg: new Int8Array([0, 2, 4, -1, 1, 3, 5]),
cgd2cde: new Int8Array([0, -4, -1, -5, -2, -6, -3,
0, -4, -1, -5, -2, -6, -3, 0]),
acc_tb: ["aff", "af", "n", "s", "ss"],
glyphs: {
n1: '<text id="n1" class="bn" x="-1.5" y="16">1</text>',
n2: '<text id="n2" class="bn" x="-1.5" y="16">2</text>',
n3: '<text id="n3" class="bn" x="-1.5" y="16">3</text>',
n4: '<text id="n4" class="bn" x="-1.5" y="16">4</text>',
n5: '<text id="n5" class="bn" x="-1.5" y="16">5</text>',
n6: '<text id="n6" class="bn" x="-1.5" y="16">6</text>',
n7: '<text id="n7" class="bn" x="-1.5" y="16">7</text>',
nq: '<text id="nq" class="bn" x="8" y="16">\'</text>',
nc: '<text id="nc" class="bn" x="8" y="16">,</text>',
nh: '<path id="nh" class="stroke" d="m3.5 0l-7.2 0 0 -6.2 7.2 0"/>',
nw: '<path id="nw" class="stroke" d="m6 -5l-7.2 0 0 -6.2 7.2 0 0 6.2"/>',
aff: '<text id="aff" class="music" x="-8" y="11"></text>',
af: '<text id="af" class="music" x="-8" y="11"></text>',
nn: '<text id="nn" class="music" x="-8" y="11"></text>',
ns: '<text id="ns" class="music" x="-8" y="11"></text>',
nss: '<text id="nss" class="music" x="-8" y="11"></text>'
}, //glyphs
decos: {
n1: "9 n1 0 0 0",
n2: "9 n2 0 0 0",
n3: "9 n3 0 0 0",
n4: "9 n4 0 0 0",
n5: "9 n5 0 0 0",
n6: "9 n6 0 0 0",
n7: "9 n7 0 0 0",
( run in 0.663 second using v1.01-cache-2.11-cpan-98e64b0badf )