@dsebastien/music-notation 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/i18n/en/index.d.ts +1 -0
- package/dist/i18n/en/play.d.ts +1 -0
- package/dist/i18n/fr/diagrams.d.ts +2 -2
- package/dist/i18n/fr/parse.d.ts +4 -4
- package/dist/i18n/fr/play.d.ts +1 -0
- package/dist/i18n/fr/timed.d.ts +4 -4
- package/dist/i18n/language.d.ts +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +158 -36
- package/dist/index.js.map +15 -14
- package/dist/music-notation.publish.min.js +32 -32
- package/dist/music-notation.tab.min.js +7 -7
- package/dist/playback/controls.d.ts +14 -0
- package/dist/playback/guitar-tone.d.ts +27 -0
- package/dist/playback/player.d.ts +12 -0
- package/dist/publish/index.js +135 -28
- package/dist/publish/index.js.map +14 -13
- package/dist/tab/index.js +87 -27
- package/dist/tab/index.js.map +10 -9
- package/dist/voicings/index.js +13 -11
- package/dist/voicings/index.js.map +7 -7
- package/package.json +2 -2
package/dist/tab/index.js
CHANGED
|
@@ -597,6 +597,7 @@ var enPlay = {
|
|
|
597
597
|
"playback.redraw.guitar": "{name}, drawn for guitar",
|
|
598
598
|
"playback.redraw.piano": "{name}, drawn for piano",
|
|
599
599
|
"playback.engine.invalid": 'engine: use generaluser, sonivox or light, got "{value}"',
|
|
600
|
+
"playback.guitar.invalid": 'guitar: use steel, nylon, clean or overdrive, got "{value}"',
|
|
600
601
|
"tab.source.staves": 'staves: use tab, score or both, got "{value}"',
|
|
601
602
|
"tab.source.layout": 'layout: use page or line, got "{value}"',
|
|
602
603
|
"tab.source.names": 'names: use on or off, got "{value}"',
|
|
@@ -752,7 +753,7 @@ var frDiagrams = {
|
|
|
752
753
|
"render.voicings.inversion": "inversion : utilisez 0 (fondamentale), 1, 2, 3 ou any, reçu « {inversion} »",
|
|
753
754
|
"render.voicings.manyStringsAny": "Sur {count} cordes, inversion: any demande six cordes ou moins : ajoutez par exemple strings: 1-6",
|
|
754
755
|
"render.voicings.wideArea": "une zone large",
|
|
755
|
-
"render.voicings.oneWidening": "Sur {count} cordes, utilisez
|
|
756
|
+
"render.voicings.oneWidening": "Sur {count} cordes, utilisez une seule option à la fois parmi {list}",
|
|
756
757
|
"render.noVoicing.gaps": "Les cordes {strings} ne sont pas côte à côte : ajoutez gaps: yes",
|
|
757
758
|
"render.noVoicing.rootString": "root-string {string} ne fait pas partie des cordes {strings}",
|
|
758
759
|
"render.noVoicing.inversion": "{symbol} a {notes} notes : inversion va jusqu'à {max}",
|
|
@@ -810,7 +811,7 @@ var frDiagrams = {
|
|
|
810
811
|
"fretboard.exercise.capo": "capo : utilisez une case de 1 à 12 (0 pour aucun), reçu {text}",
|
|
811
812
|
"fretboard.positions.numbering": "numbering : utilisez minor (positions depuis le relatif mineur), reçu « {text} »",
|
|
812
813
|
"fretboard.positions.numberingPentatonic": "numbering: minor sert aux positions de la pentatonique majeure (par exemple A major pentatonic), pas à {title}",
|
|
813
|
-
"fretboard.positions.numberingCaged": "numbering: minor numérote les positions
|
|
814
|
+
"fretboard.positions.numberingCaged": "numbering: minor numérote les positions (« box ») et 3nps, pas les formes CAGED",
|
|
814
815
|
"fretboard.positions.position": "position doit être un nombre entier à partir de 1, reçu « {text} »",
|
|
815
816
|
"fretboard.positions.shape": "Forme inconnue « {text} » : utilisez C, A, G, E, D ou 3nps",
|
|
816
817
|
"keyboard.fingering.finger": "fingering : les doigts vont de 1 (pouce) à 5 (auriculaire), reçu « {text} »",
|
|
@@ -971,7 +972,7 @@ var frParse = {
|
|
|
971
972
|
"blocks.fretboard.fromMinor": " (depuis {minor}m)",
|
|
972
973
|
"blocks.fretboard.shapeTitle": "{name}, forme {shape}",
|
|
973
974
|
"blocks.fretboard.threeNpsTitle": "{name}, 3nps {n}{from}",
|
|
974
|
-
"blocks.fretboard.boxTitle": "{name},
|
|
975
|
+
"blocks.fretboard.boxTitle": "{name}, position {n}{from}",
|
|
975
976
|
"blocks.scalesFor.both": "Utilisez scales-for (accords) ou scales-for-notes, pas les deux",
|
|
976
977
|
"blocks.scalesFor.findsItself": '{key} trouve la gamme seul : retirez "{what}"',
|
|
977
978
|
"blocks.scalesFor.addChords": "Ajoutez les accords : par ex. scales-for: G D Em C",
|
|
@@ -1020,8 +1021,8 @@ var frParse = {
|
|
|
1020
1021
|
"chord.words.fingerOn": "{finger} sur {strings}, {fret} case.",
|
|
1021
1022
|
"chord.words.fingerBars": "{finger} fait le barré à la {fret} case, cordes {from} à {to}.",
|
|
1022
1023
|
"chord.words.fingerAlsoOn": "{finger} aussi sur {string}, {fret} case.",
|
|
1023
|
-
"chord.words.muteOne": "Étouffez {list} :
|
|
1024
|
-
"chord.words.mutePlural": "Étouffez {list} :
|
|
1024
|
+
"chord.words.muteOne": "Étouffez {list} : laissez un doigt de l'accord l'effleurer.",
|
|
1025
|
+
"chord.words.mutePlural": "Étouffez {list} : laissez un doigt de l'accord les effleurer.",
|
|
1025
1026
|
"chord.words.groupRingOpenOne": "La corde {list} sonne à vide.",
|
|
1026
1027
|
"chord.words.groupRingOpenPlural": "Les cordes {list} sonnent à vide.",
|
|
1027
1028
|
"chord.words.groupRingCapoOne": "La corde {list} sonne au capodastre.",
|
|
@@ -1061,7 +1062,7 @@ var frParse = {
|
|
|
1061
1062
|
"theory.formula.formula": "Formule {formula}.",
|
|
1062
1063
|
"theory.formula.alsoWritten": "S'écrit aussi {list}.",
|
|
1063
1064
|
"theory.formula.scale": "{title} : {notes}.",
|
|
1064
|
-
"theory.formula.steps": "
|
|
1065
|
+
"theory.formula.steps": "Intervalles {steps}.",
|
|
1065
1066
|
"chords.chart.chorus": "Refrain",
|
|
1066
1067
|
"chords.chart.bridge": "Pont",
|
|
1067
1068
|
"chords.chart.tab": "Tablature",
|
|
@@ -1151,6 +1152,7 @@ var frPlay = {
|
|
|
1151
1152
|
"playback.redraw.guitar": "{name}, dessiné pour la guitare",
|
|
1152
1153
|
"playback.redraw.piano": "{name}, dessiné pour le piano",
|
|
1153
1154
|
"playback.engine.invalid": "engine: utilisez generaluser, sonivox ou light, reçu « {value} »",
|
|
1155
|
+
"playback.guitar.invalid": "guitar: utilisez steel, nylon, clean ou overdrive, reçu « {value} »",
|
|
1154
1156
|
"tab.source.staves": "staves: utilisez tab, score ou both, reçu « {value} »",
|
|
1155
1157
|
"tab.source.layout": "layout: utilisez page ou line, reçu « {value} »",
|
|
1156
1158
|
"tab.source.names": "names: utilisez on ou off, reçu « {value} »",
|
|
@@ -1215,7 +1217,7 @@ var frTimed = {
|
|
|
1215
1217
|
"strum.line.parenUnclosed": "« ) » manquant dans « {line} » : écrivez un coup fantôme ainsi : (U)",
|
|
1216
1218
|
"strum.line.chordEndsPattern": "L’accord [{chord}] termine le rythme : placez-le avant un coup ou un -",
|
|
1217
1219
|
"strum.pattern.chordLineAlone": "Une ligne d’accords demande une ligne de rythme dessous, par exemple D - D U - U D U",
|
|
1218
|
-
"strum.pattern.missing": "Écrivez
|
|
1220
|
+
"strum.pattern.missing": "Écrivez une rythmique, par exemple D - D U - U D U (ou D DU UDU)",
|
|
1219
1221
|
"strum.key.unknown": "Clé « {key} » inconnue : utilisez time, subdivision, swing, chord, tempo, tuning, title ou pattern",
|
|
1220
1222
|
"strum.swing.withTriplets": "Les triolets et le swing sont deux façons d’écrire un shuffle : gardez subdivision: triplets (D - U sur chaque temps), ou écrivez 8ths avec swing: yes",
|
|
1221
1223
|
"strum.swing.compound": "{time} a déjà trois {unit} par temps : retirez swing: (il swingue les 8ths ou les 16ths en 4/4, 3/4, 2/4…)",
|
|
@@ -1240,8 +1242,8 @@ var frTimed = {
|
|
|
1240
1242
|
"strum.feel.swingPercent": "Swing {percent} %",
|
|
1241
1243
|
"strum.feel.swing16": "Swing en doubles croches",
|
|
1242
1244
|
"strum.feel.swing16Percent": "Swing en doubles croches {percent} %",
|
|
1243
|
-
"strum.name": "
|
|
1244
|
-
"strum.name.titled": "{title} :
|
|
1245
|
+
"strum.name": "Rythmique {written}, {time}, {subdivision}{feel}",
|
|
1246
|
+
"strum.name.titled": "{title} : rythmique {written}, {time}, {subdivision}{feel}",
|
|
1245
1247
|
"strum.name.feel": ", {feel}",
|
|
1246
1248
|
"strum.tuning.unknown": "Accordage « {tuning} » inconnu : utilisez par exemple tuning: standard, drop d, ukulele ou E2 A2 D3 G3 B3 E4",
|
|
1247
1249
|
"strum.tuning.tooManyStrings": "12 cordes au plus",
|
|
@@ -1261,7 +1263,7 @@ var frTimed = {
|
|
|
1261
1263
|
"picking.name": "Motif de picking {written}, {time}, {subdivision}{over}",
|
|
1262
1264
|
"picking.name.titled": "{title} : motif de picking {written}, {time}, {subdivision}{over}",
|
|
1263
1265
|
"picking.name.over": ", sur {chords}",
|
|
1264
|
-
"picking.voicing.none": "
|
|
1266
|
+
"picking.voicing.none": "Aucune position jouable de {chord} pour cet accordage",
|
|
1265
1267
|
"export.image.title": "Notation musicale"
|
|
1266
1268
|
};
|
|
1267
1269
|
|
|
@@ -2982,6 +2984,55 @@ function pageEngine(options) {
|
|
|
2982
2984
|
return engineOf(play.engine) ?? undefined;
|
|
2983
2985
|
}
|
|
2984
2986
|
|
|
2987
|
+
// src/playback/guitar-tone.ts
|
|
2988
|
+
var GUITAR_TONES = ["steel", "nylon", "clean", "overdrive"];
|
|
2989
|
+
var DEFAULT_GUITAR_TONE = "steel";
|
|
2990
|
+
var GUITAR_PROGRAMS = {
|
|
2991
|
+
steel: 25,
|
|
2992
|
+
nylon: 24,
|
|
2993
|
+
clean: 27,
|
|
2994
|
+
overdrive: 29
|
|
2995
|
+
};
|
|
2996
|
+
var ALIASES2 = {
|
|
2997
|
+
acoustic: "steel",
|
|
2998
|
+
"steel-string": "steel",
|
|
2999
|
+
classical: "nylon",
|
|
3000
|
+
"nylon-string": "nylon",
|
|
3001
|
+
electric: "clean",
|
|
3002
|
+
overdriven: "overdrive"
|
|
3003
|
+
};
|
|
3004
|
+
function guitarToneOf(value) {
|
|
3005
|
+
if (typeof value !== "string")
|
|
3006
|
+
return null;
|
|
3007
|
+
const name = value.trim().toLowerCase().replace(/\s+/g, "-");
|
|
3008
|
+
return GUITAR_TONES.find((tone) => tone === name) ?? ALIASES2[name] ?? null;
|
|
3009
|
+
}
|
|
3010
|
+
var LINE2 = /^[ \t]*guitar[ \t]*:[ \t]*(.*?)[ \t]*(?:\r?\n|$)/gim;
|
|
3011
|
+
var DIRECTIVE2 = /^[ \t]*\{[ \t]*guitar[ \t]*:[ \t]*(.*?)[ \t]*\}[ \t]*(?:\r?\n|$)/gim;
|
|
3012
|
+
function blockGuitar(source, chart = false) {
|
|
3013
|
+
let guitar = null;
|
|
3014
|
+
const rest = source.replace(chart ? DIRECTIVE2 : LINE2, (_line, value) => {
|
|
3015
|
+
const read = guitarToneOf(value);
|
|
3016
|
+
if (!read) {
|
|
3017
|
+
throw new Error(t("playback.guitar.invalid", { value }));
|
|
3018
|
+
}
|
|
3019
|
+
guitar = read;
|
|
3020
|
+
return "";
|
|
3021
|
+
});
|
|
3022
|
+
return { guitar, source: rest };
|
|
3023
|
+
}
|
|
3024
|
+
function guitarWish(el) {
|
|
3025
|
+
return guitarToneOf(el?.closest("[data-mn-guitar]")?.getAttribute("data-mn-guitar"));
|
|
3026
|
+
}
|
|
3027
|
+
function pageGuitar(options) {
|
|
3028
|
+
if (!options || typeof options !== "object" || !("play" in options))
|
|
3029
|
+
return;
|
|
3030
|
+
const play = options.play;
|
|
3031
|
+
if (!play || typeof play !== "object" || !("guitar" in play))
|
|
3032
|
+
return;
|
|
3033
|
+
return guitarToneOf(play.guitar) ?? undefined;
|
|
3034
|
+
}
|
|
3035
|
+
|
|
2985
3036
|
// src/playback/bar-parts.ts
|
|
2986
3037
|
var ICONS = {
|
|
2987
3038
|
play: "M4 2.5v11l9-5.5z",
|
|
@@ -4584,14 +4635,15 @@ function renderTab(language, source, host, options) {
|
|
|
4584
4635
|
}
|
|
4585
4636
|
};
|
|
4586
4637
|
}
|
|
4587
|
-
var
|
|
4638
|
+
var PIANO_PROGRAM = 0;
|
|
4639
|
+
var programOf = (sound, guitar) => sound === "piano" ? PIANO_PROGRAM : GUITAR_PROGRAMS[guitar ?? DEFAULT_GUITAR_TONE];
|
|
4588
4640
|
var MUTED = { channel: 1, program: 28 };
|
|
4589
4641
|
var CLICK = { channel: 9, key: 33 };
|
|
4590
4642
|
var SOUNDFONT_TAIL = 0.5;
|
|
4591
4643
|
function soundfontPlayer(alphaTab, api) {
|
|
4592
4644
|
return {
|
|
4593
4645
|
reportsStart: true,
|
|
4594
|
-
play(events, { sound, volume, onEnd, onStart }) {
|
|
4646
|
+
play(events, { sound, volume, onEnd, onStart, guitar }) {
|
|
4595
4647
|
const current = api();
|
|
4596
4648
|
const player = current?.player;
|
|
4597
4649
|
if (!current || !player)
|
|
@@ -4600,7 +4652,7 @@ function soundfontPlayer(alphaTab, api) {
|
|
|
4600
4652
|
const handler = new alphaTab.midi.AlphaSynthMidiFileHandler(midi, true);
|
|
4601
4653
|
const ticks = (seconds) => Math.round(seconds * midi.division);
|
|
4602
4654
|
handler.addTempo(0, 60);
|
|
4603
|
-
handler.addProgramChange(0, 0, 0,
|
|
4655
|
+
handler.addProgramChange(0, 0, 0, programOf(sound, guitar));
|
|
4604
4656
|
if (sound === "guitar" && events.some((e) => e.kind === "muted"))
|
|
4605
4657
|
handler.addProgramChange(0, 0, MUTED.channel, MUTED.program);
|
|
4606
4658
|
if (events.some((e) => e.kind === "click"))
|
|
@@ -4644,8 +4696,8 @@ function createSoundfontPlayer(alphaTab, assets, doc, fallback) {
|
|
|
4644
4696
|
const have = new Set;
|
|
4645
4697
|
const reading = new Map;
|
|
4646
4698
|
let whole = !assets.instruments;
|
|
4647
|
-
const programsOf = (sound) => sound === "guitar" ? [
|
|
4648
|
-
const start = (first = "guitar") => {
|
|
4699
|
+
const programsOf = (sound, guitar) => sound === "guitar" ? [programOf(sound, guitar), MUTED.program] : [programOf(sound)];
|
|
4700
|
+
const start = (first = "guitar", guitar) => {
|
|
4649
4701
|
if (ready)
|
|
4650
4702
|
return ready;
|
|
4651
4703
|
host = html(doc, "div", "mn-tab-hidden");
|
|
@@ -4688,13 +4740,14 @@ function createSoundfontPlayer(alphaTab, assets, doc, fallback) {
|
|
|
4688
4740
|
current.error.on(() => resolve(false));
|
|
4689
4741
|
if (assets.instruments)
|
|
4690
4742
|
loadSounds(current, doc, assets, {
|
|
4691
|
-
programs: programsOf(first),
|
|
4743
|
+
programs: programsOf(first, guitar),
|
|
4692
4744
|
drums: false
|
|
4693
4745
|
}).then((kind) => {
|
|
4694
4746
|
if (kind === "whole")
|
|
4695
4747
|
whole = true;
|
|
4696
4748
|
else
|
|
4697
|
-
|
|
4749
|
+
for (const one of programsOf(first, guitar))
|
|
4750
|
+
have.add(one);
|
|
4698
4751
|
loaded();
|
|
4699
4752
|
}, () => resolve(false));
|
|
4700
4753
|
else
|
|
@@ -4702,25 +4755,32 @@ function createSoundfontPlayer(alphaTab, assets, doc, fallback) {
|
|
|
4702
4755
|
});
|
|
4703
4756
|
if (assets.soundFont instanceof Uint8Array && !assets.instruments)
|
|
4704
4757
|
current.loadSoundFont(made.bytes(assets.soundFont), false);
|
|
4705
|
-
current.tex(
|
|
4758
|
+
current.tex([
|
|
4759
|
+
...GUITAR_TONES.map((tone) => `\\track "Guitar ${tone}" \\instrument ${GUITAR_PROGRAMS[tone]} r`),
|
|
4760
|
+
`\\track "Piano" \\instrument ${PIANO_PROGRAM} r`,
|
|
4761
|
+
`\\track "Muted" \\instrument ${MUTED.program} r`
|
|
4762
|
+
].join(" "));
|
|
4706
4763
|
return ready;
|
|
4707
4764
|
};
|
|
4708
|
-
const sounding = async (sound) => {
|
|
4709
|
-
if (!await start(sound))
|
|
4765
|
+
const sounding = async (sound, guitar) => {
|
|
4766
|
+
if (!await start(sound, guitar))
|
|
4710
4767
|
return false;
|
|
4711
|
-
|
|
4768
|
+
const program = programOf(sound, guitar);
|
|
4769
|
+
if (whole || have.has(program) || !api)
|
|
4712
4770
|
return true;
|
|
4713
4771
|
const current = api;
|
|
4714
|
-
let more = reading.get(
|
|
4772
|
+
let more = reading.get(program);
|
|
4715
4773
|
if (!more) {
|
|
4716
|
-
|
|
4774
|
+
const programs = programsOf(sound, guitar).filter((one) => one === program || !have.has(MUTED.program));
|
|
4775
|
+
more = loadSounds(current, doc, assets, { programs, drums: false, click: false }, true).then((kind) => {
|
|
4717
4776
|
if (kind === "whole")
|
|
4718
4777
|
whole = true;
|
|
4719
4778
|
else
|
|
4720
|
-
|
|
4779
|
+
for (const one of programs)
|
|
4780
|
+
have.add(one);
|
|
4721
4781
|
return true;
|
|
4722
4782
|
}, () => false);
|
|
4723
|
-
reading.set(
|
|
4783
|
+
reading.set(program, more);
|
|
4724
4784
|
}
|
|
4725
4785
|
return more;
|
|
4726
4786
|
};
|
|
@@ -4731,7 +4791,7 @@ function createSoundfontPlayer(alphaTab, assets, doc, fallback) {
|
|
|
4731
4791
|
let handle = null;
|
|
4732
4792
|
let stopped = false;
|
|
4733
4793
|
let volume = options.volume;
|
|
4734
|
-
sounding(options.sound).then((ok) => {
|
|
4794
|
+
sounding(options.sound, options.guitar).then((ok) => {
|
|
4735
4795
|
if (stopped)
|
|
4736
4796
|
return;
|
|
4737
4797
|
try {
|
|
@@ -4803,5 +4863,5 @@ export {
|
|
|
4803
4863
|
textTabToAlphaTex
|
|
4804
4864
|
};
|
|
4805
4865
|
|
|
4806
|
-
//# debugId=
|
|
4866
|
+
//# debugId=160F358ACD31936664756E2164756E21
|
|
4807
4867
|
//# sourceMappingURL=index.js.map
|