mandioca-tabs-mcp 0.2.16 → 0.2.18
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/index.mjs +3170 -876
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -12336,12 +12336,13 @@ function migrarMarcasPorGrado(guardadas, pintarGradosViejo) {
|
|
|
12336
12336
|
}
|
|
12337
12337
|
return salida;
|
|
12338
12338
|
}
|
|
12339
|
-
var DocumentoTabs;
|
|
12339
|
+
var CLAVE_DE_LA_SESION, DocumentoTabs;
|
|
12340
12340
|
var init_documento = __esm({
|
|
12341
12341
|
"packages/model/src/documento.ts"() {
|
|
12342
12342
|
init_yjs();
|
|
12343
12343
|
init_src();
|
|
12344
12344
|
init_tipos();
|
|
12345
|
+
CLAVE_DE_LA_SESION = "sesion";
|
|
12345
12346
|
DocumentoTabs = class {
|
|
12346
12347
|
doc;
|
|
12347
12348
|
cabecera;
|
|
@@ -16458,6 +16459,13 @@ var init_moverNotas = __esm({
|
|
|
16458
16459
|
});
|
|
16459
16460
|
|
|
16460
16461
|
// packages/editor/src/atajos.ts
|
|
16462
|
+
function comoSeLee(combinacion) {
|
|
16463
|
+
const partes = combinacion.split("+");
|
|
16464
|
+
if (combinacion === "+") return "+";
|
|
16465
|
+
const ultima = partes.pop() ?? "";
|
|
16466
|
+
const legible = COMO_SE_LEE[ultima] ?? (ultima.length === 1 ? ultima.toUpperCase() : ultima);
|
|
16467
|
+
return [...partes.map((m) => MODIFICADORAS[m] ?? m), legible].join(" + ");
|
|
16468
|
+
}
|
|
16461
16469
|
function combinacionesDeLasTablas() {
|
|
16462
16470
|
return [
|
|
16463
16471
|
...Object.keys(MOVIMIENTOS_POR_TECLA),
|
|
@@ -16465,7 +16473,7 @@ function combinacionesDeLasTablas() {
|
|
|
16465
16473
|
...Object.keys(ACCIONES_CON_MAYUSCULAS).map(conMayusculas)
|
|
16466
16474
|
];
|
|
16467
16475
|
}
|
|
16468
|
-
var conMayusculas, COMANDOS_DE_MENU, COMANDOS_DE_AUDIO, NOMBRE_DE_LA_FIGURA, ATAJOS;
|
|
16476
|
+
var conMayusculas, COMANDOS_DE_MENU, COMANDOS_DE_AUDIO, NOMBRE_DE_LA_FIGURA, ATAJOS, COMO_SE_LEE, MODIFICADORAS;
|
|
16469
16477
|
var init_atajos = __esm({
|
|
16470
16478
|
"packages/editor/src/atajos.ts"() {
|
|
16471
16479
|
init_efectos();
|
|
@@ -16490,6 +16498,22 @@ var init_atajos = __esm({
|
|
|
16490
16498
|
{ id: "multipista", nombre: "Ver todas las pistas", grupo: "Vista y pistas" },
|
|
16491
16499
|
{ id: "una-pista", nombre: "Ver una sola pista", grupo: "Vista y pistas" },
|
|
16492
16500
|
{ id: "anacruza", nombre: "Anacruza ac\xE1", grupo: "Compases" },
|
|
16501
|
+
// ★ La voz del cursor (2026-11-10). Sin tecla de fábrica: Alt+número está inerte a propósito.
|
|
16502
|
+
{ id: "voz-1", nombre: "Escribir en la voz 1", grupo: "Escribir notas" },
|
|
16503
|
+
{ id: "voz-2", nombre: "Escribir en la voz 2", grupo: "Escribir notas" },
|
|
16504
|
+
{ id: "voz-3", nombre: "Escribir en la voz 3", grupo: "Escribir notas" },
|
|
16505
|
+
{ id: "voz-4", nombre: "Escribir en la voz 4", grupo: "Escribir notas" },
|
|
16506
|
+
{ id: "voz-siguiente", nombre: "Pasar a la voz siguiente", grupo: "Escribir notas" },
|
|
16507
|
+
// ★ Las dos puertas a las paletas que NO piden sostener nada (informe «Navegación de paletas
|
|
16508
|
+
// con teclado», 2026-11-11). Sin tecla de fábrica: el informe pide un comando reasignable,
|
|
16509
|
+
// y cualquier tecla libre que se eligiera acá le quitaría una a quien ya la usa para otra cosa.
|
|
16510
|
+
// · `paleta-con-teclado` deja ENGANCHADO el modo del Tab sostenido: para quien no puede
|
|
16511
|
+
// sostener teclas (temblor, una mano, teclado en pantalla). Sticky Keys de Windows sólo
|
|
16512
|
+
// engancha modificadores, y Tab no lo es. Se sale con Esc o con el mismo comando.
|
|
16513
|
+
// · `buscar-en-paletas` es la búsqueda de las siete a la vez: un combobox estándar, que es
|
|
16514
|
+
// además el camino principal para un lector de pantalla.
|
|
16515
|
+
{ id: "paleta-con-teclado", nombre: "Elegir en la paleta con el teclado, sin sostener Tab", grupo: "Escribir notas" },
|
|
16516
|
+
{ id: "buscar-en-paletas", nombre: "Buscar en las paletas\u2026", grupo: "Escribir notas" },
|
|
16493
16517
|
// ── ⛔⛔ EL MENÚ DE LA LÍNEA DIVISORIA, que faltaba (2026-09-01) ───────────────
|
|
16494
16518
|
//
|
|
16495
16519
|
// Estas cuatro se construyeron el 2026-09-01 con su menú, su modelo y sus cuatro
|
|
@@ -16513,6 +16537,12 @@ var init_atajos = __esm({
|
|
|
16513
16537
|
// ★ La sección (2026-09-13): el menú Compás la abre desde el cursor, y entra al catálogo el
|
|
16514
16538
|
// mismo día —asignable, sin tecla de fábrica—, que es la regla de toda acción nueva.
|
|
16515
16539
|
{ id: "compas-seccion", nombre: "Secci\xF3n en un comp\xE1s\u2026", grupo: "Compases" },
|
|
16540
|
+
// ★ Repeticiones, casillas y saltos a mano (2026-11-11, función 3 de la competencia). Entran
|
|
16541
|
+
// el mismo día que el menú, sin tecla de fábrica y asignables. Los nombres llevan las
|
|
16542
|
+
// palabras que se buscan («casilla», «coda», «segno», «fine»): el buscador lee el nombre.
|
|
16543
|
+
{ id: "compas-repeticion", nombre: "Barras de repetici\xF3n en un comp\xE1s o pasaje\u2026", grupo: "Compases" },
|
|
16544
|
+
{ id: "compas-casillas", nombre: "Casillas de repetici\xF3n (1.\xAA, 2.\xAA\u2026)\u2026", grupo: "Compases" },
|
|
16545
|
+
{ id: "compas-saltos", nombre: "Saltos y destinos: D.C., D.S., Segno, Coda, Fine\u2026", grupo: "Compases" },
|
|
16516
16546
|
{ id: "borrar-compases-desde", nombre: "Borrar de un comp\xE1s en adelante", grupo: "Compases" },
|
|
16517
16547
|
{ id: "borrar-compases-hasta", nombre: "Borrar de un comp\xE1s para atr\xE1s", grupo: "Compases" },
|
|
16518
16548
|
// ── EL ASPECTO DE LA OBRA (2026-09-01) ────────────────────────────
|
|
@@ -16598,6 +16628,9 @@ var init_atajos = __esm({
|
|
|
16598
16628
|
// ★ Agregado el 2026-09-03. Va en «Audio y mezcla» y no en un grupo propio porque es lo que
|
|
16599
16629
|
// uno prende para sincronizar a oído, junto al imán y a «oír el tramo».
|
|
16600
16630
|
{ id: "metronomo", nombre: "Metr\xF3nomo: marcar el pulso al reproducir", grupo: "Audio y mezcla" },
|
|
16631
|
+
// ★ Agregados el 2026-11-10 (práctica). Sin tecla de fábrica: cada uno se la pone.
|
|
16632
|
+
{ id: "bucle", nombre: "Bucle: repetir el pasaje marcado o el comp\xE1s del cursor", grupo: "Audio y mezcla" },
|
|
16633
|
+
{ id: "cuenta-previa", nombre: "Cuenta previa: un comp\xE1s de clics antes de entrar", grupo: "Audio y mezcla" },
|
|
16601
16634
|
{ id: "oir-tramo", nombre: "O\xEDr la grabaci\xF3n desde el comp\xE1s del cursor", grupo: "Audio y mezcla" },
|
|
16602
16635
|
{ id: "anclar", nombre: "Anclar el comp\xE1s del cursor a la grabaci\xF3n", grupo: "Audio y mezcla" },
|
|
16603
16636
|
{ id: "desanclar", nombre: "Soltar el comp\xE1s del cursor de la grabaci\xF3n", grupo: "Audio y mezcla" },
|
|
@@ -16648,11 +16681,29 @@ var init_atajos = __esm({
|
|
|
16648
16681
|
// teclado (ver `accionDe`).
|
|
16649
16682
|
{ id: "paleta-siguiente", nombre: "Pasar a la siguiente paleta (abre el panel de edici\xF3n si est\xE1 cerrado)", grupo: "Escribir notas", teclas: ["Tab"], reasignable: true },
|
|
16650
16683
|
// ★ 2026-11-03. Tab tocado pasa de paleta; Tab SOSTENIDO en la de acordes le da las flechas.
|
|
16684
|
+
{
|
|
16685
|
+
// ★ Desde el 2026-11-11, en las siete paletas y con la misma gramática. Ver
|
|
16686
|
+
// `paletasConTeclado.ts`.
|
|
16687
|
+
id: "paleta-con-tab",
|
|
16688
|
+
nombre: "Con Tab sostenido en cualquier paleta: \u2190 \u2192 elegir, \u2193 o Intro escribir, \u2191 quitar, letras para buscar, Esc para salir",
|
|
16689
|
+
grupo: "Escribir notas",
|
|
16690
|
+
teclas: ["Tab + \u2190 \u2192", "Tab + \u2193", "Tab + \u2191", "Tab + letras", "Tab + Esc"],
|
|
16691
|
+
reasignable: false,
|
|
16692
|
+
porQueNo: "Va con las flechas, que marcan la direcci\xF3n; Tab se reasigna en \xABPasar a la siguiente paleta\xBB."
|
|
16693
|
+
},
|
|
16694
|
+
{
|
|
16695
|
+
id: "paleta-con-tab-posicion",
|
|
16696
|
+
nombre: "Con Tab sostenido en Figura o Matiz: 1 a 9 eligen la ficha por su lugar",
|
|
16697
|
+
grupo: "Escribir notas",
|
|
16698
|
+
teclas: ["Tab + 1 \u2026 9"],
|
|
16699
|
+
reasignable: false,
|
|
16700
|
+
porQueNo: "Los d\xEDgitos son la posici\xF3n de la ficha, como sin Tab son el traste."
|
|
16701
|
+
},
|
|
16651
16702
|
{
|
|
16652
16703
|
id: "acorde-con-tab",
|
|
16653
|
-
nombre: "Con Tab sostenido en la paleta de acordes:
|
|
16704
|
+
nombre: "Con Tab sostenido en la paleta de acordes: Ctrl + \u2193 escribe s\xF3lo las notas",
|
|
16654
16705
|
grupo: "Escribir notas",
|
|
16655
|
-
teclas: ["Tab +
|
|
16706
|
+
teclas: ["Tab + Ctrl + \u2193"],
|
|
16656
16707
|
reasignable: false,
|
|
16657
16708
|
porQueNo: "Va con las flechas, que marcan la direcci\xF3n; Tab se reasigna en \xABPasar a la siguiente paleta\xBB."
|
|
16658
16709
|
},
|
|
@@ -16781,6 +16832,20 @@ var init_atajos = __esm({
|
|
|
16781
16832
|
// toda la ventana— y por eso todavía no se reasigna.
|
|
16782
16833
|
{ id: "info", nombre: "Mostrar u ocultar la ventana de info", grupo: "Vista y pistas", teclas: ["?"], reasignable: false, porQueNo: "Responde en toda la ventana, tambi\xE9n fuera del pliego: cambiarlo es otro trabajo." }
|
|
16783
16834
|
];
|
|
16835
|
+
COMO_SE_LEE = {
|
|
16836
|
+
" ": "Espacio",
|
|
16837
|
+
ArrowUp: "\u2191",
|
|
16838
|
+
ArrowDown: "\u2193",
|
|
16839
|
+
ArrowLeft: "\u2190",
|
|
16840
|
+
ArrowRight: "\u2192",
|
|
16841
|
+
Delete: "Supr",
|
|
16842
|
+
Backspace: "Retroceso",
|
|
16843
|
+
Home: "Inicio",
|
|
16844
|
+
End: "Fin",
|
|
16845
|
+
Enter: "Entrar",
|
|
16846
|
+
Escape: "Esc"
|
|
16847
|
+
};
|
|
16848
|
+
MODIFICADORAS = { Shift: "May" };
|
|
16784
16849
|
}
|
|
16785
16850
|
});
|
|
16786
16851
|
|
|
@@ -20603,9 +20668,207 @@ var init_acordes = __esm({
|
|
|
20603
20668
|
});
|
|
20604
20669
|
|
|
20605
20670
|
// packages/editor/src/miraDeAcordes.ts
|
|
20671
|
+
var MIRA_DEDUCIR;
|
|
20606
20672
|
var init_miraDeAcordes = __esm({
|
|
20607
20673
|
"packages/editor/src/miraDeAcordes.ts"() {
|
|
20608
20674
|
init_acordes();
|
|
20675
|
+
MIRA_DEDUCIR = "+deducir";
|
|
20676
|
+
}
|
|
20677
|
+
});
|
|
20678
|
+
|
|
20679
|
+
// packages/editor/src/paletasConTeclado.ts
|
|
20680
|
+
function fichasFijas(familia) {
|
|
20681
|
+
switch (familia) {
|
|
20682
|
+
case "figura":
|
|
20683
|
+
return [
|
|
20684
|
+
...FIGURAS.map((f) => ({ id: `figura-${f.valor}`, nombre: f.nombre, atajo: `figura-${f.valor}` })),
|
|
20685
|
+
{ id: "puntillo", nombre: "puntillo", atajo: "puntillo" },
|
|
20686
|
+
{ id: "silencio", nombre: "silencio", atajo: "silencio" }
|
|
20687
|
+
].map(conSinonimos);
|
|
20688
|
+
case "tecnica":
|
|
20689
|
+
return [
|
|
20690
|
+
...EFECTOS_EN_ORDEN.map((e) => ({ id: `efecto-${e}`, nombre: EFECTOS[e].nombre, atajo: `efecto-${e}` })),
|
|
20691
|
+
...FORMAS_EN_ORDEN.map((f) => ({
|
|
20692
|
+
id: `bend-${f}`,
|
|
20693
|
+
nombre: FORMAS_DE_BEND[f].nombre,
|
|
20694
|
+
...f === "bend" ? { atajo: "bend" } : {}
|
|
20695
|
+
})),
|
|
20696
|
+
...ALTURAS_DE_BEND.map((a) => ({ id: `sube-${a.cuartos}`, nombre: `sube ${a.nombre.toLowerCase()}` })),
|
|
20697
|
+
{ id: "curva", nombre: "curva propia" }
|
|
20698
|
+
].map(conSinonimos);
|
|
20699
|
+
case "signo":
|
|
20700
|
+
return GRUPOS_EN_ORDEN.flatMap(
|
|
20701
|
+
(g) => signosDelGrupo(g).map((s) => ({ id: `signo-${s.clave}`, nombre: s.nombre, atajo: `signo-${s.clave}` }))
|
|
20702
|
+
).map(conSinonimos);
|
|
20703
|
+
case "matiz":
|
|
20704
|
+
return MATICES.map((m) => {
|
|
20705
|
+
const [italiano = "", resto = ""] = m.detalle.split("\u2014");
|
|
20706
|
+
const castellano = resto.split(".")[0] ?? "";
|
|
20707
|
+
return {
|
|
20708
|
+
id: `matiz-${m.nombre}`,
|
|
20709
|
+
nombre: m.nombre,
|
|
20710
|
+
sinonimos: [italiano.trim(), castellano.trim()].filter(Boolean),
|
|
20711
|
+
atajo: `comando-matiz-${m.nombre}`
|
|
20712
|
+
};
|
|
20713
|
+
});
|
|
20714
|
+
case "kit":
|
|
20715
|
+
return KIT.map((p) => conSinonimos({ id: `kit-${p.indice}`, nombre: p.nombre }));
|
|
20716
|
+
case "acorde":
|
|
20717
|
+
case "seccion":
|
|
20718
|
+
return [];
|
|
20719
|
+
}
|
|
20720
|
+
}
|
|
20721
|
+
function fichasDeAcordes(usados) {
|
|
20722
|
+
return [
|
|
20723
|
+
{ id: MIRA_DEDUCIR, nombre: "+ acorde", sinonimos: ["a\xF1adir", "deducir", "el del golpe"] },
|
|
20724
|
+
...usados.map((a) => ({ id: a.clave, nombre: a.letra ? `${a.nombre} ${a.letra}` : a.nombre }))
|
|
20725
|
+
];
|
|
20726
|
+
}
|
|
20727
|
+
function fichasDeSecciones(nombres) {
|
|
20728
|
+
const vistos = /* @__PURE__ */ new Set();
|
|
20729
|
+
const unicos = [];
|
|
20730
|
+
for (const n of nombres) {
|
|
20731
|
+
const limpio = n.trim();
|
|
20732
|
+
if (limpio && !vistos.has(limpio)) {
|
|
20733
|
+
vistos.add(limpio);
|
|
20734
|
+
unicos.push(limpio);
|
|
20735
|
+
}
|
|
20736
|
+
}
|
|
20737
|
+
return [
|
|
20738
|
+
{ id: SECCION_NUEVA, nombre: "nombre nuevo", sinonimos: ["escribir", "otra"] },
|
|
20739
|
+
...unicos.map((n) => ({ id: `seccion:${n}`, nombre: n }))
|
|
20740
|
+
];
|
|
20741
|
+
}
|
|
20742
|
+
function normalizarBusqueda(texto4) {
|
|
20743
|
+
return texto4.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/\s+/g, " ").trim();
|
|
20744
|
+
}
|
|
20745
|
+
function puntajeDeBusqueda(ficha, texto4) {
|
|
20746
|
+
const q = normalizarBusqueda(texto4);
|
|
20747
|
+
if (!q) return null;
|
|
20748
|
+
const nombre = normalizarBusqueda(ficha.nombre);
|
|
20749
|
+
const otros = (ficha.sinonimos ?? []).map(normalizarBusqueda);
|
|
20750
|
+
if (nombre === q) return -1;
|
|
20751
|
+
if (nombre.startsWith(q)) return 0;
|
|
20752
|
+
if (otros.some((s) => s.startsWith(q))) return 1;
|
|
20753
|
+
const palabras = [nombre, ...otros].flatMap((t) => t.split(/[\s(),/-]+/));
|
|
20754
|
+
if (palabras.some((p) => p.startsWith(q))) return 2;
|
|
20755
|
+
if (nombre.includes(q) || otros.some((s) => s.includes(q))) return 3;
|
|
20756
|
+
return null;
|
|
20757
|
+
}
|
|
20758
|
+
function buscarEnLasPaletas(paletas, texto4, limite = 12) {
|
|
20759
|
+
if (!normalizarBusqueda(texto4)) return [];
|
|
20760
|
+
const todos = [];
|
|
20761
|
+
let orden = 0;
|
|
20762
|
+
for (const { familia, fichas } of paletas) {
|
|
20763
|
+
for (const ficha of fichas) {
|
|
20764
|
+
const p = puntajeDeBusqueda(ficha, texto4);
|
|
20765
|
+
if (p !== null) todos.push({ familia, ficha, puntaje: p, orden });
|
|
20766
|
+
orden++;
|
|
20767
|
+
}
|
|
20768
|
+
}
|
|
20769
|
+
return todos.sort((a, b) => a.puntaje - b.puntaje || a.orden - b.orden).slice(0, limite).map(({ familia, ficha, puntaje: p }) => ({ familia, ficha, puntaje: p }));
|
|
20770
|
+
}
|
|
20771
|
+
var NOMBRE_DE_LA_FAMILIA, SINONIMOS, conSinonimos, FIGURAS, SECCION_NUEVA;
|
|
20772
|
+
var init_paletasConTeclado = __esm({
|
|
20773
|
+
"packages/editor/src/paletasConTeclado.ts"() {
|
|
20774
|
+
init_efectos();
|
|
20775
|
+
init_bend();
|
|
20776
|
+
init_variantes();
|
|
20777
|
+
init_signos();
|
|
20778
|
+
init_dinamicas();
|
|
20779
|
+
init_miraDeAcordes();
|
|
20780
|
+
init_src2();
|
|
20781
|
+
NOMBRE_DE_LA_FAMILIA = {
|
|
20782
|
+
figura: "Figura",
|
|
20783
|
+
tecnica: "T\xE9cnica",
|
|
20784
|
+
signo: "Signo",
|
|
20785
|
+
acorde: "Acorde",
|
|
20786
|
+
kit: "Bater\xEDa",
|
|
20787
|
+
matiz: "Matiz",
|
|
20788
|
+
seccion: "Secci\xF3n"
|
|
20789
|
+
};
|
|
20790
|
+
SINONIMOS = {
|
|
20791
|
+
// Figuras
|
|
20792
|
+
"figura-1": ["entera", "whole"],
|
|
20793
|
+
"figura-2": ["mitad", "half"],
|
|
20794
|
+
"figura-4": ["cuarto", "quarter"],
|
|
20795
|
+
"figura-8": ["octavo", "eighth"],
|
|
20796
|
+
"figura-16": ["dieciseisavo", "sixteenth"],
|
|
20797
|
+
"figura-32": ["treintaidosavo", "thirty-second"],
|
|
20798
|
+
"figura-64": ["sesentaicuatroavo", "sixty-fourth"],
|
|
20799
|
+
puntillo: ["punto", "dot"],
|
|
20800
|
+
silencio: ["pausa", "rest"],
|
|
20801
|
+
// Técnicas
|
|
20802
|
+
"efecto-martillo": ["ligado", "hammer", "hammer-on", "pull-off"],
|
|
20803
|
+
"efecto-deslizamiento": ["slide", "glissando", "arrastre"],
|
|
20804
|
+
"efecto-muerta": ["apagada", "dead note", "muted"],
|
|
20805
|
+
"efecto-palmMute": ["muteado", "apagado con la palma", "pm"],
|
|
20806
|
+
"efecto-letRing": ["dejar sonar", "que suene"],
|
|
20807
|
+
"efecto-vibrato": ["temblor"],
|
|
20808
|
+
"efecto-fantasma": ["ghost", "nota fantasma"],
|
|
20809
|
+
"efecto-armonico": ["harmonic", "flageolet"],
|
|
20810
|
+
"efecto-staccato": ["staccato", "corto"],
|
|
20811
|
+
"efecto-ligadaAAnterior": ["ligadura de prolongaci\xF3n", "tie", "prolongar"],
|
|
20812
|
+
"bend-bend": ["estirar", "estirada", "bending"],
|
|
20813
|
+
"bend-bendVuelta": ["release", "estirar y soltar"],
|
|
20814
|
+
"bend-prebend": ["pre bend", "ya estirada"],
|
|
20815
|
+
"bend-prebendVuelta": ["pre bend release"],
|
|
20816
|
+
curva: ["curva de bend", "dibujar"],
|
|
20817
|
+
// Signos
|
|
20818
|
+
"signo-acento": ["accent", "marcato"],
|
|
20819
|
+
"signo-ligaduraDeExpresion": ["ligado", "slur", "legato"],
|
|
20820
|
+
"signo-calderon": ["fermata", "corona"],
|
|
20821
|
+
"signo-pedal": ["sustain", "pedal"],
|
|
20822
|
+
"signo-anchoDeVibrato": ["vibrato"],
|
|
20823
|
+
"signo-vibratoDePalanca": ["whammy", "tremolo bar", "palanca"],
|
|
20824
|
+
"signo-tappingIzquierda": ["tap"],
|
|
20825
|
+
"signo-dedoIzquierda": ["digitacion", "dedo", "fingering"],
|
|
20826
|
+
"signo-cejilla": ["barre", "cejuela", "capo"],
|
|
20827
|
+
"signo-puaDireccion": ["pick", "plectro", "downstroke", "upstroke", "direccion"],
|
|
20828
|
+
"signo-rasgueo": ["arpegio", "strum", "brush"],
|
|
20829
|
+
"signo-rasgueado": ["flamenco"],
|
|
20830
|
+
"signo-slap": ["bajo"],
|
|
20831
|
+
"signo-pop": ["bajo"],
|
|
20832
|
+
"signo-tapping": ["tap"],
|
|
20833
|
+
"signo-slapMuerto": ["dead slap"],
|
|
20834
|
+
"signo-golpeEnLaTapa": ["percusion", "tapa"],
|
|
20835
|
+
"signo-dedoDerecha": ["pima", "digitacion", "dedo"],
|
|
20836
|
+
"signo-adorno": ["grace", "appoggiatura", "acciaccatura", "mordente"],
|
|
20837
|
+
"signo-tremolo": ["tremolo picking", "tremolo"],
|
|
20838
|
+
"signo-trino": ["trill"],
|
|
20839
|
+
"signo-regulador": ["crescendo", "decrescendo", "hairpin"],
|
|
20840
|
+
"signo-fundido": ["fade", "volume swell"],
|
|
20841
|
+
"signo-wah": ["wah"],
|
|
20842
|
+
"signo-alteracion": ["sostenido", "bemol", "becuadro", "accidental"],
|
|
20843
|
+
"signo-muestraCuerda": ["cuerda", "string"],
|
|
20844
|
+
"signo-barraOblicua": ["slash", "ritmo"],
|
|
20845
|
+
"signo-plicaInvertida": ["plica", "stem"],
|
|
20846
|
+
"signo-barrado": ["beam", "corchete"],
|
|
20847
|
+
// Batería
|
|
20848
|
+
"kit-0": ["kick", "bass drum"],
|
|
20849
|
+
"kit-1": ["snare", "redoblante", "tarola"],
|
|
20850
|
+
"kit-2": ["rimshot", "aro"],
|
|
20851
|
+
"kit-3": ["tom", "high tom"],
|
|
20852
|
+
"kit-4": ["tom", "mid tom"],
|
|
20853
|
+
"kit-5": ["floor tom", "tom de pie"],
|
|
20854
|
+
"kit-6": ["hi-hat", "hihat", "contratiempo", "hh"],
|
|
20855
|
+
"kit-7": ["hi-hat abierto", "hihat abierto"],
|
|
20856
|
+
"kit-8": ["hi-hat pedal", "pie"],
|
|
20857
|
+
"kit-9": ["platillo", "crash"],
|
|
20858
|
+
"kit-10": ["platillo", "ride"],
|
|
20859
|
+
"kit-11": ["bell", "campana"]
|
|
20860
|
+
};
|
|
20861
|
+
conSinonimos = (f) => SINONIMOS[f.id] ? { ...f, sinonimos: SINONIMOS[f.id] } : f;
|
|
20862
|
+
FIGURAS = [
|
|
20863
|
+
{ valor: 1, nombre: "redonda" },
|
|
20864
|
+
{ valor: 2, nombre: "blanca" },
|
|
20865
|
+
{ valor: 4, nombre: "negra" },
|
|
20866
|
+
{ valor: 8, nombre: "corchea" },
|
|
20867
|
+
{ valor: 16, nombre: "semicorchea" },
|
|
20868
|
+
{ valor: 32, nombre: "fusa" },
|
|
20869
|
+
{ valor: 64, nombre: "semifusa" }
|
|
20870
|
+
];
|
|
20871
|
+
SECCION_NUEVA = "+nueva";
|
|
20609
20872
|
}
|
|
20610
20873
|
});
|
|
20611
20874
|
|
|
@@ -20814,9 +21077,11 @@ var init_instrumentos = __esm({
|
|
|
20814
21077
|
programaMidi: PROGRAMAS.guitarraNylon
|
|
20815
21078
|
},
|
|
20816
21079
|
// ── Teclados ──
|
|
21080
|
+
// ★ (2026-11-11) Los tres en DOS pentagramas bajo una llave, como se escriben: el órgano también
|
|
21081
|
+
// (antes salía en uno, sin llave). Ver `verificar-llave-del-piano`.
|
|
20817
21082
|
{ clave: "piano", nombre: "Piano", nombreCorto: "pno", grupo: "Teclados", tipo: "altura", afinacion: [], programaMidi: PROGRAMAS.piano, pentagramas: 2 },
|
|
20818
21083
|
{ clave: "piano-electrico", nombre: "Piano el\xE9ctrico", nombreCorto: "e.pno", grupo: "Teclados", tipo: "altura", afinacion: [], programaMidi: PROGRAMAS.pianoElectrico, pentagramas: 2 },
|
|
20819
|
-
{ clave: "organo", nombre: "\xD3rgano", nombreCorto: "org", grupo: "Teclados", tipo: "altura", afinacion: [], programaMidi: PROGRAMAS.organo },
|
|
21084
|
+
{ clave: "organo", nombre: "\xD3rgano", nombreCorto: "org", grupo: "Teclados", tipo: "altura", afinacion: [], programaMidi: PROGRAMAS.organo, pentagramas: 2 },
|
|
20820
21085
|
// ── Vientos ──
|
|
20821
21086
|
{ clave: "trompeta", nombre: "Trompeta", nombreCorto: "tpt", grupo: "Vientos", tipo: "altura", afinacion: [], programaMidi: PROGRAMAS.trompeta },
|
|
20822
21087
|
{ clave: "trombon", nombre: "Tromb\xF3n", nombreCorto: "tbn", grupo: "Vientos", tipo: "altura", afinacion: [], programaMidi: PROGRAMAS.trombon },
|
|
@@ -21292,6 +21557,18 @@ var init_menus = __esm({
|
|
|
21292
21557
|
principiante: "Borra la nota que est\xE1 bajo el cursor. El tiempo que ocupaba queda en su lugar, como silencio, as\xED que el comp\xE1s no se corre.",
|
|
21293
21558
|
profesional: "Borra la nota; el golpe queda."
|
|
21294
21559
|
},
|
|
21560
|
+
"menu-buscar-en-paletas": {
|
|
21561
|
+
nombre: "Buscar en las paletas\u2026",
|
|
21562
|
+
accion: "comando-buscar-en-paletas",
|
|
21563
|
+
principiante: "Abre un buscador que mira las siete paletas a la vez. Escribe el nombre de un signo, una t\xE9cnica, una figura o un matiz, y elige con las flechas. Sirve cuando no sabes en qu\xE9 paleta est\xE1 algo.",
|
|
21564
|
+
profesional: "B\xFAsqueda global de paletas."
|
|
21565
|
+
},
|
|
21566
|
+
"menu-paleta-con-teclado": {
|
|
21567
|
+
nombre: "Paleta con el teclado, sin sostener Tab",
|
|
21568
|
+
accion: "comando-paleta-con-teclado",
|
|
21569
|
+
principiante: "Hace lo mismo que mantener Tab apretado, pero sin tener que sostenerlo: las flechas eligen en la paleta, \u2193 escribe, \u2191 quita y las letras buscan. Sirve si sostener una tecla te cuesta. Para salir, Esc o este mismo comando.",
|
|
21570
|
+
profesional: "Modo fijo del Tab sostenido; Esc o el mismo comando salen."
|
|
21571
|
+
},
|
|
21295
21572
|
"menu-borrar-figura": {
|
|
21296
21573
|
nombre: "Borrar la figura entera",
|
|
21297
21574
|
accion: "borrar-figura",
|
|
@@ -21374,6 +21651,24 @@ var init_menus = __esm({
|
|
|
21374
21651
|
principiante: "Le pone un nombre a la parte que empieza en el comp\xE1s del cursor: Intro, Estrofa, Coro, el que quieras. Si ah\xED ya empieza una secci\xF3n, puedes cambiarle el nombre o borrarlo.",
|
|
21375
21652
|
profesional: "Marca de secci\xF3n en el comp\xE1s del cursor."
|
|
21376
21653
|
},
|
|
21654
|
+
"menu-repeticion": {
|
|
21655
|
+
nombre: "Repetici\xF3n\u2026",
|
|
21656
|
+
accion: "comando-compas-repeticion",
|
|
21657
|
+
principiante: "Pone las barras de repetici\xF3n. Con un pasaje marcado, abre en su primer comp\xE1s y cierra en el \xFAltimo. Sin pasaje, va en el comp\xE1s del cursor. Eliges cu\xE1ntas veces se toca. Desmarca las barras para quitarlas.",
|
|
21658
|
+
profesional: "Barras de inicio y fin de repetici\xF3n, con n\xFAmero de veces."
|
|
21659
|
+
},
|
|
21660
|
+
"menu-casillas": {
|
|
21661
|
+
nombre: "Casillas\u2026",
|
|
21662
|
+
accion: "comando-compas-casillas",
|
|
21663
|
+
principiante: "Pone una casilla de repetici\xF3n, la 1.\xAA o la 2.\xAA: el comp\xE1s se toca s\xF3lo en esas vueltas. Con un pasaje marcado, la casilla abarca todo el pasaje. Necesita una barra de cierre para hacer algo.",
|
|
21664
|
+
profesional: "Casillas 1.\xAA, 2.\xAA\u2026 del comp\xE1s o del pasaje."
|
|
21665
|
+
},
|
|
21666
|
+
"menu-saltos": {
|
|
21667
|
+
nombre: "D.C., D.S. y Coda\u2026",
|
|
21668
|
+
accion: "comando-compas-saltos",
|
|
21669
|
+
principiante: "Pone en el comp\xE1s del cursor un salto (D.C., D.S., To Coda) o un destino (Segno, Coda, Fine). Un D.S. al Coda necesita tres marcas: el Segno, el To Coda y la Coda. La ventana te avisa si falta alguna.",
|
|
21670
|
+
profesional: "Segno, Coda, Fine y los saltos del comp\xE1s del cursor."
|
|
21671
|
+
},
|
|
21377
21672
|
// ── Nota ────────────────────────────────────────────────────────────────────
|
|
21378
21673
|
"menu-duplicar": {
|
|
21379
21674
|
nombre: "Repetir la nota anterior",
|
|
@@ -21631,6 +21926,28 @@ var init_barra = __esm({
|
|
|
21631
21926
|
principiante: "Prende o apaga un clic que marca el pulso mientras suena la obra. Prendido, aparece tambi\xE9n en el mezclador con su propio volumen.",
|
|
21632
21927
|
profesional: "Clic de metr\xF3nomo; volumen propio en el mezclador."
|
|
21633
21928
|
},
|
|
21929
|
+
"barra.bucle": {
|
|
21930
|
+
nombre: "Bucle",
|
|
21931
|
+
accion: "audio-bucle",
|
|
21932
|
+
principiante: "Repite una y otra vez el pasaje que marcaste, o el comp\xE1s del cursor si no marcaste nada. Al lado del bot\xF3n se ven los compases que se repiten.",
|
|
21933
|
+
profesional: "Loop del pasaje marcado o del comp\xE1s del cursor."
|
|
21934
|
+
},
|
|
21935
|
+
"barra.practica": {
|
|
21936
|
+
nombre: "Pr\xE1ctica",
|
|
21937
|
+
principiante: "Ajustes para practicar: un comp\xE1s de cuenta antes de que entre la m\xFAsica, y que la velocidad suba sola cada tantas vueltas del bucle hasta la que elijas. De f\xE1brica todo apagado.",
|
|
21938
|
+
profesional: "Count-in y speed trainer del bucle."
|
|
21939
|
+
},
|
|
21940
|
+
// ★ Sólo existe con el teléfono parado (2026-11-11): la de escritorio vive en el panel de audio.
|
|
21941
|
+
"barra.velocidad": {
|
|
21942
|
+
nombre: "Velocidad",
|
|
21943
|
+
principiante: "La obra suena m\xE1s lenta o m\xE1s r\xE1pida, de \xD70,25 a \xD71,5. La afinaci\xF3n no cambia. Sirve para sacar un pasaje dif\xEDcil de a poco.",
|
|
21944
|
+
profesional: "Velocidad del transporte, \xD70,25 a \xD71,5, con el tono intacto."
|
|
21945
|
+
},
|
|
21946
|
+
"barra.voz": {
|
|
21947
|
+
nombre: "Voz",
|
|
21948
|
+
principiante: "En qu\xE9 voz escribes. Una voz es una l\xEDnea mel\xF3dica dentro del mismo pentagrama: por ejemplo, el bajo en la voz 1 y la melod\xEDa en la voz 2, cada una con sus propias figuras. Lo que teclees va a la voz marcada.",
|
|
21949
|
+
profesional: "Voz del cursor (1\u20134)."
|
|
21950
|
+
},
|
|
21634
21951
|
"barra.selector-sigue": {
|
|
21635
21952
|
nombre: "El selector sigue a la reproducci\xF3n",
|
|
21636
21953
|
principiante: "Prendido, el cursor de escritura acompa\xF1a a la m\xFAsica mientras suena. Apagado, el cursor se queda donde lo pusiste, y cada vez que aprietas play vuelve a sonar el mismo pasaje: sirve para practicar una parte.",
|
|
@@ -21686,7 +22003,7 @@ function fichaDeSigno(s) {
|
|
|
21686
22003
|
profesional: s.ayuda.length <= 120 && (s.ayuda.match(/[.!?](\s|$)/g) ?? []).length <= 2 ? s.ayuda : `${s.nombre}.`
|
|
21687
22004
|
};
|
|
21688
22005
|
}
|
|
21689
|
-
var FICHAS_DE_SIGNOS,
|
|
22006
|
+
var FICHAS_DE_SIGNOS, FIGURAS2, FICHAS_DE_FIGURAS, FICHAS_DE_MATICES, FICHAS_DE_LA_PALETA;
|
|
21690
22007
|
var init_paleta = __esm({
|
|
21691
22008
|
"packages/editor/src/info/fichas/paleta.ts"() {
|
|
21692
22009
|
init_signos();
|
|
@@ -21694,7 +22011,7 @@ var init_paleta = __esm({
|
|
|
21694
22011
|
FICHAS_DE_SIGNOS = Object.fromEntries(
|
|
21695
22012
|
SIGNOS.map((s) => [`signo.${s.clave}`, fichaDeSigno(s)])
|
|
21696
22013
|
);
|
|
21697
|
-
|
|
22014
|
+
FIGURAS2 = [
|
|
21698
22015
|
{ valor: 1, nombre: "Redonda", dura: "cuatro tiempos en un comp\xE1s de 4/4" },
|
|
21699
22016
|
{ valor: 2, nombre: "Blanca", dura: "dos tiempos" },
|
|
21700
22017
|
{ valor: 4, nombre: "Negra", dura: "un tiempo" },
|
|
@@ -21704,7 +22021,7 @@ var init_paleta = __esm({
|
|
|
21704
22021
|
{ valor: 64, nombre: "Semifusa", dura: "un dieciseisavo de tiempo" }
|
|
21705
22022
|
];
|
|
21706
22023
|
FICHAS_DE_FIGURAS = Object.fromEntries(
|
|
21707
|
-
|
|
22024
|
+
FIGURAS2.map((f) => [
|
|
21708
22025
|
`figura.${f.valor}`,
|
|
21709
22026
|
{
|
|
21710
22027
|
nombre: f.nombre,
|
|
@@ -21873,6 +22190,19 @@ var init_paleta = __esm({
|
|
|
21873
22190
|
principiante: "Borra el nombre del acorde del golpe del cursor. Las notas no se tocan.",
|
|
21874
22191
|
profesional: "Quita el cifrado del golpe."
|
|
21875
22192
|
},
|
|
22193
|
+
// ── Sección ─────────────────────────────────────────────────────────────────
|
|
22194
|
+
"seccion.usada": {
|
|
22195
|
+
nombre: "Secci\xF3n de la obra",
|
|
22196
|
+
principiante: "Un nombre de secci\xF3n que ya usaste en esta obra, como Coro o Verso. Un clic lo pone en el comp\xE1s del cursor. Para uno nuevo, escribe en el campo.",
|
|
22197
|
+
profesional: "Reutiliza un r\xF3tulo de secci\xF3n de la obra."
|
|
22198
|
+
},
|
|
22199
|
+
// ── El teclado en las paletas (2026-11-11) ──────────────────────────────────
|
|
22200
|
+
"paleta.busqueda": {
|
|
22201
|
+
nombre: "Buscar en las paletas",
|
|
22202
|
+
accion: "comando-buscar-en-paletas",
|
|
22203
|
+
principiante: "Escribe el nombre de lo que quieres poner \u2014acento, martillo, corchea, ff\u2014 y busca en las siete paletas a la vez. Acepta otros nombres, como hammer o fermata. Cada resultado dice en qu\xE9 paleta est\xE1 y su tecla, para que la pr\xF3xima vez vayas directo. Las flechas eligen, Intro lo pone y Esc cierra.",
|
|
22204
|
+
profesional: "B\xFAsqueda en todas las paletas, con sin\xF3nimos y la tecla de cada resultado."
|
|
22205
|
+
},
|
|
21876
22206
|
// ── Batería ─────────────────────────────────────────────────────────────────
|
|
21877
22207
|
"kit.pieza": {
|
|
21878
22208
|
nombre: "Pieza de la bater\xEDa",
|
|
@@ -22240,6 +22570,21 @@ var init_paneles = __esm({
|
|
|
22240
22570
|
principiante: "Pone una armadura nueva desde el comp\xE1s que empieza en esta l\xEDnea, hasta el pr\xF3ximo cambio.",
|
|
22241
22571
|
profesional: "Cambio de armadura desde este comp\xE1s."
|
|
22242
22572
|
},
|
|
22573
|
+
"linea.repeticion": {
|
|
22574
|
+
nombre: "Repetici\xF3n",
|
|
22575
|
+
principiante: "Pone las barras de repetici\xF3n en el comp\xE1s que empieza en esta l\xEDnea. Si ese comp\xE1s est\xE1 dentro de un pasaje marcado, las pone en todo el pasaje.",
|
|
22576
|
+
profesional: "Barras de repetici\xF3n aqu\xED o en el pasaje."
|
|
22577
|
+
},
|
|
22578
|
+
"linea.casillas": {
|
|
22579
|
+
nombre: "Casillas",
|
|
22580
|
+
principiante: "Pone una casilla 1.\xAA, 2.\xAA\u2026 en el comp\xE1s que empieza en esta l\xEDnea, o en todo el pasaje marcado si est\xE1 adentro.",
|
|
22581
|
+
profesional: "Casillas aqu\xED o en el pasaje."
|
|
22582
|
+
},
|
|
22583
|
+
"linea.saltos": {
|
|
22584
|
+
nombre: "D.C., D.S. y Coda",
|
|
22585
|
+
principiante: "Pone un salto o un destino \u2014Segno, Coda, Fine, D.S. al Coda\u2014 en el comp\xE1s que empieza en esta l\xEDnea.",
|
|
22586
|
+
profesional: "Saltos y destinos de este comp\xE1s."
|
|
22587
|
+
},
|
|
22243
22588
|
"linea.insertar-izquierda": {
|
|
22244
22589
|
nombre: "Insertar comp\xE1s a la izquierda",
|
|
22245
22590
|
principiante: "Mete un comp\xE1s vac\xEDo ANTES del comp\xE1s que empieza en esta l\xEDnea. Sirve tambi\xE9n para agregar uno al principio de la obra.",
|
|
@@ -22464,6 +22809,37 @@ var init_dialogos = __esm({
|
|
|
22464
22809
|
principiante: "Escribe c\xF3mo se llama la parte \u2014Intro, Coro, Puente\u2014. Vac\xEDo, saca la secci\xF3n que hab\xEDa.",
|
|
22465
22810
|
profesional: "Texto de la secci\xF3n; vac\xEDo la quita."
|
|
22466
22811
|
},
|
|
22812
|
+
// ── Repeticiones, casillas y saltos (2026-11-11) ────────────────────────────
|
|
22813
|
+
"repeticion.abre": {
|
|
22814
|
+
nombre: "Barra de inicio",
|
|
22815
|
+
principiante: "La barra con dos puntos que marca d\xF3nde empieza lo que se repite. Desm\xE1rcala para quitarla.",
|
|
22816
|
+
profesional: "Barra de inicio de repetici\xF3n."
|
|
22817
|
+
},
|
|
22818
|
+
"repeticion.cierra": {
|
|
22819
|
+
nombre: "Barra de fin",
|
|
22820
|
+
principiante: "La barra con dos puntos donde la m\xFAsica vuelve al inicio de la repetici\xF3n. Desm\xE1rcala para quitarla.",
|
|
22821
|
+
profesional: "Barra de fin de repetici\xF3n."
|
|
22822
|
+
},
|
|
22823
|
+
"repeticion.veces": {
|
|
22824
|
+
nombre: "Veces",
|
|
22825
|
+
principiante: "Cu\xE1ntas veces se toca el pasaje en total, contando la primera. 2 es lo normal y no se escribe en el pliego; desde 3 aparece \xABx3\xBB.",
|
|
22826
|
+
profesional: "Pasadas totales (2\u201364)."
|
|
22827
|
+
},
|
|
22828
|
+
"casillas.vuelta": {
|
|
22829
|
+
nombre: "Vuelta",
|
|
22830
|
+
principiante: "En qu\xE9 vuelta de la repetici\xF3n se toca este comp\xE1s. Puedes marcar m\xE1s de una, como \xAB1. 2.\xBB. Sin ninguna marcada, se quita la casilla.",
|
|
22831
|
+
profesional: "Vueltas en que suena; ninguna la quita."
|
|
22832
|
+
},
|
|
22833
|
+
"saltos.destino": {
|
|
22834
|
+
nombre: "Destino",
|
|
22835
|
+
principiante: "Un lugar al que otro comp\xE1s salta: el Segno para un D.S., la Coda para un \xABal Coda\xBB, el Fine para un \xABal Fine\xBB.",
|
|
22836
|
+
profesional: "Marca de destino (Segno, Coda, Fine)."
|
|
22837
|
+
},
|
|
22838
|
+
"saltos.salto": {
|
|
22839
|
+
nombre: "Salto",
|
|
22840
|
+
principiante: "Manda la m\xFAsica a otro lugar al terminar el comp\xE1s. D.C. vuelve al principio y D.S. al Segno. To Coda marca d\xF3nde se salta a la Coda en la segunda pasada.",
|
|
22841
|
+
profesional: "Salto (D.C., D.S., To Coda\u2026)."
|
|
22842
|
+
},
|
|
22467
22843
|
"golpe.letra": {
|
|
22468
22844
|
nombre: "S\xEDlaba",
|
|
22469
22845
|
principiante: "La s\xEDlaba de la letra que se canta en este golpe. Vac\xEDa, saca la que hab\xEDa.",
|
|
@@ -22637,6 +23013,11 @@ var init_aspecto2 = __esm({
|
|
|
22637
23013
|
principiante: "Marcado, la partitura muestra al principio la afinaci\xF3n de cada cuerda.",
|
|
22638
23014
|
profesional: "Afinaci\xF3n en el pliego."
|
|
22639
23015
|
},
|
|
23016
|
+
"aspecto.diagramas": {
|
|
23017
|
+
nombre: "Diagramas de acordes",
|
|
23018
|
+
principiante: "Adem\xE1s del nombre (Am, G7\u2026), un cuadrito con los trastes de cada acorde: sobre la partitura o en una lista al comienzo. Salen de las notas que escribiste; si un nombre no est\xE1 escrito con notas en ning\xFAn lado, queda solo el nombre. De f\xE1brica, apagado.",
|
|
23019
|
+
profesional: "Chord diagrams: en la partitura o arriba. Forma tomada de lo escrito."
|
|
23020
|
+
},
|
|
22640
23021
|
"aspecto.restablecer": {
|
|
22641
23022
|
nombre: "Restablecer",
|
|
22642
23023
|
principiante: "Devuelve esta secci\xF3n a como ven\xEDa de f\xE1brica. Las dem\xE1s secciones no se tocan.",
|
|
@@ -22999,6 +23380,7 @@ var init_src3 = __esm({
|
|
|
22999
23380
|
init_silabas();
|
|
23000
23381
|
init_acordes();
|
|
23001
23382
|
init_miraDeAcordes();
|
|
23383
|
+
init_paletasConTeclado();
|
|
23002
23384
|
init_alinearLetra();
|
|
23003
23385
|
init_diapason();
|
|
23004
23386
|
init_video();
|
|
@@ -23080,7 +23462,7 @@ function _usingCtx() {
|
|
|
23080
23462
|
}
|
|
23081
23463
|
};
|
|
23082
23464
|
}
|
|
23083
|
-
var __defProp2, __exportAll, ResizeObserverPolyfill, IntersectionObserverPolyfill, AlphaTabErrorType, AlphaTabError, VersionInfo, DynamicValue, MidiUtils, AutomationType, SyncPointData, Automation, BendPoint, BendStyle, BendType, BrushType, CrescendoType, Duration, GraceType, AccentuationType, Fingers, HarmonicType, NoteAccidentalMode, Ottavia, SlideInType, SlideOutType, Slur, SlurSegmentKind, VibratoType, TabRhythmMode, FingeringMode, NotationMode, NotationElement, NotationSettings, Lazy, LogLevel, ConsoleLogger, Logger, AccidentalType, Clef, SimileMark, ElementStyle, KeySignature, KeySignatureType, SustainPedalMarkerType, SustainPedalMarker, BarSubElement, BarStyle, BarLineStyle, Bar, TripletFeel, BeamingRules, MasterBar, BracketExtendMode, TrackNamePolicy, TrackNameMode, TrackNameOrientation, BarNumberDisplay, RenderStylesheet, RepeatGroup, GraceGroup, VoiceSubElement, VoiceStyle, Voice$1, TextAlign, TextBaseline, MeasuredText, CanvasHelper, ScoreSubElement, HeaderFooterStyle, ScoreStyle, Score, SynthConstants, TuningParseResult, TuningParseResultTone, ModelUtils, PickStroke, MusicFontSymbol, MusicFontSymbolLookup, TechniqueSymbolPlacement, InstrumentArticulation, PercussionMapper, NoteOrnament, NoteIdBag, NoteSubElement, NoteStyle, Note3, TupletGroup, WhammyType, GolpeType, FadeType, WahPedal, BarreShape, Rasgueado, TremoloPickingStyle, TremoloPickingEffect, BeatBeamingMode, BeatSubElement, BeatStyle, Beat, BendPointCloner, NoteCloner, SyncPointDataCloner, AutomationCloner, TremoloPickingEffectCloner, BeatCloner, AlphaTex1EnumMappings, AlphaTex1LanguageDefinitions, AlphaTexNodeType, AlphaTexDiagnosticsSeverity, AlphaTexDiagnosticCode, AlphaTexDiagnosticBag, AlphaTexAccidentalMode, AlphaTexVoiceMode, AlphaTexStaffNoteKind, ArgumentListParseTypesMode, TypeConversions, IOHelper, AlphaTexLexer, AlphaTexParseMode, AlphaTexParser, Atnf, AlphaTex1MetaDataReader, ApplyNodeResult, ApplyStructuralMetaDataResult, GeneralMidi, Chord3, FormatError, Color, FermataType, Fermata, Lyrics, Section, Tuning, Staff, PlaybackInformation, TrackSubElement, TrackStyle, Track, BeamDirection, AlphaTex1LanguageHandler, EndOfReaderError, OverflowError, ThrowingReadable, ScoreImporter, UnsupportedFormatError, ByteBuffer, AlphaTexErrorWithDiagnostics, AlphaTexImportState, AlphaTexImporter, Huffman$1, Found, NeedBit, NeedBits, HuffTools, InflateWindow, Inflate, ZipEntry, ZipReader, XmlNodeType, XmlNode, XmlError, XmlParser, XmlWriter, XmlDocument, DrawObject, TextDrawObject, GuitarDrawObject, SlurDrawObject, WavyLineDrawObject, TupletBracketDrawObject, WedgeDrawObject, VoltaDrawObject, OctaveClefDrawObject, TrillDrawObject, StaffLayout, Bracket, CapellaVoiceState, CapellaParser, CapellaImporter, Direction, Gp3To5Importer, GpBinaryHelpers, MixTableChange, Bounds, BinaryStylesheet, BackingTrack, GpifRhythm, GpifSound, GpifParser, PartConfigurationScoreView, PartConfigurationTrackViewGroup, PartConfiguration, LayoutConfigurationScoreView, LayoutConfigurationTrackViewGroup, LayoutConfiguration, Gp7To8Importer, BitReader, GpxFile, GpxFileSystem, GpxImporter, BeatSteps, AccidentalHelper, StaffContext, InstrumentArticulationWithPlaybackInfo, TrackInfo, MusicXmlImporter, LayoutMode, EventEmitter, EventEmitterOfT, AlphaSynthWebAudioSynthOutputDevice, WebAudioHelper, AlphaSynthWebAudioOutputBase, FileLoadError, EngravingSettingsCloner, JsonHelper, EngravingStemInfo, EngravingSettings, FontParserToken, FontParser, FontStyle, FontWeight, Font, RenderingResources, StaveProfile, SystemsLayoutMode, DisplaySettings, ImporterSettings, ScrollMode, VibratoPlaybackSettings, SlidePlaybackSettings, PlayerOutputMode, PlayerMode, PlayerSettings, CoreSettingsSerializer, EngravingStemInfoSerializer, EngravingSettingsSerializer, RenderingResourcesSerializer, DisplaySettingsSerializer, NotationSettingsSerializer, ImporterSettingsSerializer, VibratoPlaybackSettingsSerializer, SlidePlaybackSettingsSerializer, PlayerSettingsSerializer, ExporterSettingsSerializer, SettingsSerializer, ExporterSettings, Settings, ScoreLoader, BrowserMouseEventArgs, HtmlElementContainer, WebPlatform, FontSizeDefinition, FontSizes, FontLoadingChecker, CircularSampleBuffer, AlphaSynthScriptProcessorOutput, BeamingRulesSerializer, SectionSerializer, SyncPointDataSerializer, AutomationSerializer, FermataSerializer, MasterBarSerializer, BendPointSerializer, NoteStyleSerializer, NoteSerializer, TremoloPickingEffectSerializer, BeatStyleSerializer, BeatSerializer, VoiceStyleSerializer, VoiceSerializer, SustainPedalMarkerSerializer, BarStyleSerializer, BarSerializer, ChordSerializer, TuningSerializer, StaffSerializer, PlaybackInformationSerializer, InstrumentArticulationSerializer, TrackStyleSerializer, TrackSerializer, RenderStylesheetSerializer, BackingTrackSerializer, HeaderFooterStyleSerializer, ScoreStyleSerializer, ScoreSerializer, MidiFileFormat, MidiTrack, MidiFile, MidiEventType, MidiEvent, TimeSignatureEvent, AlphaTabSysExEvent, AlphaTabMetronomeEvent, AlphaTabRestEvent, NoteEvent, NoteOnEvent, NoteOffEvent, ControlChangeEvent, ProgramChangeEvent, TempoChangeEvent, PitchBendEvent, NoteBendEvent, EndOfTrackEvent, JsonConverter, MidiEventsPlayedEventArgs, PlaybackRangeChangedEventArgs, PlayerState, PlayerStateChangedEventArgs, PositionChangedEventArgs, AlphaSynthWebWorkerApi, BarBounds, BeatBounds, MasterBarBounds, NoteBounds, StaffSystemBounds, BoundsLookup, AlphaTabWorkerScoreRenderer, Cursors, ScalableHtmlElementContainer, AudioElementBackingTrackSynthOutput, QueueItem, Queue, AudioExportOptions, AudioExportChunk, SynthEvent, BackingTrackSyncPoint, MidiFileSequencerTempoChange, MidiSequencerState, MidiFileSequencer, RiffChunk, OggPacket, OggReader, VorbisStream, IntBitReaderReadResult, IntBitReader, VorbisSetupHeader, VorbisUtils, FastListArray, FastRange, VorbisCodebook, HuffmanListNode, Huffman, VorbisTimeDomainTransform, VorbisFloorData0, VorbisFloor0, VorbisFloor1Data, VorbisFloor1, VorbisFloor, VorbisResidue0, VorbisResidue1, VorbisResidue2, VorbisResidue, VorbisMapping, VorbisModeOverlapInfo, VorbisModePacketInfo, VorbisReadNextPacketResult, VorbisMode, MdctImpl, Mdct, VorbisStreamDecoder, DecodeNextPacketInfo, VorbisStreamReader, VorbisFile, Hydra, HydraIbag, HydraImod, HydraIgen, HydraInst, HydraPbag, HydraPgen, HydraPhdr, HydraPmod, HydraShdr, HydraGenAmount, Channel, Channels, LoopMode, OutputMode, Preset, SynthHelper, Envelope, Region, VoiceEnvelopeSegment, VoiceEnvelope, VoiceLfo, VoiceLowPass, Voice, ControllerType, TinySoundFont, AlphaSynthBase, AlphaSynth, AlphaSynthAudioExporter, BackingTrackAudioSynthesizer, BackingTrackPlayer, AlphaSynthAudioExporterWorkerApi, RenderFinishedEventArgs, ScoreRenderer, BrowserUiFacade, AlphaSynthWebWorklet, AlphaSynthAudioWorkletOutput, Html5Canvas, AlphaSynthMidiFileHandler, Repeat, MidiPlaybackController, BeatTickLookupItem, BeatTickLookup, MasterBarTickLookupTempoChange, MasterBarTickLookup, PlaybackRange, MidiTickLookupFindBeatResultCursorMode, MidiTickLookupFindBeatResult, TrackLookupBeatVisibilityChecker, MidiTickLookup, MidiNoteDuration, TripletFeelDurations, RasgueadoInfo, PlayThroughContext, MidiFileGenerator, ToNextBeatAnimatingCursorHandler, NonAnimatingCursorHandler, BeatXPosition, Glyph, BeatContainerGlyphBase, BeatContainerGlyph, ScoreRendererWrapper, ResizeEventArgs, BasicScrollHandler, VerticalContinuousScrollHandler, VerticalOffScreenScrollHandler, VerticalSmoothScrollHandler, HorizontalContinuousScrollHandler, HorizontalOffScreenScrollHandler, HorizontalSmoothScrollHandler, ActiveBeatsChangedEventArgs, AlphaSynthWrapper, ExternalMediaSynthOutput, ExternalMediaPlayer, BoundsLookupVisibilityChecker, AlphaTabApiBase, ProgressEventArgs, AlphaTabApi, JQueryAlphaTab, SkiaCanvas, SvgCanvas, CssFontSvgCanvas, AlphaSynthWorkerSynthOutput, AlphaSynthWebWorker, AlphaTabWebWorker, EffectBandMode, BarRendererFactory, EffectBarGlyphSizing, EffectGlyph, AlternateEndingsGlyph, EffectInfo, AlternateEndingsEffectInfo, GroupedEffectGlyph, LineRangedGlyph, BeatBarreEffectInfo, BeatTimerGlyph, BeatTimerEffectInfo, TextGlyph, CapoEffectInfo, ChordDiagramGlyph, ChordsEffectInfo, CrescendoGlyph, CrescendoEffectInfo, TargetDirectionGlyph, JumpDirectionGlyph, DirectionsContainerGlyph, DirectionsEffectInfo, MusicFontGlyph, MusicFontTextGlyph, DynamicsGlyph, DynamicsEffectInfo, FadeGlyph, FadeEffectInfo, FermataGlyph, FermataEffectInfo, GlyphGroup, ElementStyleHelper, ElementStyleScope, FingeringInfo, FingeringGroupGlyph, FingeringEffectInfo, FreeTimeEffectInfo, GuitarGolpeGlyph, GolpeEffectInfo, NoteEffectInfoBase, HarmonicsEffectInfo, LeftHandTapGlyph, LeftHandTapEffectInfo, LetRingEffectInfo, LyricsGlyph, LyricsEffectInfo, MarkerEffectInfo, NoteOrnamentGlyph, NoteOrnamentEffectInfo, AccidentalGlyph, NumberedKeySignatureGlyph, NumberedBarKeySignatureEffectInfo, OttavaGlyph, OttaviaEffectInfo, PalmMuteEffectInfo, PickSlideEffectInfo, PickStrokeGlyph, PickStrokeEffectInfo, RasgueadoEffectInfo, EffectBand, EffectBandSlotShared, EffectBandSlot, EffectBandSizingInfo, EffectBandContainer, LeftToRightLayoutingGlyphGroup, MultiVoiceContainerGlyph, TieGlyph, NoteTieGlyph, ContinuationTieGlyph, NumberGlyph, MultiBarRestGlyph, MultiBarRestBeatContainerGlyph, BeamingHelperDrawInfo, BeamingHelper, ReservedLayoutAreaSlot, ReservedLayoutArea, BarCollisionHelper, BeamingRuleLookup, BarHelpers, NoteYPosition, NoteXPosition, BarRendererBase, VibratoGlyphBase, NoteVibratoGlyph, TabBendRenderPoint, TabBendGlyph, TabWhammyBarGlyph, SimpleDipWhammyBarEffectInfo, BeatVibratoGlyph, SlightBeatVibratoEffectInfo, SlightNoteVibratoEffectInfo, SustainPedalGlyph, SustainPedalEffectInfo, TabWhammyEffectInfo, TapEffectInfo, BarTempoGlyph, TempoEffectInfo, TextEffectInfo, TrillGlyph, TrillEffectInfo, TripletFeelGlyph, TripletFeelEffectInfo, WahPedalGlyph, WahPedalEffectInfo, WhammyBarEffectInfo, WideBeatVibratoEffectInfo, WideNoteVibratoEffectInfo, RowGlyphContainer, RowContainerGlyph, ChordDiagramContainerGlyph, TuningContainerGlyph, TuningGlyph, SlurRegistry, RenderStaff, Spring, BarLayoutingInfo, MasterBarsRenderers, StaffTrackGroup, SystemBracket, SingleTrackSystemBracket, SimilarInstrumentSystemBracket, StaffSystem, ScoreLayout, HorizontalScreenLayoutPartialInfo, HorizontalScreenLayout, VerticalLayoutBase, PageViewLayout, ParchmentLayout, BarLineGlyphBase, BarLineLightGlyph, BarLineDottedGlyph, BarLineDashedGlyph, BarLineHeavyGlyph, BarLineRepeatDotsGlyph, BarLineShortGlyph, BarLineTickGlyph, BarLineGlyph, BarNumberGlyph, NumberedTieGlyph, AccidentalColumnInfo, AccidentalGroupGlyph, AugmentationDotGlyph, BeatGlyphBase, BeatOnNoteGlyphBase, DeadSlappedBeatGlyph, NumberedNoteHeadGlyph, SpacingGlyph, NumberedBeatPreNotesGlyph, NumberedBeatGlyph, TabTieGlyph, TieGlyphLabels, TabSlurGlyph, NumberedSlurGlyph, NumberedBeatContainerGlyph, NumberedNoteBeatContainerGlyphBase, NumberedDashBeatContainerGlyph, GhostParenthesisGlyph, TimeSignatureGlyph, ScoreTimeSignatureGlyph, FlagGlyph, RepeatCountGlyph, LineBarRenderer, NumberedBarRenderer, NumberedBarRendererFactory, ClefGlyph, KeySignatureGlyph, AccentuationGlyph, ArticStaccatoAboveGlyph, NoteHeadGlyphBase, NoteHeadGlyph, DeadNoteHeadGlyph, DiamondNoteHeadGlyph, GhostNoteInfo, GhostNoteContainerGlyph, PercussionNoteHeadGlyph, PictEdgeOfCymbalGlyph, ScoreChordNoteHeadInfo, ScoreNoteChordGlyphBase, TremoloPickingGlyph, ScoreNoteChordGlyph, ScoreRestGlyph, BendNoteHeadGroupGlyph, ScoreHelperNotesBaseGlyph, ScoreWhammyBarGlyph, SlashNoteHeadGlyph, StringNumberContainerGlyph, ScoreBeatGlyph, ScoreBrushGlyph, ScoreBeatPreNotesGlyph, ScoreBendGlyph, ScoreLegatoGlyph, ScoreSlideLineGlyph, ScoreTieGlyph, ScoreSlurGlyph, ScoreBeatContainerGlyph, ScoreBarRenderer, ScoreBarRendererFactory, SlashRestGlyph, SlashBeatGlyph, SlashTieGlyph, SlashBeatContainerGlyph, SlashBarRenderer, SlashBarRendererFactory, NoteNumberGlyph, TabNoteChordGlyph, TabRestGlyph, TabBeatGlyph, TabBrushGlyph, TabBeatPreNotesGlyph, TabSlideLineGlyph, TabBeatContainerGlyph, TabClefGlyph, TabTimeSignatureGlyph, TabBarRenderer, TabBarRendererFactory, LayoutEngineFactory, RenderEngineFactory, Environment, FontFileFormat, CoreSettings, _barrel_exports$8, _barrel_exports$1, ScoreExporter, AlphaTexWriter, AlphaTexPrinter, AlphaTexExporter, GpifMidiProgramInfo, GpifInstrumentSet, GpifInstrumentElement, GpifInstrumentArticulation, GpifSoundMapper, GpifWriter, Crc32, DeflaterConstants, Tree, DeflaterHuffman, DeflaterEngine, PendingBuffer, Deflater, ZipCentralDirectoryHeader, ZipWriter, Gp7Exporter, _barrel_exports, DeprecatedMidiEvent, MetaEventType, MetaEvent, MetaDataEvent, MetaNumberEvent, Midi20PerNotePitchBendEvent, SystemCommonType, SystemCommonEvent, AlphaTabSystemExclusiveEvents, SystemExclusiveEvent, _barrel_exports$3, _barrel_exports$4;
|
|
23465
|
+
var __defProp2, __exportAll, ResizeObserverPolyfill, IntersectionObserverPolyfill, AlphaTabErrorType, AlphaTabError, VersionInfo, DynamicValue, MidiUtils, AutomationType, SyncPointData, Automation, BendPoint, BendStyle, BendType, BrushType, CrescendoType, Duration, GraceType, AccentuationType, Fingers, HarmonicType, NoteAccidentalMode, Ottavia, SlideInType, SlideOutType, Slur, SlurSegmentKind, VibratoType, TabRhythmMode, FingeringMode, NotationMode, NotationElement, NotationSettings, Lazy, LogLevel, ConsoleLogger, Logger, AccidentalType, Clef, SimileMark, ElementStyle, KeySignature, KeySignatureType, SustainPedalMarkerType, SustainPedalMarker, BarSubElement, BarStyle, BarLineStyle, Bar, TripletFeel, BeamingRules, MasterBar, BracketExtendMode, TrackNamePolicy, TrackNameMode, TrackNameOrientation, BarNumberDisplay, RenderStylesheet, RepeatGroup, GraceGroup, VoiceSubElement, VoiceStyle, Voice$1, TextAlign, TextBaseline, MeasuredText, CanvasHelper, ScoreSubElement, HeaderFooterStyle, ScoreStyle, Score, SynthConstants, TuningParseResult, TuningParseResultTone, ModelUtils, PickStroke, MusicFontSymbol, MusicFontSymbolLookup, TechniqueSymbolPlacement, InstrumentArticulation, PercussionMapper, NoteOrnament, NoteIdBag, NoteSubElement, NoteStyle, Note3, TupletGroup, WhammyType, GolpeType, FadeType, WahPedal, BarreShape, Rasgueado, TremoloPickingStyle, TremoloPickingEffect, BeatBeamingMode, BeatSubElement, BeatStyle, Beat, BendPointCloner, NoteCloner, SyncPointDataCloner, AutomationCloner, TremoloPickingEffectCloner, BeatCloner, AlphaTex1EnumMappings, AlphaTex1LanguageDefinitions, AlphaTexNodeType, AlphaTexDiagnosticsSeverity, AlphaTexDiagnosticCode, AlphaTexDiagnosticBag, AlphaTexAccidentalMode, AlphaTexVoiceMode, AlphaTexStaffNoteKind, ArgumentListParseTypesMode, TypeConversions, IOHelper, AlphaTexLexer, AlphaTexParseMode, AlphaTexParser, Atnf, AlphaTex1MetaDataReader, ApplyNodeResult, ApplyStructuralMetaDataResult, GeneralMidi, Chord3, FormatError, Color, FermataType, Fermata, Lyrics, Section, Tuning, Staff, PlaybackInformation, TrackSubElement, TrackStyle, Track, BeamDirection, AlphaTex1LanguageHandler, EndOfReaderError, OverflowError, ThrowingReadable, ScoreImporter, UnsupportedFormatError, ByteBuffer, AlphaTexErrorWithDiagnostics, AlphaTexImportState, AlphaTexImporter, Huffman$1, Found, NeedBit, NeedBits, HuffTools, InflateWindow, Inflate, ZipEntry, ZipReader, XmlNodeType, XmlNode, XmlError, XmlParser, XmlWriter, XmlDocument, DrawObject, TextDrawObject, GuitarDrawObject, SlurDrawObject, WavyLineDrawObject, TupletBracketDrawObject, WedgeDrawObject, VoltaDrawObject, OctaveClefDrawObject, TrillDrawObject, StaffLayout, Bracket, CapellaVoiceState, CapellaParser, CapellaImporter, Direction, Gp3To5Importer, GpBinaryHelpers, MixTableChange, Bounds, BinaryStylesheet, BackingTrack, GpifRhythm, GpifSound, GpifParser, PartConfigurationScoreView, PartConfigurationTrackViewGroup, PartConfiguration, LayoutConfigurationScoreView, LayoutConfigurationTrackViewGroup, LayoutConfiguration, Gp7To8Importer, BitReader, GpxFile, GpxFileSystem, GpxImporter, BeatSteps, AccidentalHelper, StaffContext, InstrumentArticulationWithPlaybackInfo, TrackInfo, MusicXmlImporter, LayoutMode, EventEmitter, EventEmitterOfT, AlphaSynthWebAudioSynthOutputDevice, WebAudioHelper, AlphaSynthWebAudioOutputBase, FileLoadError, EngravingSettingsCloner, JsonHelper, EngravingStemInfo, EngravingSettings, FontParserToken, FontParser, FontStyle, FontWeight, Font, RenderingResources, StaveProfile, SystemsLayoutMode, DisplaySettings, ImporterSettings, ScrollMode, VibratoPlaybackSettings, SlidePlaybackSettings, PlayerOutputMode, PlayerMode, PlayerSettings, CoreSettingsSerializer, EngravingStemInfoSerializer, EngravingSettingsSerializer, RenderingResourcesSerializer, DisplaySettingsSerializer, NotationSettingsSerializer, ImporterSettingsSerializer, VibratoPlaybackSettingsSerializer, SlidePlaybackSettingsSerializer, PlayerSettingsSerializer, ExporterSettingsSerializer, SettingsSerializer, ExporterSettings, Settings, ScoreLoader, BrowserMouseEventArgs, HtmlElementContainer, WebPlatform, FontSizeDefinition, FontSizes, FontLoadingChecker, CircularSampleBuffer, AlphaSynthScriptProcessorOutput, BeamingRulesSerializer, SectionSerializer, SyncPointDataSerializer, AutomationSerializer, FermataSerializer, MasterBarSerializer, BendPointSerializer, NoteStyleSerializer, NoteSerializer, TremoloPickingEffectSerializer, BeatStyleSerializer, BeatSerializer, VoiceStyleSerializer, VoiceSerializer, SustainPedalMarkerSerializer, BarStyleSerializer, BarSerializer, ChordSerializer, TuningSerializer, StaffSerializer, PlaybackInformationSerializer, InstrumentArticulationSerializer, TrackStyleSerializer, TrackSerializer, RenderStylesheetSerializer, BackingTrackSerializer, HeaderFooterStyleSerializer, ScoreStyleSerializer, ScoreSerializer, MidiFileFormat, MidiTrack, MidiFile, MidiEventType, MidiEvent, TimeSignatureEvent, AlphaTabSysExEvent, AlphaTabMetronomeEvent, AlphaTabRestEvent, NoteEvent, NoteOnEvent, NoteOffEvent, ControlChangeEvent, ProgramChangeEvent, TempoChangeEvent, PitchBendEvent, NoteBendEvent, EndOfTrackEvent, JsonConverter, MidiEventsPlayedEventArgs, PlaybackRangeChangedEventArgs, PlayerState, PlayerStateChangedEventArgs, PositionChangedEventArgs, AlphaSynthWebWorkerApi, BarBounds, BeatBounds, MasterBarBounds, NoteBounds, StaffSystemBounds, BoundsLookup, AlphaTabWorkerScoreRenderer, Cursors, ScalableHtmlElementContainer, AudioElementBackingTrackSynthOutput, QueueItem, Queue, AudioExportOptions, AudioExportChunk, SynthEvent, BackingTrackSyncPoint, MidiFileSequencerTempoChange, MidiSequencerState, MidiFileSequencer, RiffChunk, OggPacket, OggReader, VorbisStream, IntBitReaderReadResult, IntBitReader, VorbisSetupHeader, VorbisUtils, FastListArray, FastRange, VorbisCodebook, HuffmanListNode, Huffman, VorbisTimeDomainTransform, VorbisFloorData0, VorbisFloor0, VorbisFloor1Data, VorbisFloor1, VorbisFloor, VorbisResidue0, VorbisResidue1, VorbisResidue2, VorbisResidue, VorbisMapping, VorbisModeOverlapInfo, VorbisModePacketInfo, VorbisReadNextPacketResult, VorbisMode, MdctImpl, Mdct, VorbisStreamDecoder, DecodeNextPacketInfo, VorbisStreamReader, VorbisFile, Hydra, HydraIbag, HydraImod, HydraIgen, HydraInst, HydraPbag, HydraPgen, HydraPhdr, HydraPmod, HydraShdr, HydraGenAmount, Channel, Channels, LoopMode, OutputMode, Preset, SynthHelper, Envelope, Region, VoiceEnvelopeSegment, VoiceEnvelope, VoiceLfo, VoiceLowPass, Voice, ControllerType, TinySoundFont, AlphaSynthBase, AlphaSynth, AlphaSynthAudioExporter, BackingTrackAudioSynthesizer, BackingTrackPlayer, AlphaSynthAudioExporterWorkerApi, RenderFinishedEventArgs, ScoreRenderer, BrowserUiFacade, AlphaSynthWebWorklet, AlphaSynthAudioWorkletOutput, Html5Canvas, AlphaSynthMidiFileHandler, Repeat, MidiPlaybackController, BeatTickLookupItem, BeatTickLookup, MasterBarTickLookupTempoChange, MasterBarTickLookup, PlaybackRange, MidiTickLookupFindBeatResultCursorMode, MidiTickLookupFindBeatResult, TrackLookupBeatVisibilityChecker, MidiTickLookup, MidiNoteDuration, TripletFeelDurations, RasgueadoInfo, PlayThroughContext, MidiFileGenerator, ToNextBeatAnimatingCursorHandler, NonAnimatingCursorHandler, BeatXPosition, Glyph, BeatContainerGlyphBase, BeatContainerGlyph, ScoreRendererWrapper, ResizeEventArgs, BasicScrollHandler, VerticalContinuousScrollHandler, VerticalOffScreenScrollHandler, VerticalSmoothScrollHandler, HorizontalContinuousScrollHandler, HorizontalOffScreenScrollHandler, HorizontalSmoothScrollHandler, ActiveBeatsChangedEventArgs, AlphaSynthWrapper, ExternalMediaSynthOutput, ExternalMediaPlayer, BoundsLookupVisibilityChecker, AlphaTabApiBase, ProgressEventArgs, AlphaTabApi, JQueryAlphaTab, SkiaCanvas, SvgCanvas, CssFontSvgCanvas, AlphaSynthWorkerSynthOutput, AlphaSynthWebWorker, AlphaTabWebWorker, EffectBandMode, BarRendererFactory, EffectBarGlyphSizing, EffectGlyph, AlternateEndingsGlyph, EffectInfo, AlternateEndingsEffectInfo, GroupedEffectGlyph, LineRangedGlyph, BeatBarreEffectInfo, BeatTimerGlyph, BeatTimerEffectInfo, TextGlyph, CapoEffectInfo, ChordDiagramGlyph, ChordsEffectInfo, CrescendoGlyph, CrescendoEffectInfo, TargetDirectionGlyph, JumpDirectionGlyph, DirectionsContainerGlyph, DirectionsEffectInfo, MusicFontGlyph, MusicFontTextGlyph, DynamicsGlyph, DynamicsEffectInfo, FadeGlyph, FadeEffectInfo, FermataGlyph, FermataEffectInfo, GlyphGroup, ElementStyleHelper, ElementStyleScope, FingeringInfo, FingeringGroupGlyph, FingeringEffectInfo, FreeTimeEffectInfo, GuitarGolpeGlyph, GolpeEffectInfo, NoteEffectInfoBase, HarmonicsEffectInfo, LeftHandTapGlyph, LeftHandTapEffectInfo, LetRingEffectInfo, LyricsGlyph, LyricsEffectInfo, MarkerEffectInfo, NoteOrnamentGlyph, NoteOrnamentEffectInfo, AccidentalGlyph, NumberedKeySignatureGlyph, NumberedBarKeySignatureEffectInfo, OttavaGlyph, OttaviaEffectInfo, PalmMuteEffectInfo, PickSlideEffectInfo, PickStrokeGlyph, PickStrokeEffectInfo, RasgueadoEffectInfo, EffectBand, EffectBandSlotShared, EffectBandSlot, EffectBandSizingInfo, EffectBandContainer, LeftToRightLayoutingGlyphGroup, MultiVoiceContainerGlyph, TieGlyph, NoteTieGlyph, ContinuationTieGlyph, NumberGlyph, MultiBarRestGlyph, MultiBarRestBeatContainerGlyph, BeamingHelperDrawInfo, BeamingHelper, ReservedLayoutAreaSlot, ReservedLayoutArea, BarCollisionHelper, BeamingRuleLookup, BarHelpers, NoteYPosition, NoteXPosition, BarRendererBase, VibratoGlyphBase, NoteVibratoGlyph, TabBendRenderPoint, TabBendGlyph, TabWhammyBarGlyph, SimpleDipWhammyBarEffectInfo, BeatVibratoGlyph, SlightBeatVibratoEffectInfo, SlightNoteVibratoEffectInfo, SustainPedalGlyph, SustainPedalEffectInfo, TabWhammyEffectInfo, TapEffectInfo, BarTempoGlyph, TempoEffectInfo, TextEffectInfo, TrillGlyph, TrillEffectInfo, TripletFeelGlyph, TripletFeelEffectInfo, WahPedalGlyph, WahPedalEffectInfo, WhammyBarEffectInfo, WideBeatVibratoEffectInfo, WideNoteVibratoEffectInfo, RowGlyphContainer, RowContainerGlyph, ChordDiagramContainerGlyph, TuningContainerGlyph, TuningGlyph, SlurRegistry, RenderStaff, Spring, BarLayoutingInfo, MasterBarsRenderers, StaffTrackGroup, SystemBracket, SingleTrackSystemBracket, SimilarInstrumentSystemBracket, StaffSystem, ScoreLayout, HorizontalScreenLayoutPartialInfo, HorizontalScreenLayout, VerticalLayoutBase, PageViewLayout, ParchmentLayout, BarLineGlyphBase, BarLineLightGlyph, BarLineDottedGlyph, BarLineDashedGlyph, BarLineHeavyGlyph, BarLineRepeatDotsGlyph, BarLineShortGlyph, BarLineTickGlyph, BarLineGlyph, BarNumberGlyph, NumberedTieGlyph, AccidentalColumnInfo, AccidentalGroupGlyph, AugmentationDotGlyph, BeatGlyphBase, BeatOnNoteGlyphBase, DeadSlappedBeatGlyph, NumberedNoteHeadGlyph, SpacingGlyph, NumberedBeatPreNotesGlyph, NumberedBeatGlyph, TabTieGlyph, TieGlyphLabels, TabSlurGlyph, NumberedSlurGlyph, NumberedBeatContainerGlyph, NumberedNoteBeatContainerGlyphBase, NumberedDashBeatContainerGlyph, GhostParenthesisGlyph, TimeSignatureGlyph, ScoreTimeSignatureGlyph, FlagGlyph, RepeatCountGlyph, LineBarRenderer, NumberedBarRenderer, NumberedBarRendererFactory, ClefGlyph, KeySignatureGlyph, AccentuationGlyph, ArticStaccatoAboveGlyph, NoteHeadGlyphBase, NoteHeadGlyph, DeadNoteHeadGlyph, DiamondNoteHeadGlyph, GhostNoteInfo, GhostNoteContainerGlyph, PercussionNoteHeadGlyph, PictEdgeOfCymbalGlyph, ScoreChordNoteHeadInfo, ScoreNoteChordGlyphBase, TremoloPickingGlyph, ScoreNoteChordGlyph, ScoreRestGlyph, BendNoteHeadGroupGlyph, ScoreHelperNotesBaseGlyph, ScoreWhammyBarGlyph, SlashNoteHeadGlyph, StringNumberContainerGlyph, ScoreBeatGlyph, ScoreBrushGlyph, ScoreBeatPreNotesGlyph, ScoreBendGlyph, ScoreLegatoGlyph, ScoreSlideLineGlyph, ScoreTieGlyph, ScoreSlurGlyph, ScoreBeatContainerGlyph, ScoreBarRenderer, ScoreBarRendererFactory, SlashRestGlyph, SlashBeatGlyph, SlashTieGlyph, SlashBeatContainerGlyph, SlashBarRenderer, SlashBarRendererFactory, NoteNumberGlyph, TabNoteChordGlyph, TabRestGlyph, TabBeatGlyph, TabBrushGlyph, TabBeatPreNotesGlyph, TabSlideLineGlyph, TabBeatContainerGlyph, TabClefGlyph, TabTimeSignatureGlyph, TabBarRenderer, TabBarRendererFactory, LayoutEngineFactory, RenderEngineFactory, Environment, FontFileFormat, CoreSettings, _barrel_exports$8, _barrel_exports$1, ScoreExporter, AlphaTexWriter, AlphaTexPrinter, AlphaTexExporter, GpifMidiProgramInfo, GpifInstrumentSet, GpifInstrumentElement, GpifInstrumentArticulation, GpifSoundMapper, GpifWriter, Crc32, DeflaterConstants, Tree, DeflaterHuffman, DeflaterEngine, PendingBuffer, Deflater, ZipCentralDirectoryHeader, ZipWriter, Gp7Exporter, _barrel_exports, DeprecatedMidiEvent, MetaEventType, MetaEvent, MetaDataEvent, MetaNumberEvent, Midi20PerNotePitchBendEvent, SystemCommonType, SystemCommonEvent, AlphaTabSystemExclusiveEvents, SystemExclusiveEvent, _barrel_exports$3, _barrel_exports$4, _barrel_exports$7;
|
|
23084
23466
|
var init_alphaTab_core = __esm({
|
|
23085
23467
|
"node_modules/@coderline/alphatab/dist/alphaTab.core.mjs"() {
|
|
23086
23468
|
__defProp2 = Object.defineProperty;
|
|
@@ -87539,6 +87921,25 @@ ${AlphaTex1MetaDataReader.generateSignatures(signatures)}`,
|
|
|
87539
87921
|
WahPedal: () => WahPedal,
|
|
87540
87922
|
WhammyType: () => WhammyType
|
|
87541
87923
|
});
|
|
87924
|
+
_barrel_exports$7 = /* @__PURE__ */ __exportAll({
|
|
87925
|
+
ActiveBeatsChangedEventArgs: () => ActiveBeatsChangedEventArgs,
|
|
87926
|
+
AlphaSynth: () => AlphaSynth,
|
|
87927
|
+
AlphaSynthAudioWorkletOutput: () => AlphaSynthAudioWorkletOutput,
|
|
87928
|
+
AlphaSynthBase: () => AlphaSynthBase,
|
|
87929
|
+
AlphaSynthScriptProcessorOutput: () => AlphaSynthScriptProcessorOutput,
|
|
87930
|
+
AlphaSynthWebAudioOutputBase: () => AlphaSynthWebAudioOutputBase,
|
|
87931
|
+
AlphaSynthWebWorkerApi: () => AlphaSynthWebWorkerApi,
|
|
87932
|
+
AudioExportChunk: () => AudioExportChunk,
|
|
87933
|
+
AudioExportOptions: () => AudioExportOptions,
|
|
87934
|
+
BackingTrackSyncPoint: () => BackingTrackSyncPoint,
|
|
87935
|
+
CircularSampleBuffer: () => CircularSampleBuffer,
|
|
87936
|
+
MidiEventsPlayedEventArgs: () => MidiEventsPlayedEventArgs,
|
|
87937
|
+
PlaybackRange: () => PlaybackRange,
|
|
87938
|
+
PlaybackRangeChangedEventArgs: () => PlaybackRangeChangedEventArgs,
|
|
87939
|
+
PlayerState: () => PlayerState,
|
|
87940
|
+
PlayerStateChangedEventArgs: () => PlayerStateChangedEventArgs,
|
|
87941
|
+
PositionChangedEventArgs: () => PositionChangedEventArgs
|
|
87942
|
+
});
|
|
87542
87943
|
}
|
|
87543
87944
|
});
|
|
87544
87945
|
|
|
@@ -87600,6 +88001,151 @@ var init_alphaTab = __esm({
|
|
|
87600
88001
|
}
|
|
87601
88002
|
});
|
|
87602
88003
|
|
|
88004
|
+
// packages/io/src/manosDelPiano.ts
|
|
88005
|
+
function repartirManos(notas, P = PARAMETROS_DE_MANOS) {
|
|
88006
|
+
const derecha = [];
|
|
88007
|
+
const izquierda = [];
|
|
88008
|
+
const orden = notas.map((_, i3) => i3).sort((a, b) => notas[a].ini - notas[b].ini || notas[a].altura - notas[b].altura);
|
|
88009
|
+
let centroD = P.centroDerecha;
|
|
88010
|
+
let centroI = P.centroIzquierda;
|
|
88011
|
+
let sostieneD = [];
|
|
88012
|
+
let sostieneI = [];
|
|
88013
|
+
let ultimaD = null;
|
|
88014
|
+
let ultimaI = null;
|
|
88015
|
+
let i2 = 0;
|
|
88016
|
+
while (i2 < orden.length) {
|
|
88017
|
+
const ini = notas[orden[i2]].ini;
|
|
88018
|
+
const golpe = [];
|
|
88019
|
+
while (i2 < orden.length && notas[orden[i2]].ini === ini) golpe.push(orden[i2++]);
|
|
88020
|
+
sostieneD = sostieneD.filter((j) => notas[j].fin > ini);
|
|
88021
|
+
sostieneI = sostieneI.filter((j) => notas[j].fin > ini);
|
|
88022
|
+
const techoI = sostieneI.length ? Math.max(...sostieneI.map((j) => notas[j].altura)) : -Infinity;
|
|
88023
|
+
const pisoD = sostieneD.length ? Math.min(...sostieneD.map((j) => notas[j].altura)) : Infinity;
|
|
88024
|
+
let mejor = { corte: 0, costo: Infinity, distanciaAlDo: Infinity };
|
|
88025
|
+
for (let corte = 0; corte <= golpe.length; corte++) {
|
|
88026
|
+
const abajo = golpe.slice(0, corte).map((j) => notas[j].altura);
|
|
88027
|
+
const arriba = golpe.slice(corte).map((j) => notas[j].altura);
|
|
88028
|
+
let costo = 0;
|
|
88029
|
+
for (const a of abajo) costo += Math.abs(a - centroI) + (a >= DO_CENTRAL ? P.costoLadoDelDo : 0);
|
|
88030
|
+
for (const a of arriba) costo += Math.abs(a - centroD) + (a < DO_CENTRAL ? P.costoLadoDelDo : 0);
|
|
88031
|
+
const manoI = [...abajo, ...abajo.length ? sostieneI.map((j) => notas[j].altura) : []];
|
|
88032
|
+
const manoD = [...arriba, ...arriba.length ? sostieneD.map((j) => notas[j].altura) : []];
|
|
88033
|
+
for (const mano of [manoI, manoD]) {
|
|
88034
|
+
if (mano.length < 2) continue;
|
|
88035
|
+
const abre = Math.max(...mano) - Math.min(...mano);
|
|
88036
|
+
if (abre > P.abertura) costo += P.costoAbertura + (abre - P.abertura) * 4;
|
|
88037
|
+
}
|
|
88038
|
+
for (const a of arriba) if (a < techoI) costo += P.costoCruce;
|
|
88039
|
+
for (const a of abajo) if (a > pisoD) costo += P.costoCruce;
|
|
88040
|
+
if (golpe.length === 1) {
|
|
88041
|
+
const a = notas[golpe[0]].altura;
|
|
88042
|
+
if (abajo.length && ultimaI !== null && Math.abs(a - ultimaI) <= P.continuidadCerca) costo -= P.premioContinuidad;
|
|
88043
|
+
if (arriba.length && ultimaD !== null && Math.abs(a - ultimaD) <= P.continuidadCerca) costo -= P.premioContinuidad;
|
|
88044
|
+
}
|
|
88045
|
+
const delDo = Math.abs(corte - golpe.filter((j) => notas[j].altura < DO_CENTRAL).length);
|
|
88046
|
+
if (costo < mejor.costo - 1e-9 || Math.abs(costo - mejor.costo) <= 1e-9 && delDo < mejor.distanciaAlDo)
|
|
88047
|
+
mejor = { corte, costo, distanciaAlDo: delDo };
|
|
88048
|
+
}
|
|
88049
|
+
const deI = golpe.slice(0, mejor.corte);
|
|
88050
|
+
const deD = golpe.slice(mejor.corte);
|
|
88051
|
+
izquierda.push(...deI);
|
|
88052
|
+
derecha.push(...deD);
|
|
88053
|
+
sostieneI.push(...deI);
|
|
88054
|
+
sostieneD.push(...deD);
|
|
88055
|
+
const media = (js) => js.reduce((s, j) => s + notas[j].altura, 0) / js.length;
|
|
88056
|
+
if (deI.length) {
|
|
88057
|
+
centroI = centroI * (1 - P.seguimiento) + media(deI) * P.seguimiento;
|
|
88058
|
+
ultimaI = notas[deI[deI.length - 1]].altura;
|
|
88059
|
+
} else centroI += (P.centroIzquierda - centroI) * P.regreso;
|
|
88060
|
+
if (deD.length) {
|
|
88061
|
+
centroD = centroD * (1 - P.seguimiento) + media(deD) * P.seguimiento;
|
|
88062
|
+
ultimaD = notas[deD[0]].altura;
|
|
88063
|
+
} else centroD += (P.centroDerecha - centroD) * P.regreso;
|
|
88064
|
+
}
|
|
88065
|
+
return { derecha, izquierda };
|
|
88066
|
+
}
|
|
88067
|
+
function baseDeLasManos(nombreDerecha, nombreIzquierda) {
|
|
88068
|
+
const d = DERECHA.exec(nombreDerecha.trim());
|
|
88069
|
+
const i2 = IZQUIERDA.exec(nombreIzquierda.trim());
|
|
88070
|
+
if (!d || !i2) return null;
|
|
88071
|
+
const base = (s) => s.trim().replace(/[\s\-_.:,(]+$/, "").trim();
|
|
88072
|
+
const bd = base(d[1]);
|
|
88073
|
+
const bi = base(i2[1]);
|
|
88074
|
+
if (bd.toLocaleLowerCase("es") !== bi.toLocaleLowerCase("es")) return null;
|
|
88075
|
+
return bd || "Piano";
|
|
88076
|
+
}
|
|
88077
|
+
function juntarManosDelPiano(documento) {
|
|
88078
|
+
const enOrden = documento.pistasEnOrden().map((p) => p.id);
|
|
88079
|
+
const parejas = [];
|
|
88080
|
+
for (let i2 = 0; i2 + 1 < enOrden.length; i2++) {
|
|
88081
|
+
const d = documento.pistas.get(enOrden[i2]);
|
|
88082
|
+
const iz = documento.pistas.get(enOrden[i2 + 1]);
|
|
88083
|
+
const mismoInstrumento = d.get("tipo") === "altura" && iz.get("tipo") === "altura" && (d.get("pentagramas") ?? 1) === 1 && (iz.get("pentagramas") ?? 1) === 1 && d.get("programaMidi") === iz.get("programaMidi");
|
|
88084
|
+
if (!mismoInstrumento) continue;
|
|
88085
|
+
const porNombre = baseDeLasManos(String(d.get("nombre") ?? ""), String(iz.get("nombre") ?? ""));
|
|
88086
|
+
const porCorto = baseDeLasManos(String(d.get("nombreCorto") ?? ""), String(iz.get("nombreCorto") ?? ""));
|
|
88087
|
+
const base = porNombre ?? (porCorto !== null ? String(d.get("nombre") ?? "").trim() || porCorto : null);
|
|
88088
|
+
if (!base) continue;
|
|
88089
|
+
parejas.push({ derecha: enOrden[i2], izquierda: enOrden[i2 + 1], indiceIzquierda: i2 + 1, base });
|
|
88090
|
+
i2++;
|
|
88091
|
+
}
|
|
88092
|
+
if (parejas.length === 0) return 0;
|
|
88093
|
+
documento.doc.transact(() => {
|
|
88094
|
+
for (const { derecha, izquierda, base } of parejas) {
|
|
88095
|
+
const d = documento.pistas.get(derecha);
|
|
88096
|
+
const corto = String(d.get("nombreCorto") ?? "");
|
|
88097
|
+
d.set("pentagramas", 2);
|
|
88098
|
+
d.set("nombre", base);
|
|
88099
|
+
d.set("nombreCorto", corto.replace(/[\s\-_.:,(]*(mano\s+derecha|right\s+hand|r\.?\s?h\.?|m\.?\s?d\.?|rh|md)\)?\s*$/i, "").trim() || base);
|
|
88100
|
+
for (const compas of documento.compases.values()) {
|
|
88101
|
+
if (compas.get("pistaId") !== izquierda) continue;
|
|
88102
|
+
compas.set("pistaId", derecha);
|
|
88103
|
+
compas.set("pentagrama", 1);
|
|
88104
|
+
}
|
|
88105
|
+
documento.pistas.delete(izquierda);
|
|
88106
|
+
}
|
|
88107
|
+
const sesion = documento.ajustes.get(CLAVE_DE_LA_SESION);
|
|
88108
|
+
if (sesion && typeof sesion === "object" && !Array.isArray(sesion)) {
|
|
88109
|
+
const quitadas = new Set(parejas.map((p) => p.izquierda));
|
|
88110
|
+
const nueva = { ...sesion };
|
|
88111
|
+
for (const clave of ["mezcla", "volumenEnSolo", "notacionPorPista"]) {
|
|
88112
|
+
const v = nueva[clave];
|
|
88113
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) continue;
|
|
88114
|
+
nueva[clave] = Object.fromEntries(Object.entries(v).filter(([id2]) => !quitadas.has(id2)));
|
|
88115
|
+
}
|
|
88116
|
+
if (Array.isArray(nueva.pistasConOjo)) {
|
|
88117
|
+
let lista2 = nueva.pistasConOjo.filter((n) => typeof n === "number");
|
|
88118
|
+
for (const quitado of parejas.map((p) => p.indiceIzquierda).sort((x2, y) => y - x2))
|
|
88119
|
+
lista2 = lista2.filter((n) => n !== quitado).map((n) => n > quitado ? n - 1 : n);
|
|
88120
|
+
nueva.pistasConOjo = lista2;
|
|
88121
|
+
}
|
|
88122
|
+
documento.ajustes.set(CLAVE_DE_LA_SESION, nueva);
|
|
88123
|
+
}
|
|
88124
|
+
});
|
|
88125
|
+
return parejas.length;
|
|
88126
|
+
}
|
|
88127
|
+
var DO_CENTRAL, PARAMETROS_DE_MANOS, DERECHA, IZQUIERDA;
|
|
88128
|
+
var init_manosDelPiano = __esm({
|
|
88129
|
+
"packages/io/src/manosDelPiano.ts"() {
|
|
88130
|
+
init_src2();
|
|
88131
|
+
DO_CENTRAL = 60;
|
|
88132
|
+
PARAMETROS_DE_MANOS = {
|
|
88133
|
+
centroDerecha: 72,
|
|
88134
|
+
centroIzquierda: 52,
|
|
88135
|
+
abertura: 12,
|
|
88136
|
+
costoAbertura: 20,
|
|
88137
|
+
costoCruce: 25,
|
|
88138
|
+
continuidadCerca: 7,
|
|
88139
|
+
premioContinuidad: 12,
|
|
88140
|
+
costoLadoDelDo: 1.5,
|
|
88141
|
+
seguimiento: 0.3,
|
|
88142
|
+
regreso: 0.1
|
|
88143
|
+
};
|
|
88144
|
+
DERECHA = /^(.*?)[\s\-_.:,(]*\b(mano\s+derecha|m\.?\s?d\.?|right\s+hand|r\.?\s?h\.?|rh|md|derecha|right|treble)\)?\s*$/i;
|
|
88145
|
+
IZQUIERDA = /^(.*?)[\s\-_.:,(]*\b(mano\s+izquierda|m\.?\s?i\.?|left\s+hand|l\.?\s?h\.?|lh|mi|izquierda|left|bass)\)?\s*$/i;
|
|
88146
|
+
}
|
|
88147
|
+
});
|
|
88148
|
+
|
|
87603
88149
|
// node_modules/fflate/esm/index.mjs
|
|
87604
88150
|
import { createRequire } from "module";
|
|
87605
88151
|
function deflateSync(data, opts) {
|
|
@@ -88581,280 +89127,839 @@ var init_esm = __esm({
|
|
|
88581
89127
|
}
|
|
88582
89128
|
});
|
|
88583
89129
|
|
|
88584
|
-
// packages/io/src/
|
|
88585
|
-
function
|
|
88586
|
-
|
|
88587
|
-
let archivos;
|
|
88588
|
-
try {
|
|
88589
|
-
archivos = unzipSync(bytes);
|
|
88590
|
-
} catch {
|
|
88591
|
-
return null;
|
|
88592
|
-
}
|
|
88593
|
-
const contenedor = archivos["META-INF/container.xml"];
|
|
88594
|
-
if (!contenedor) return null;
|
|
88595
|
-
const ruta = /<rootfile\b[^>]*full-path="([^"]+)"/.exec(strFromU8(contenedor))?.[1];
|
|
88596
|
-
const raiz = ruta ? archivos[ruta] : void 0;
|
|
88597
|
-
return raiz ? decodificar(raiz) : null;
|
|
88598
|
-
}
|
|
88599
|
-
const texto4 = decodificar(bytes.subarray(0, Math.min(bytes.length, 4096)));
|
|
88600
|
-
if (!/<score-(partwise|timewise)\b/.test(texto4) && !/<!DOCTYPE\s+score-/.test(texto4)) return null;
|
|
88601
|
-
return decodificar(bytes);
|
|
89130
|
+
// packages/io/src/musicxml.ts
|
|
89131
|
+
function escapar(texto4) {
|
|
89132
|
+
return texto4.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
88602
89133
|
}
|
|
88603
|
-
function
|
|
88604
|
-
if (
|
|
88605
|
-
|
|
88606
|
-
return new TextDecoder("utf-8").decode(bytes);
|
|
89134
|
+
function elemento(nombre, texto4) {
|
|
89135
|
+
if (texto4 === null || texto4 === void 0 || texto4 === "") return [];
|
|
89136
|
+
return [`<${nombre}>${escapar(String(texto4))}</${nombre}>`];
|
|
88607
89137
|
}
|
|
88608
|
-
function
|
|
88609
|
-
const
|
|
88610
|
-
|
|
88611
|
-
|
|
88612
|
-
|
|
88613
|
-
|
|
88614
|
-
const
|
|
88615
|
-
|
|
88616
|
-
const
|
|
88617
|
-
|
|
88618
|
-
const saltos = sacarSaltosDeLaIndicacion(separados.texto);
|
|
88619
|
-
saltosMovidos += saltos.cuantos;
|
|
88620
|
-
const { texto: texto4, cambio } = compactarVoces(saltos.texto);
|
|
88621
|
-
if (cambio) correcciones.push(cambio);
|
|
88622
|
-
return texto4;
|
|
88623
|
-
});
|
|
88624
|
-
if (atributosMovidos) {
|
|
88625
|
-
correcciones.push(
|
|
88626
|
-
`${atributosMovidos} cambios de clave, armadura o comp\xE1s escritos entre las notas se pusieron al principio del comp\xE1s donde rigen.`
|
|
88627
|
-
);
|
|
89138
|
+
function alturaMusicXml(midi, fifths, modo = 0) {
|
|
89139
|
+
const octavaAlphaTab = Math.floor(midi / 12);
|
|
89140
|
+
const clase = midi - octavaAlphaTab * 12;
|
|
89141
|
+
const octava = octavaAlphaTab - 1;
|
|
89142
|
+
const pedida = ALTERACION_POR_MODO[modo];
|
|
89143
|
+
if (pedida !== void 0) {
|
|
89144
|
+
const sinAlterar = clase - pedida;
|
|
89145
|
+
const vueltas = Math.floor(sinAlterar / 12);
|
|
89146
|
+
const paso = PASOS.find((p) => p.semitonos === sinAlterar - vueltas * 12);
|
|
89147
|
+
if (paso) return { paso: paso.paso, alteracion: pedida, octava: octava + vueltas };
|
|
88628
89148
|
}
|
|
88629
|
-
|
|
88630
|
-
|
|
89149
|
+
const natural = PASOS.find((p) => p.semitonos === clase);
|
|
89150
|
+
if (natural) return { paso: natural.paso, alteracion: 0, octava };
|
|
89151
|
+
if (fifths < 0) {
|
|
89152
|
+
const arriba = PASOS.find((p) => p.semitonos === clase + 1);
|
|
89153
|
+
if (arriba) return { paso: arriba.paso, alteracion: -1, octava };
|
|
88631
89154
|
}
|
|
88632
|
-
|
|
88633
|
-
|
|
88634
|
-
|
|
88635
|
-
const palabras = [...dir.matchAll(/<words\b[^>]*>([\s\S]*?)<\/words>/g)];
|
|
88636
|
-
if (palabras.length < 2) return dir;
|
|
88637
|
-
juntados++;
|
|
88638
|
-
const todo = palabras.map((p) => p[1].trim()).filter(Boolean).join("\n");
|
|
88639
|
-
let primero = true;
|
|
88640
|
-
return dir.replace(/<words\b([^>]*)>[\s\S]*?<\/words>/g, (_m, attrs) => {
|
|
88641
|
-
if (!primero) return "";
|
|
88642
|
-
primero = false;
|
|
88643
|
-
return `<words${attrs}>${todo}</words>`;
|
|
88644
|
-
});
|
|
88645
|
-
});
|
|
88646
|
-
if (juntados) correcciones.push(`${juntados} indicaciones de texto en varios renglones se juntaron en una.`);
|
|
88647
|
-
let silabas2 = 0;
|
|
88648
|
-
salida = salida.replace(/<lyric\b[^>]*>[\s\S]*?<\/lyric>/g, (lyric) => {
|
|
88649
|
-
const tipo = /<syllabic>\s*(\w+)\s*<\/syllabic>/.exec(lyric)?.[1];
|
|
88650
|
-
if (tipo !== "begin" && tipo !== "middle") return lyric;
|
|
88651
|
-
return lyric.replace(/(<text\b[^>]*>)([\s\S]*?)(<\/text>)/, (m, a, texto4, b) => {
|
|
88652
|
-
if (texto4.trimEnd().endsWith("-")) return m;
|
|
88653
|
-
silabas2++;
|
|
88654
|
-
return `${a}${texto4.trimEnd()}-${b}`;
|
|
88655
|
-
});
|
|
88656
|
-
});
|
|
88657
|
-
if (silabas2) correcciones.push(`${silabas2} s\xEDlabas unidas de la letra se marcaron con su guion.`);
|
|
88658
|
-
let tempos = 0;
|
|
88659
|
-
salida = salida.replace(/<metronome\b[^>]*>[\s\S]*?<\/metronome>/g, (met) => {
|
|
88660
|
-
const unidad = /<beat-unit>\s*([\w-]+)\s*<\/beat-unit>/.exec(met)?.[1];
|
|
88661
|
-
const porMinuto = /<per-minute>\s*([\d.]+)\s*<\/per-minute>/.exec(met)?.[1];
|
|
88662
|
-
const negras = unidad ? NEGRAS_POR_FIGURA[unidad] : void 0;
|
|
88663
|
-
if (!unidad || !porMinuto || negras === void 0 || /<beat-unit>[\s\S]*<beat-unit>/.test(met)) return met;
|
|
88664
|
-
const puntillos = (met.match(/<beat-unit-dot\s*\/>/g) ?? []).length;
|
|
88665
|
-
const factor = negras * (puntillos === 0 ? 1 : puntillos === 1 ? 1.5 : 1.75);
|
|
88666
|
-
if (factor === 1) return met;
|
|
88667
|
-
tempos++;
|
|
88668
|
-
const bpm = Math.round(Number.parseFloat(porMinuto) * factor * 100) / 100;
|
|
88669
|
-
return met.replace(/<beat-unit>[\s\S]*?<\/beat-unit>/, "<beat-unit>quarter</beat-unit>").replace(/<beat-unit-dot\s*\/>/g, "").replace(/<per-minute>[\s\S]*?<\/per-minute>/, `<per-minute>${bpm}</per-minute>`);
|
|
88670
|
-
});
|
|
88671
|
-
if (tempos) correcciones.push(`${tempos} indicaciones de tempo se pasaron a negras (mismo pulso).`);
|
|
88672
|
-
return { xml: salida, bytes: new TextEncoder().encode(salida), correcciones };
|
|
89155
|
+
const abajo = PASOS.find((p) => p.semitonos === clase - 1);
|
|
89156
|
+
if (abajo) return { paso: abajo.paso, alteracion: 1, octava };
|
|
89157
|
+
throw new Error(`altura MIDI no representable: ${midi}`);
|
|
88673
89158
|
}
|
|
88674
|
-
function
|
|
88675
|
-
|
|
88676
|
-
|
|
88677
|
-
|
|
88678
|
-
|
|
88679
|
-
|
|
88680
|
-
|
|
89159
|
+
function claveDelPentagrama(staff, bar) {
|
|
89160
|
+
if (staff.isPercussion) return { signo: "percussion", linea: 2, lineas: 5, conAfinacion: false };
|
|
89161
|
+
if (staff.showTablature && staff.tuning.length > 0)
|
|
89162
|
+
return { signo: "TAB", linea: 5, lineas: staff.tuning.length, conAfinacion: true };
|
|
89163
|
+
switch (bar.clef) {
|
|
89164
|
+
case _barrel_exports$4.Clef.C3:
|
|
89165
|
+
return { signo: "C", linea: 3, lineas: 5, conAfinacion: false };
|
|
89166
|
+
case _barrel_exports$4.Clef.C4:
|
|
89167
|
+
return { signo: "C", linea: 4, lineas: 5, conAfinacion: false };
|
|
89168
|
+
case _barrel_exports$4.Clef.F4:
|
|
89169
|
+
return { signo: "F", linea: 4, lineas: 5, conAfinacion: false };
|
|
89170
|
+
case _barrel_exports$4.Clef.Neutral:
|
|
89171
|
+
return { signo: "percussion", linea: 2, lineas: 5, conAfinacion: false };
|
|
89172
|
+
default:
|
|
89173
|
+
return { signo: "G", linea: 2, lineas: 5, conAfinacion: false };
|
|
89174
|
+
}
|
|
88681
89175
|
}
|
|
88682
|
-
function
|
|
88683
|
-
|
|
88684
|
-
|
|
88685
|
-
|
|
88686
|
-
|
|
88687
|
-
|
|
88688
|
-
|
|
88689
|
-
|
|
89176
|
+
function gruposDeTresillo(beats) {
|
|
89177
|
+
const abren = /* @__PURE__ */ new Set();
|
|
89178
|
+
const cierran = /* @__PURE__ */ new Set();
|
|
89179
|
+
let i2 = 0;
|
|
89180
|
+
while (i2 < beats.length) {
|
|
89181
|
+
const b = beats[i2];
|
|
89182
|
+
if (b.tupletNumerator <= 0 || b.tupletDenominator <= 0) {
|
|
89183
|
+
i2++;
|
|
89184
|
+
continue;
|
|
89185
|
+
}
|
|
89186
|
+
let j = i2;
|
|
89187
|
+
while (j + 1 < beats.length && beats[j + 1].tupletNumerator === b.tupletNumerator && beats[j + 1].tupletDenominator === b.tupletDenominator && (b.tupletGroup === null || beats[j + 1].tupletGroup === b.tupletGroup))
|
|
89188
|
+
j++;
|
|
89189
|
+
abren.add(i2);
|
|
89190
|
+
cierran.add(j);
|
|
89191
|
+
i2 = j + 1;
|
|
89192
|
+
}
|
|
89193
|
+
return { abren, cierran };
|
|
88690
89194
|
}
|
|
88691
|
-
function
|
|
88692
|
-
|
|
88693
|
-
|
|
88694
|
-
|
|
88695
|
-
|
|
88696
|
-
|
|
88697
|
-
|
|
89195
|
+
function direccionDeLasPalabras(texto4) {
|
|
89196
|
+
return SALTO_POR_CLAVE.get(claveDeSalto(texto4)) ?? null;
|
|
89197
|
+
}
|
|
89198
|
+
function saltosDelCompas(master) {
|
|
89199
|
+
const s = [];
|
|
89200
|
+
for (const [direccion, salto] of SALTOS) {
|
|
89201
|
+
if (!master?.directions?.has(direccion)) continue;
|
|
89202
|
+
s.push('<direction placement="above">', "<direction-type>");
|
|
89203
|
+
s.push(salto.simbolo ? `<${salto.simbolo}/>` : `<words>${escapar(salto.texto ?? "")}</words>`);
|
|
89204
|
+
s.push("</direction-type>", `<sound ${salto.sonido}/>`, "</direction>");
|
|
88698
89205
|
}
|
|
88699
|
-
return
|
|
89206
|
+
return s;
|
|
88700
89207
|
}
|
|
88701
|
-
function
|
|
88702
|
-
|
|
88703
|
-
let cuantos = 0;
|
|
88704
|
-
let arrastre = "";
|
|
88705
|
-
const nuevos = compases.map((c) => {
|
|
88706
|
-
let contenido = c.contenido;
|
|
88707
|
-
const primeraNota = contenido.search(/<note\b/);
|
|
88708
|
-
if (primeraNota >= 0) {
|
|
88709
|
-
let llevar = "";
|
|
88710
|
-
let alPrincipio = "";
|
|
88711
|
-
const despues = contenido.slice(primeraNota);
|
|
88712
|
-
contenido = contenido.slice(0, primeraNota) + despues.replace(/<attributes\b[^>]*>([\s\S]*?)<\/attributes>/g, (bloque, adentro, donde) => {
|
|
88713
|
-
const hijos = adentro.match(HIJO_QUE_SE_MUEVE);
|
|
88714
|
-
if (!hijos) return bloque;
|
|
88715
|
-
cuantos += hijos.length;
|
|
88716
|
-
if (tiempoAl(despues.slice(0, donde)) <= 0) alPrincipio += hijos.join("");
|
|
88717
|
-
else llevar += hijos.join("");
|
|
88718
|
-
const resto = adentro.replace(HIJO_QUE_SE_MUEVE, "");
|
|
88719
|
-
return resto.trim() ? `<attributes>${resto}</attributes>` : "";
|
|
88720
|
-
});
|
|
88721
|
-
const entra2 = arrastre + alPrincipio;
|
|
88722
|
-
arrastre = llevar;
|
|
88723
|
-
return (entra2 ? `<attributes>${entra2}</attributes>` : "") + contenido;
|
|
88724
|
-
}
|
|
88725
|
-
const entra = arrastre;
|
|
88726
|
-
arrastre = "";
|
|
88727
|
-
return (entra ? `<attributes>${entra}</attributes>` : "") + contenido;
|
|
88728
|
-
});
|
|
88729
|
-
return cuantos ? { texto: rearmar(parte, compases, nuevos), cuantos } : { texto: parte, cuantos: 0 };
|
|
89208
|
+
function nombreDeFigura(duracion) {
|
|
89209
|
+
return NOMBRE_DE_LA_FIGURA2.get(duracion) ?? "quarter";
|
|
88730
89210
|
}
|
|
88731
|
-
function
|
|
88732
|
-
const
|
|
88733
|
-
|
|
88734
|
-
|
|
88735
|
-
|
|
88736
|
-
|
|
88737
|
-
|
|
88738
|
-
|
|
88739
|
-
|
|
88740
|
-
|
|
88741
|
-
|
|
88742
|
-
|
|
88743
|
-
while (j < notas.length) {
|
|
88744
|
-
const anterior = notas[j - 1];
|
|
88745
|
-
const entre = c.contenido.slice(anterior.index + anterior[0].length, notas[j].index);
|
|
88746
|
-
if (entre.trim() || !/<chord\s*\/>/.test(notas[j][0])) break;
|
|
88747
|
-
grupo.push(notas[j]);
|
|
88748
|
-
j++;
|
|
88749
|
-
}
|
|
88750
|
-
i2 = j;
|
|
88751
|
-
const pent = (n) => entero(n[0], /<staff>\s*(\d+)\s*<\/staff>/) ?? 1;
|
|
88752
|
-
const cabeza = grupo[0];
|
|
88753
|
-
const pentDeCabeza = pent(cabeza);
|
|
88754
|
-
const ajenas = grupo.filter((n) => pent(n) !== pentDeCabeza);
|
|
88755
|
-
const durCabeza = entero(cabeza[0], /<duration>\s*(\d+)\s*<\/duration>/);
|
|
88756
|
-
if (ajenas.length === 0 || /<chord\s*\/>/.test(cabeza[0]) || grupo.some((n) => /<grace\b|<cue\s*\/>/.test(n[0])) || durCabeza === null) {
|
|
88757
|
-
continue;
|
|
88758
|
-
}
|
|
88759
|
-
cuantos += ajenas.length;
|
|
88760
|
-
const propias = grupo.filter((n) => pent(n) === pentDeCabeza).map((n) => n[0]);
|
|
88761
|
-
let texto4 = propias.join("");
|
|
88762
|
-
const porPentagrama = /* @__PURE__ */ new Map();
|
|
88763
|
-
for (const n of ajenas) porPentagrama.set(pent(n), [...porPentagrama.get(pent(n)) ?? [], n[0]]);
|
|
88764
|
-
for (const notasDelPent of porPentagrama.values()) {
|
|
88765
|
-
const primera = notasDelPent[0].replace(/<chord\s*\/>\s*/, "");
|
|
88766
|
-
const durPrimera = entero(primera, /<duration>\s*(\d+)\s*<\/duration>/) ?? durCabeza;
|
|
88767
|
-
texto4 += `<backup><duration>${durCabeza}</duration></backup>` + primera + notasDelPent.slice(1).join("");
|
|
88768
|
-
const delta = durCabeza - durPrimera;
|
|
88769
|
-
if (delta > 0) texto4 += `<forward><duration>${delta}</duration></forward>`;
|
|
88770
|
-
else if (delta < 0) texto4 += `<backup><duration>${-delta}</duration></backup>`;
|
|
88771
|
-
}
|
|
88772
|
-
const ultimo = grupo[grupo.length - 1];
|
|
88773
|
-
salida += c.contenido.slice(cursor, cabeza.index) + texto4;
|
|
88774
|
-
cursor = ultimo.index + ultimo[0].length;
|
|
88775
|
-
}
|
|
88776
|
-
return salida + c.contenido.slice(cursor);
|
|
88777
|
-
});
|
|
88778
|
-
return cuantos ? { texto: rearmar(parte, compases, nuevos), cuantos } : { texto: parte, cuantos: 0 };
|
|
89211
|
+
function instrumentosDePercusion(track) {
|
|
89212
|
+
const usadas = /* @__PURE__ */ new Set();
|
|
89213
|
+
for (const staff of track.staves)
|
|
89214
|
+
for (const bar of staff.bars)
|
|
89215
|
+
for (const voice of bar.voices)
|
|
89216
|
+
for (const beat of voice.beats)
|
|
89217
|
+
for (const note of beat.notes)
|
|
89218
|
+
if (note.percussionArticulation >= 0) usadas.add(note.percussionArticulation);
|
|
89219
|
+
const ids = /* @__PURE__ */ new Map();
|
|
89220
|
+
for (const art of [...usadas].sort((a, b) => a - b))
|
|
89221
|
+
ids.set(art, `P${track.index + 1}-I${art + 1}`);
|
|
89222
|
+
return ids;
|
|
88779
89223
|
}
|
|
88780
|
-
function
|
|
88781
|
-
|
|
88782
|
-
const
|
|
88783
|
-
|
|
88784
|
-
|
|
88785
|
-
const atributos = ATRIBUTOS_DE_SALTO.map((a) => new RegExp(`\\b${a}="([^"]*)"`).exec(sonido)?.[0]).filter((a) => a !== void 0);
|
|
88786
|
-
if (atributos.length === 0) return dir;
|
|
88787
|
-
const copia = `<sound ${atributos.join(" ")}/>`;
|
|
88788
|
-
if (todo.slice(desde + dir.length).trimStart().startsWith(copia)) return dir;
|
|
88789
|
-
cuantos++;
|
|
88790
|
-
return dir + copia;
|
|
88791
|
-
});
|
|
88792
|
-
return { texto: texto4, cuantos };
|
|
89224
|
+
function posicionDePercusion(staffLine) {
|
|
89225
|
+
const indiceDeB = 6;
|
|
89226
|
+
const bruto = indiceDeB + (5 - staffLine);
|
|
89227
|
+
const paso = PASOS[(bruto % 7 + 7) % 7].paso;
|
|
89228
|
+
return { paso, octava: 4 + Math.floor(bruto / 7) };
|
|
88793
89229
|
}
|
|
88794
|
-
function
|
|
88795
|
-
const
|
|
88796
|
-
const
|
|
88797
|
-
|
|
88798
|
-
|
|
88799
|
-
|
|
88800
|
-
|
|
88801
|
-
const
|
|
88802
|
-
|
|
88803
|
-
|
|
88804
|
-
|
|
89230
|
+
function escribirNota(note, beat, staff, opciones) {
|
|
89231
|
+
const s = ["<note>"];
|
|
89232
|
+
const esAdorno = beat.graceType !== _barrel_exports$4.GraceType.None;
|
|
89233
|
+
if (esAdorno) s.push(beat.graceType === _barrel_exports$4.GraceType.BeforeBeat ? "<grace/>" : '<grace slash="yes"/>');
|
|
89234
|
+
if (opciones.esAcorde) s.push("<chord/>");
|
|
89235
|
+
const esGolpeDeKit = staff.isPercussion && note.percussionArticulation >= 0;
|
|
89236
|
+
if (esGolpeDeKit) {
|
|
89237
|
+
const art = staff.track.percussionArticulations[note.percussionArticulation];
|
|
89238
|
+
const { paso, octava } = posicionDePercusion(art?.staffLine ?? 5);
|
|
89239
|
+
s.push("<unpitched>");
|
|
89240
|
+
s.push(`<display-step>${paso}</display-step>`);
|
|
89241
|
+
s.push(`<display-octave>${octava}</display-octave>`);
|
|
89242
|
+
s.push("</unpitched>");
|
|
89243
|
+
} else {
|
|
89244
|
+
const { paso, alteracion, octava } = alturaMusicXml(
|
|
89245
|
+
note.calculateRealValue(false, false),
|
|
89246
|
+
opciones.fifths,
|
|
89247
|
+
note.accidentalMode
|
|
89248
|
+
);
|
|
89249
|
+
s.push("<pitch>");
|
|
89250
|
+
s.push(`<step>${paso}</step>`);
|
|
89251
|
+
if (alteracion !== 0) s.push(`<alter>${alteracion}</alter>`);
|
|
89252
|
+
s.push(`<octave>${octava}</octave>`);
|
|
89253
|
+
s.push("</pitch>");
|
|
88805
89254
|
}
|
|
88806
|
-
|
|
88807
|
-
|
|
88808
|
-
|
|
88809
|
-
|
|
88810
|
-
|
|
88811
|
-
|
|
88812
|
-
|
|
88813
|
-
|
|
89255
|
+
if (!esAdorno) s.push(`<duration>${opciones.duracion}</duration>`);
|
|
89256
|
+
if (note.isTieDestination) s.push('<tie type="stop"/>');
|
|
89257
|
+
if (note.isTieOrigin) s.push('<tie type="start"/>');
|
|
89258
|
+
const idDeInstrumento = opciones.instrumentos.get(note.percussionArticulation);
|
|
89259
|
+
if (esGolpeDeKit && idDeInstrumento) s.push(`<instrument id="${idDeInstrumento}"/>`);
|
|
89260
|
+
s.push(`<voice>${opciones.numeroDeVoz}</voice>`);
|
|
89261
|
+
s.push(...elemento("type", nombreDeFigura(beat.duration)));
|
|
89262
|
+
for (let d = 0; d < beat.dots; d++) s.push("<dot/>");
|
|
89263
|
+
if (beat.tupletNumerator > 0 && beat.tupletDenominator > 0) {
|
|
89264
|
+
s.push("<time-modification>");
|
|
89265
|
+
s.push(`<actual-notes>${beat.tupletNumerator}</actual-notes>`);
|
|
89266
|
+
s.push(`<normal-notes>${beat.tupletDenominator}</normal-notes>`);
|
|
89267
|
+
s.push("</time-modification>");
|
|
88814
89268
|
}
|
|
88815
|
-
if (
|
|
88816
|
-
|
|
88817
|
-
const
|
|
88818
|
-
if (
|
|
88819
|
-
|
|
88820
|
-
|
|
88821
|
-
|
|
88822
|
-
|
|
88823
|
-
|
|
88824
|
-
|
|
88825
|
-
|
|
88826
|
-
|
|
89269
|
+
if (note.isDead) s.push("<notehead>x</notehead>");
|
|
89270
|
+
else if (esGolpeDeKit) {
|
|
89271
|
+
const art = staff.track.percussionArticulations[note.percussionArticulation];
|
|
89272
|
+
if (art?.noteHeadDefault === _barrel_exports$4.MusicFontSymbol.NoteheadXBlack)
|
|
89273
|
+
s.push("<notehead>x</notehead>");
|
|
89274
|
+
} else if (note.isGhost) s.push('<notehead parentheses="yes">normal</notehead>');
|
|
89275
|
+
if (opciones.numeroDePentagrama !== null) s.push(`<staff>${opciones.numeroDePentagrama}</staff>`);
|
|
89276
|
+
const notaciones = [];
|
|
89277
|
+
if (note.isTieDestination) notaciones.push('<tied type="stop"/>');
|
|
89278
|
+
if (note.isTieOrigin) notaciones.push('<tied type="start"/>');
|
|
89279
|
+
if (opciones.abreTresillo) notaciones.push('<tuplet type="start" number="1"/>');
|
|
89280
|
+
if (opciones.cierraTresillo) notaciones.push('<tuplet type="stop" number="1"/>');
|
|
89281
|
+
const tecnica = [];
|
|
89282
|
+
if (note.string > 0 && staff.tuning.length > 0) {
|
|
89283
|
+
tecnica.push(`<string>${staff.tuning.length - note.string + 1}</string>`);
|
|
89284
|
+
tecnica.push(`<fret>${note.fret}</fret>`);
|
|
89285
|
+
}
|
|
89286
|
+
const ligado = (desde, hasta) => hasta >= desde ? "hammer-on" : "pull-off";
|
|
89287
|
+
const origen = note.hammerPullOrigin;
|
|
89288
|
+
if (origen !== null) {
|
|
89289
|
+
const nombre = ligado(origen.fret, note.fret);
|
|
89290
|
+
tecnica.push(`<${nombre} type="stop"/>`);
|
|
89291
|
+
}
|
|
89292
|
+
const destino = note.hammerPullDestination;
|
|
89293
|
+
if (note.isHammerPullOrigin && destino) {
|
|
89294
|
+
const nombre = ligado(note.fret, destino.fret);
|
|
89295
|
+
tecnica.push(`<${nombre} type="start">${nombre === "hammer-on" ? "H" : "P"}</${nombre}>`);
|
|
89296
|
+
}
|
|
89297
|
+
if (note.harmonicType !== _barrel_exports$4.HarmonicType.None) tecnica.push("<harmonic/>");
|
|
89298
|
+
if (beat.isPalmMute) tecnica.push("<other-technical>palm-mute</other-technical>");
|
|
89299
|
+
if (beat.isLetRing) tecnica.push("<other-technical>let-ring</other-technical>");
|
|
89300
|
+
if (tecnica.length > 0) notaciones.push("<technical>", ...tecnica, "</technical>");
|
|
89301
|
+
const articulaciones = [];
|
|
89302
|
+
if (note.accentuated === _barrel_exports$4.AccentuationType.Normal) articulaciones.push("<accent/>");
|
|
89303
|
+
else if (note.accentuated === _barrel_exports$4.AccentuationType.Heavy)
|
|
89304
|
+
articulaciones.push("<strong-accent/>");
|
|
89305
|
+
else if (note.accentuated === _barrel_exports$4.AccentuationType.Tenuto)
|
|
89306
|
+
articulaciones.push("<tenuto/>");
|
|
89307
|
+
if (note.isStaccato) articulaciones.push("<staccato/>");
|
|
89308
|
+
if (articulaciones.length > 0)
|
|
89309
|
+
notaciones.push("<articulations>", ...articulaciones, "</articulations>");
|
|
89310
|
+
if (notaciones.length > 0) s.push("<notations>", ...notaciones, "</notations>");
|
|
89311
|
+
if (!opciones.esAcorde) s.push(...letraDelGolpe(beat));
|
|
89312
|
+
s.push("</note>");
|
|
89313
|
+
return s;
|
|
88827
89314
|
}
|
|
88828
|
-
function
|
|
88829
|
-
|
|
89315
|
+
function letraDelGolpe(beat) {
|
|
89316
|
+
if (!beat.lyrics) return [];
|
|
89317
|
+
const s = [];
|
|
89318
|
+
beat.lyrics.forEach((verso, i2) => {
|
|
89319
|
+
if (!verso) return;
|
|
89320
|
+
const sigue = verso.endsWith("-") && verso.length > 1;
|
|
89321
|
+
let anterior = beat.previousBeat;
|
|
89322
|
+
while (anterior && !anterior.lyrics?.[i2]) anterior = anterior.previousBeat;
|
|
89323
|
+
const viene = !!anterior?.lyrics?.[i2]?.endsWith("-");
|
|
89324
|
+
const silabico = sigue ? viene ? "middle" : "begin" : viene ? "end" : "single";
|
|
89325
|
+
s.push(`<lyric number="${i2 + 1}">`);
|
|
89326
|
+
s.push(`<syllabic>${silabico}</syllabic>`);
|
|
89327
|
+
s.push(...elemento("text", sigue ? verso.slice(0, -1) : verso));
|
|
89328
|
+
s.push("</lyric>");
|
|
89329
|
+
});
|
|
89330
|
+
return s;
|
|
88830
89331
|
}
|
|
88831
|
-
function
|
|
88832
|
-
const
|
|
88833
|
-
|
|
88834
|
-
|
|
88835
|
-
let
|
|
88836
|
-
|
|
88837
|
-
|
|
88838
|
-
|
|
88839
|
-
|
|
88840
|
-
|
|
88841
|
-
|
|
88842
|
-
|
|
88843
|
-
|
|
88844
|
-
|
|
88845
|
-
|
|
88846
|
-
|
|
88847
|
-
|
|
88848
|
-
|
|
88849
|
-
|
|
88850
|
-
|
|
88851
|
-
|
|
88852
|
-
|
|
88853
|
-
|
|
88854
|
-
|
|
88855
|
-
|
|
88856
|
-
|
|
88857
|
-
|
|
89332
|
+
function escribirSilencio2(beat, duracion, numeroDeVoz, numeroDePentagrama) {
|
|
89333
|
+
const s = ["<note>", "<rest/>", `<duration>${duracion}</duration>`];
|
|
89334
|
+
s.push(`<voice>${numeroDeVoz}</voice>`);
|
|
89335
|
+
s.push(...elemento("type", nombreDeFigura(beat.duration)));
|
|
89336
|
+
for (let d = 0; d < beat.dots; d++) s.push("<dot/>");
|
|
89337
|
+
if (beat.tupletNumerator > 0 && beat.tupletDenominator > 0) {
|
|
89338
|
+
s.push("<time-modification>");
|
|
89339
|
+
s.push(`<actual-notes>${beat.tupletNumerator}</actual-notes>`);
|
|
89340
|
+
s.push(`<normal-notes>${beat.tupletDenominator}</normal-notes>`);
|
|
89341
|
+
s.push("</time-modification>");
|
|
89342
|
+
}
|
|
89343
|
+
if (numeroDePentagrama !== null) s.push(`<staff>${numeroDePentagrama}</staff>`);
|
|
89344
|
+
s.push(...letraDelGolpe(beat));
|
|
89345
|
+
s.push("</note>");
|
|
89346
|
+
return s;
|
|
89347
|
+
}
|
|
89348
|
+
function exportarMusicXml(score) {
|
|
89349
|
+
const l = [];
|
|
89350
|
+
l.push('<?xml version="1.0" encoding="UTF-8"?>');
|
|
89351
|
+
l.push('<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 4.0 Partwise//EN"');
|
|
89352
|
+
l.push(' "http://www.musicxml.org/dtds/partwise.dtd">');
|
|
89353
|
+
l.push('<score-partwise version="4.0">');
|
|
89354
|
+
if (score.title) l.push("<work>", ...elemento("work-title", score.title), "</work>");
|
|
89355
|
+
l.push(...elemento("movement-title", score.subTitle));
|
|
89356
|
+
l.push("<identification>");
|
|
89357
|
+
if (score.music) l.push(`<creator type="composer">${escapar(score.music)}</creator>`);
|
|
89358
|
+
else if (score.artist) l.push(`<creator type="composer">${escapar(score.artist)}</creator>`);
|
|
89359
|
+
if (score.words) l.push(`<creator type="lyricist">${escapar(score.words)}</creator>`);
|
|
89360
|
+
l.push(...elemento("rights", score.copyright));
|
|
89361
|
+
l.push("<encoding>", "<software>Mandioca Tabs</software>", "</encoding>");
|
|
89362
|
+
l.push("</identification>");
|
|
89363
|
+
const instrumentosPorPista = /* @__PURE__ */ new Map();
|
|
89364
|
+
l.push("<part-list>");
|
|
89365
|
+
for (const track of score.tracks) {
|
|
89366
|
+
const id2 = `P${track.index + 1}`;
|
|
89367
|
+
l.push(`<score-part id="${id2}">`);
|
|
89368
|
+
l.push(...elemento("part-name", track.name || `Pista ${track.index + 1}`));
|
|
89369
|
+
l.push(...elemento("part-abbreviation", track.shortName));
|
|
89370
|
+
const esPercusion = track.staves.some((st) => st.isPercussion);
|
|
89371
|
+
const instrumentos = esPercusion ? instrumentosDePercusion(track) : /* @__PURE__ */ new Map();
|
|
89372
|
+
instrumentosPorPista.set(track.index, instrumentos);
|
|
89373
|
+
if (esPercusion) {
|
|
89374
|
+
for (const [art, idInstrumento] of instrumentos) {
|
|
89375
|
+
const a = track.percussionArticulations[art];
|
|
89376
|
+
l.push(`<score-instrument id="${idInstrumento}">`);
|
|
89377
|
+
l.push(...elemento("instrument-name", `Percusi\xF3n ${art + 1}`));
|
|
89378
|
+
l.push("</score-instrument>");
|
|
89379
|
+
l.push(`<midi-instrument id="${idInstrumento}">`);
|
|
89380
|
+
l.push("<midi-channel>10</midi-channel>");
|
|
89381
|
+
l.push(`<midi-unpitched>${(a?.outputMidiNumber ?? 36) + 1}</midi-unpitched>`);
|
|
89382
|
+
l.push("</midi-instrument>");
|
|
89383
|
+
}
|
|
89384
|
+
} else {
|
|
89385
|
+
l.push(`<score-instrument id="${id2}-I1">`);
|
|
89386
|
+
l.push(...elemento("instrument-name", track.name || `Pista ${track.index + 1}`));
|
|
89387
|
+
l.push("</score-instrument>");
|
|
89388
|
+
l.push(`<midi-instrument id="${id2}-I1">`);
|
|
89389
|
+
l.push(`<midi-channel>${track.playbackInfo.primaryChannel + 1}</midi-channel>`);
|
|
89390
|
+
l.push(`<midi-program>${track.playbackInfo.program + 1}</midi-program>`);
|
|
89391
|
+
l.push(`<volume>${Math.round(track.playbackInfo.volume / 16 * 100)}</volume>`);
|
|
89392
|
+
l.push(`<pan>${Math.round((track.playbackInfo.balance - 8) / 8 * 90)}</pan>`);
|
|
89393
|
+
l.push("</midi-instrument>");
|
|
89394
|
+
}
|
|
89395
|
+
l.push("</score-part>");
|
|
89396
|
+
}
|
|
89397
|
+
l.push("</part-list>");
|
|
89398
|
+
for (const track of score.tracks) {
|
|
89399
|
+
const instrumentos = instrumentosPorPista.get(track.index) ?? /* @__PURE__ */ new Map();
|
|
89400
|
+
l.push(`<part id="P${track.index + 1}">`);
|
|
89401
|
+
const pentagramas = track.staves;
|
|
89402
|
+
if (pentagramas.length === 0) {
|
|
89403
|
+
l.push("</part>");
|
|
89404
|
+
continue;
|
|
89405
|
+
}
|
|
89406
|
+
let armaduraAnterior = null;
|
|
89407
|
+
let compasAnterior = null;
|
|
89408
|
+
let clavesAnteriores = null;
|
|
89409
|
+
const cantidadDeCompases = Math.max(...pentagramas.map((st) => st.bars.length));
|
|
89410
|
+
for (let indiceDeCompas2 = 0; indiceDeCompas2 < cantidadDeCompases; indiceDeCompas2++) {
|
|
89411
|
+
const master = score.masterBars[indiceDeCompas2];
|
|
89412
|
+
l.push(`<measure number="${indiceDeCompas2 + 1}">`);
|
|
89413
|
+
const fifths = (pentagramas[0]?.bars[indiceDeCompas2] ?? pentagramas[0]?.bars[0])?.keySignature ?? master?.keySignature ?? 0;
|
|
89414
|
+
const modo = master?.keySignatureType === _barrel_exports$4.KeySignatureType.Minor ? "minor" : "major";
|
|
89415
|
+
const armadura = `${fifths}/${modo}`;
|
|
89416
|
+
const numerador = master?.timeSignatureNumerator ?? 4;
|
|
89417
|
+
const denominador = master?.timeSignatureDenominator ?? 4;
|
|
89418
|
+
const compas = `${numerador}/${denominador}`;
|
|
89419
|
+
const claves = pentagramas.map((st, k) => {
|
|
89420
|
+
const bar = st.bars[indiceDeCompas2] ?? st.bars[0];
|
|
89421
|
+
return { pentagrama: st, numero: k + 1, ...claveDelPentagrama(st, bar) };
|
|
89422
|
+
});
|
|
89423
|
+
const firmaDeClaves = claves.map((c) => `${c.signo}${c.linea}`).join(",");
|
|
89424
|
+
const cambios = [];
|
|
89425
|
+
if (indiceDeCompas2 === 0) cambios.push(`<divisions>${DIVISIONES_POR_NEGRA}</divisions>`);
|
|
89426
|
+
if (armadura !== armaduraAnterior) {
|
|
89427
|
+
cambios.push("<key>");
|
|
89428
|
+
cambios.push(`<fifths>${fifths}</fifths>`);
|
|
89429
|
+
cambios.push(`<mode>${modo}</mode>`);
|
|
89430
|
+
cambios.push("</key>");
|
|
89431
|
+
armaduraAnterior = armadura;
|
|
89432
|
+
}
|
|
89433
|
+
if (compas !== compasAnterior) {
|
|
89434
|
+
cambios.push("<time>");
|
|
89435
|
+
cambios.push(`<beats>${numerador}</beats>`);
|
|
89436
|
+
cambios.push(`<beat-type>${denominador}</beat-type>`);
|
|
89437
|
+
cambios.push("</time>");
|
|
89438
|
+
compasAnterior = compas;
|
|
89439
|
+
}
|
|
89440
|
+
if (firmaDeClaves !== clavesAnteriores) {
|
|
89441
|
+
if (pentagramas.length > 1 && clavesAnteriores === null)
|
|
89442
|
+
cambios.push(`<staves>${pentagramas.length}</staves>`);
|
|
89443
|
+
const num = (clave) => pentagramas.length > 1 ? ` number="${clave.numero}"` : "";
|
|
89444
|
+
for (const clave of claves) {
|
|
89445
|
+
cambios.push(`<clef${num(clave)}>`);
|
|
89446
|
+
cambios.push(`<sign>${clave.signo}</sign>`);
|
|
89447
|
+
cambios.push(`<line>${clave.linea}</line>`);
|
|
89448
|
+
cambios.push("</clef>");
|
|
89449
|
+
}
|
|
89450
|
+
for (const clave of claves) {
|
|
89451
|
+
cambios.push(`<staff-details${num(clave)}>`);
|
|
89452
|
+
cambios.push(`<staff-lines>${clave.lineas}</staff-lines>`);
|
|
89453
|
+
if (clave.conAfinacion)
|
|
89454
|
+
clave.pentagrama.tuning.forEach((midi, i2) => {
|
|
89455
|
+
const linea = clave.pentagrama.tuning.length - i2;
|
|
89456
|
+
const { paso, alteracion, octava } = alturaMusicXml(midi, fifths);
|
|
89457
|
+
cambios.push(`<staff-tuning line="${linea}">`);
|
|
89458
|
+
cambios.push(`<tuning-step>${paso}</tuning-step>`);
|
|
89459
|
+
if (alteracion !== 0) cambios.push(`<tuning-alter>${alteracion}</tuning-alter>`);
|
|
89460
|
+
cambios.push(`<tuning-octave>${octava}</tuning-octave>`);
|
|
89461
|
+
cambios.push("</staff-tuning>");
|
|
89462
|
+
});
|
|
89463
|
+
cambios.push("</staff-details>");
|
|
89464
|
+
}
|
|
89465
|
+
clavesAnteriores = firmaDeClaves;
|
|
89466
|
+
}
|
|
89467
|
+
if (cambios.length > 0) l.push("<attributes>", ...cambios, "</attributes>");
|
|
89468
|
+
const casilla = master?.alternateEndings ?? 0;
|
|
89469
|
+
const casillaAntes = score.masterBars[indiceDeCompas2 - 1]?.alternateEndings ?? 0;
|
|
89470
|
+
const casillaDespues = score.masterBars[indiceDeCompas2 + 1]?.alternateEndings ?? 0;
|
|
89471
|
+
const numerosDeCasilla = [0, 1, 2, 3, 4, 5, 6, 7].filter((b) => casilla & 1 << b).map((b) => b + 1).join(", ");
|
|
89472
|
+
if (master?.isRepeatStart || casilla && casilla !== casillaAntes) {
|
|
89473
|
+
l.push('<barline location="left">');
|
|
89474
|
+
if (master?.isRepeatStart) l.push("<bar-style>heavy-light</bar-style>");
|
|
89475
|
+
if (casilla && casilla !== casillaAntes) l.push(`<ending number="${numerosDeCasilla}" type="start"/>`);
|
|
89476
|
+
if (master?.isRepeatStart) l.push('<repeat direction="forward"/>');
|
|
89477
|
+
l.push("</barline>");
|
|
89478
|
+
}
|
|
89479
|
+
if (master?.section?.text || master?.section?.marker)
|
|
89480
|
+
l.push(
|
|
89481
|
+
'<direction placement="above">',
|
|
89482
|
+
"<direction-type>",
|
|
89483
|
+
`<rehearsal>${escapar(master.section.marker || master.section.text)}</rehearsal>`,
|
|
89484
|
+
"</direction-type>",
|
|
89485
|
+
"</direction>"
|
|
89486
|
+
);
|
|
89487
|
+
l.push(...saltosDelCompas(master));
|
|
89488
|
+
const ticsDelCompas = DIVISIONES_POR_NEGRA * 4 * numerador / denominador;
|
|
89489
|
+
const tempos = (master?.tempoAutomations ?? []).map((a) => ({ bpm: a.value, desde: a.ratioPosition }));
|
|
89490
|
+
if (indiceDeCompas2 === 0 && score.tempo && !tempos.some((t) => t.desde <= 1e-6))
|
|
89491
|
+
tempos.unshift({ bpm: score.tempo, desde: 0 });
|
|
89492
|
+
for (const t of tempos) {
|
|
89493
|
+
const bpm = Math.round(t.bpm);
|
|
89494
|
+
const offset = Math.round(t.desde * ticsDelCompas);
|
|
89495
|
+
l.push(
|
|
89496
|
+
'<direction placement="above">',
|
|
89497
|
+
"<direction-type>",
|
|
89498
|
+
"<metronome>",
|
|
89499
|
+
"<beat-unit>quarter</beat-unit>",
|
|
89500
|
+
`<per-minute>${bpm}</per-minute>`,
|
|
89501
|
+
"</metronome>",
|
|
89502
|
+
"</direction-type>",
|
|
89503
|
+
...offset > 0 ? [`<offset>${offset}</offset>`] : [],
|
|
89504
|
+
`<sound tempo="${bpm}"/>`,
|
|
89505
|
+
"</direction>"
|
|
89506
|
+
);
|
|
89507
|
+
}
|
|
89508
|
+
let ultimoAvance = 0;
|
|
89509
|
+
let hayAlgoEscrito = false;
|
|
89510
|
+
for (const { pentagrama, numero: numero2 } of claves) {
|
|
89511
|
+
const bar = pentagrama.bars[indiceDeCompas2];
|
|
89512
|
+
if (!bar) continue;
|
|
89513
|
+
bar.voices.forEach((voice, indiceDeVoz) => {
|
|
89514
|
+
if (voice.beats.length === 0 || voice.isEmpty) return;
|
|
89515
|
+
if (hayAlgoEscrito && ultimoAvance > 0)
|
|
89516
|
+
l.push("<backup>", `<duration>${ultimoAvance}</duration>`, "</backup>");
|
|
89517
|
+
const { abren, cierran } = gruposDeTresillo(voice.beats);
|
|
89518
|
+
const numeroDePentagrama = pentagramas.length > 1 ? numero2 : null;
|
|
89519
|
+
let avance = 0;
|
|
89520
|
+
voice.beats.forEach((beat, i2) => {
|
|
89521
|
+
const duracion = beat.displayDuration;
|
|
89522
|
+
if (beat.graceType === _barrel_exports$4.GraceType.None) avance += duracion;
|
|
89523
|
+
if (beat.isRest || beat.notes.length === 0) {
|
|
89524
|
+
l.push(...escribirSilencio2(beat, duracion, indiceDeVoz + 1, numeroDePentagrama));
|
|
89525
|
+
return;
|
|
89526
|
+
}
|
|
89527
|
+
beat.notes.forEach((note, k) => {
|
|
89528
|
+
l.push(
|
|
89529
|
+
...escribirNota(note, beat, pentagrama, {
|
|
89530
|
+
esAcorde: k > 0,
|
|
89531
|
+
fifths,
|
|
89532
|
+
duracion,
|
|
89533
|
+
// ★ La marca de tresillo va en la PRIMERA nota del golpe: es una marca del
|
|
89534
|
+
// golpe, no de cada cuerda que suena en él.
|
|
89535
|
+
abreTresillo: k === 0 && abren.has(i2),
|
|
89536
|
+
cierraTresillo: k === 0 && cierran.has(i2),
|
|
89537
|
+
instrumentos,
|
|
89538
|
+
numeroDeVoz: indiceDeVoz + 1,
|
|
89539
|
+
numeroDePentagrama
|
|
89540
|
+
})
|
|
89541
|
+
);
|
|
89542
|
+
});
|
|
89543
|
+
});
|
|
89544
|
+
ultimoAvance = avance;
|
|
89545
|
+
hayAlgoEscrito = true;
|
|
89546
|
+
});
|
|
89547
|
+
}
|
|
89548
|
+
const cierraCasilla = casilla !== 0 && casilla !== casillaDespues;
|
|
89549
|
+
if (master?.isRepeatEnd || master?.isDoubleBar || cierraCasilla) {
|
|
89550
|
+
l.push('<barline location="right">');
|
|
89551
|
+
if (master?.isRepeatEnd || master?.isDoubleBar)
|
|
89552
|
+
l.push(`<bar-style>${master.isRepeatEnd ? "light-heavy" : "light-light"}</bar-style>`);
|
|
89553
|
+
if (cierraCasilla)
|
|
89554
|
+
l.push(`<ending number="${numerosDeCasilla}" type="${master?.isRepeatEnd ? "stop" : "discontinue"}"/>`);
|
|
89555
|
+
if (master?.isRepeatEnd)
|
|
89556
|
+
l.push(`<repeat direction="backward" times="${Math.max(2, master.repeatCount)}"/>`);
|
|
89557
|
+
l.push("</barline>");
|
|
89558
|
+
}
|
|
89559
|
+
l.push("</measure>");
|
|
89560
|
+
}
|
|
89561
|
+
l.push("</part>");
|
|
89562
|
+
}
|
|
89563
|
+
l.push("</score-partwise>");
|
|
89564
|
+
return sangrar(l);
|
|
89565
|
+
}
|
|
89566
|
+
function sangrar(lineas) {
|
|
89567
|
+
const salida = [];
|
|
89568
|
+
let nivel = 0;
|
|
89569
|
+
for (const linea of lineas) {
|
|
89570
|
+
const cierra = linea.startsWith("</");
|
|
89571
|
+
if (cierra) nivel = Math.max(0, nivel - 1);
|
|
89572
|
+
salida.push(" ".repeat(nivel) + linea);
|
|
89573
|
+
const abre = /^<[^/?!]/.test(linea) && !linea.endsWith("/>") && !/<\/[^>]+>$/.test(linea);
|
|
89574
|
+
if (abre) nivel++;
|
|
89575
|
+
}
|
|
89576
|
+
return salida.join("\n") + "\n";
|
|
89577
|
+
}
|
|
89578
|
+
function exportarMusicXmlComprimido(score) {
|
|
89579
|
+
const xml = exportarMusicXml(score);
|
|
89580
|
+
const contenedor = `<?xml version="1.0" encoding="UTF-8"?>
|
|
89581
|
+
<container>
|
|
89582
|
+
<rootfiles>
|
|
89583
|
+
<rootfile full-path="partitura.musicxml" media-type="application/vnd.recordare.musicxml+xml"/>
|
|
89584
|
+
</rootfiles>
|
|
89585
|
+
</container>
|
|
89586
|
+
`;
|
|
89587
|
+
const codificador = new TextEncoder();
|
|
89588
|
+
return zipSync(
|
|
89589
|
+
{
|
|
89590
|
+
"META-INF/container.xml": [codificador.encode(contenedor), { level: 0 }],
|
|
89591
|
+
"partitura.musicxml": codificador.encode(xml)
|
|
89592
|
+
},
|
|
89593
|
+
// ⚠️ Fecha FIJA, no la de hoy: dos exportaciones iguales tienen que dar dos archivos
|
|
89594
|
+
// iguales byte a byte, o no hay prueba que pueda compararlos ni `diff` de git que
|
|
89595
|
+
// sirva. El porqué del valor concreto está en la constante — se tardó dos rojos en
|
|
89596
|
+
// encontrarlo, y ninguno de los dos era el que yo esperaba.
|
|
89597
|
+
{ mtime: FECHA_FIJA_DEL_ZIP }
|
|
89598
|
+
);
|
|
89599
|
+
}
|
|
89600
|
+
var DIVISIONES_POR_NEGRA, FECHA_FIJA_DEL_ZIP, PASOS, NOMBRE_DE_LA_FIGURA2, ALTERACION_POR_MODO, D, SALTOS, claveDeSalto, SALTO_POR_CLAVE;
|
|
89601
|
+
var init_musicxml = __esm({
|
|
89602
|
+
"packages/io/src/musicxml.ts"() {
|
|
89603
|
+
init_alphaTab();
|
|
89604
|
+
init_esm();
|
|
89605
|
+
DIVISIONES_POR_NEGRA = 960;
|
|
89606
|
+
FECHA_FIJA_DEL_ZIP = 946728e6;
|
|
89607
|
+
PASOS = [
|
|
89608
|
+
{ paso: "C", semitonos: 0 },
|
|
89609
|
+
{ paso: "D", semitonos: 2 },
|
|
89610
|
+
{ paso: "E", semitonos: 4 },
|
|
89611
|
+
{ paso: "F", semitonos: 5 },
|
|
89612
|
+
{ paso: "G", semitonos: 7 },
|
|
89613
|
+
{ paso: "A", semitonos: 9 },
|
|
89614
|
+
{ paso: "B", semitonos: 11 }
|
|
89615
|
+
];
|
|
89616
|
+
NOMBRE_DE_LA_FIGURA2 = /* @__PURE__ */ new Map([
|
|
89617
|
+
[-4, "long"],
|
|
89618
|
+
[-2, "breve"],
|
|
89619
|
+
[1, "whole"],
|
|
89620
|
+
[2, "half"],
|
|
89621
|
+
[4, "quarter"],
|
|
89622
|
+
[8, "eighth"],
|
|
89623
|
+
[16, "16th"],
|
|
89624
|
+
[32, "32nd"],
|
|
89625
|
+
[64, "64th"],
|
|
89626
|
+
[128, "128th"],
|
|
89627
|
+
[256, "256th"]
|
|
89628
|
+
]);
|
|
89629
|
+
ALTERACION_POR_MODO = { 2: 0, 3: 1, 4: 2, 5: -1, 6: -2 };
|
|
89630
|
+
D = _barrel_exports$4.Direction;
|
|
89631
|
+
SALTOS = [
|
|
89632
|
+
[D.TargetSegno, { simbolo: "segno", sonido: 'segno="segno"' }],
|
|
89633
|
+
[D.TargetSegnoSegno, { simbolo: "segno", sonido: 'segno="segno2"' }],
|
|
89634
|
+
[D.TargetCoda, { simbolo: "coda", sonido: 'coda="coda"' }],
|
|
89635
|
+
[D.TargetDoubleCoda, { simbolo: "coda", sonido: 'coda="coda2"' }],
|
|
89636
|
+
[D.TargetFine, { texto: "Fine", sonido: 'fine="yes"' }],
|
|
89637
|
+
[D.JumpDaCapo, { texto: "D.C.", sonido: 'dacapo="yes"' }],
|
|
89638
|
+
[D.JumpDaCapoAlCoda, { texto: "D.C. al Coda", sonido: 'dacapo="yes"' }],
|
|
89639
|
+
[D.JumpDaCapoAlDoubleCoda, { texto: "D.C. al Coda 2", sonido: 'dacapo="yes"' }],
|
|
89640
|
+
[D.JumpDaCapoAlFine, { texto: "D.C. al Fine", sonido: 'dacapo="yes"' }],
|
|
89641
|
+
[D.JumpDalSegno, { texto: "D.S.", sonido: 'dalsegno="segno"' }],
|
|
89642
|
+
[D.JumpDalSegnoAlCoda, { texto: "D.S. al Coda", sonido: 'dalsegno="segno"' }],
|
|
89643
|
+
[D.JumpDalSegnoAlDoubleCoda, { texto: "D.S. al Coda 2", sonido: 'dalsegno="segno"' }],
|
|
89644
|
+
[D.JumpDalSegnoAlFine, { texto: "D.S. al Fine", sonido: 'dalsegno="segno"' }],
|
|
89645
|
+
[D.JumpDalSegnoSegno, { texto: "D.S.S.", sonido: 'dalsegno="segno2"' }],
|
|
89646
|
+
[D.JumpDalSegnoSegnoAlCoda, { texto: "D.S.S. al Coda", sonido: 'dalsegno="segno2"' }],
|
|
89647
|
+
[D.JumpDalSegnoSegnoAlDoubleCoda, { texto: "D.S.S. al Coda 2", sonido: 'dalsegno="segno2"' }],
|
|
89648
|
+
[D.JumpDalSegnoSegnoAlFine, { texto: "D.S.S. al Fine", sonido: 'dalsegno="segno2"' }],
|
|
89649
|
+
[D.JumpDaCoda, { texto: "To Coda", sonido: 'tocoda="coda"' }],
|
|
89650
|
+
[D.JumpDaDoubleCoda, { texto: "To Coda 2", sonido: 'tocoda="coda2"' }]
|
|
89651
|
+
];
|
|
89652
|
+
claveDeSalto = (texto4) => texto4.toLowerCase().replace(/double\s*coda/g, "coda 2").replace(/dal\s*segno\s*segno/g, "dss").replace(/dal\s*segno/g, "ds").replace(/da\s*capo/g, "dc").replace(/[^a-z0-9]/g, "");
|
|
89653
|
+
SALTO_POR_CLAVE = new Map(
|
|
89654
|
+
SALTOS.filter(([, s]) => s.texto).map(([d, s]) => [
|
|
89655
|
+
claveDeSalto(s.texto),
|
|
89656
|
+
_barrel_exports$4.Direction[d]
|
|
89657
|
+
])
|
|
89658
|
+
);
|
|
89659
|
+
}
|
|
89660
|
+
});
|
|
89661
|
+
|
|
89662
|
+
// packages/io/src/musicxmlEntrada.ts
|
|
89663
|
+
function textoMusicXml(bytes) {
|
|
89664
|
+
if (bytes.length > 4 && bytes[0] === 80 && bytes[1] === 75) {
|
|
89665
|
+
let archivos;
|
|
89666
|
+
try {
|
|
89667
|
+
archivos = unzipSync(bytes);
|
|
89668
|
+
} catch {
|
|
89669
|
+
return null;
|
|
89670
|
+
}
|
|
89671
|
+
const contenedor = archivos["META-INF/container.xml"];
|
|
89672
|
+
if (!contenedor) return null;
|
|
89673
|
+
const ruta = /<rootfile\b[^>]*full-path="([^"]+)"/.exec(strFromU8(contenedor))?.[1];
|
|
89674
|
+
const raiz = ruta ? archivos[ruta] : void 0;
|
|
89675
|
+
return raiz ? decodificar(raiz) : null;
|
|
89676
|
+
}
|
|
89677
|
+
const texto4 = decodificar(bytes.subarray(0, Math.min(bytes.length, 4096)));
|
|
89678
|
+
if (!/<score-(partwise|timewise)\b/.test(texto4) && !/<!DOCTYPE\s+score-/.test(texto4)) return null;
|
|
89679
|
+
return decodificar(bytes);
|
|
89680
|
+
}
|
|
89681
|
+
function decodificar(bytes) {
|
|
89682
|
+
if (bytes[0] === 255 && bytes[1] === 254) return new TextDecoder("utf-16le").decode(bytes);
|
|
89683
|
+
if (bytes[0] === 254 && bytes[1] === 255) return new TextDecoder("utf-16be").decode(bytes);
|
|
89684
|
+
return new TextDecoder("utf-8").decode(bytes);
|
|
89685
|
+
}
|
|
89686
|
+
function prepararMusicXml(xml) {
|
|
89687
|
+
const correcciones = [];
|
|
89688
|
+
let atributosMovidos = 0;
|
|
89689
|
+
let acordesSeparados = 0;
|
|
89690
|
+
let saltosMovidos = 0;
|
|
89691
|
+
let salida = xml.replace(/<part\b[^>]*>[\s\S]*?<\/part>/g, (parteOriginal) => {
|
|
89692
|
+
const movidos = moverAtributosDeFinDeCompas(parteOriginal);
|
|
89693
|
+
atributosMovidos += movidos.cuantos;
|
|
89694
|
+
const separados = separarAcordesEntrePentagramas(movidos.texto);
|
|
89695
|
+
acordesSeparados += separados.cuantos;
|
|
89696
|
+
const saltos = sacarSaltosDeLaIndicacion(separados.texto);
|
|
89697
|
+
saltosMovidos += saltos.cuantos;
|
|
89698
|
+
const { texto: texto4, cambio } = compactarVoces(saltos.texto);
|
|
89699
|
+
if (cambio) correcciones.push(cambio);
|
|
89700
|
+
return texto4;
|
|
89701
|
+
});
|
|
89702
|
+
if (atributosMovidos) {
|
|
89703
|
+
correcciones.push(
|
|
89704
|
+
`${atributosMovidos} cambios de clave, armadura o comp\xE1s escritos entre las notas se pusieron al principio del comp\xE1s donde rigen.`
|
|
89705
|
+
);
|
|
89706
|
+
}
|
|
89707
|
+
if (acordesSeparados) {
|
|
89708
|
+
correcciones.push(`${acordesSeparados} notas de acordes repartidos entre los dos pentagramas se pusieron en el suyo.`);
|
|
89709
|
+
}
|
|
89710
|
+
if (saltosMovidos) correcciones.push(`${saltosMovidos} saltos (D.C., D.S., Coda, Fine, Segno) se leyeron de su indicaci\xF3n.`);
|
|
89711
|
+
let juntados = 0;
|
|
89712
|
+
salida = salida.replace(/<direction\b[^>]*>[\s\S]*?<\/direction>/g, (dir) => {
|
|
89713
|
+
const palabras = [...dir.matchAll(/<words\b[^>]*>([\s\S]*?)<\/words>/g)];
|
|
89714
|
+
if (palabras.length < 2) return dir;
|
|
89715
|
+
juntados++;
|
|
89716
|
+
const todo = palabras.map((p) => p[1].trim()).filter(Boolean).join("\n");
|
|
89717
|
+
let primero = true;
|
|
89718
|
+
return dir.replace(/<words\b([^>]*)>[\s\S]*?<\/words>/g, (_m, attrs) => {
|
|
89719
|
+
if (!primero) return "";
|
|
89720
|
+
primero = false;
|
|
89721
|
+
return `<words${attrs}>${todo}</words>`;
|
|
89722
|
+
});
|
|
89723
|
+
});
|
|
89724
|
+
if (juntados) correcciones.push(`${juntados} indicaciones de texto en varios renglones se juntaron en una.`);
|
|
89725
|
+
let silabas2 = 0;
|
|
89726
|
+
salida = salida.replace(/<lyric\b[^>]*>[\s\S]*?<\/lyric>/g, (lyric) => {
|
|
89727
|
+
const tipo = /<syllabic>\s*(\w+)\s*<\/syllabic>/.exec(lyric)?.[1];
|
|
89728
|
+
if (tipo !== "begin" && tipo !== "middle") return lyric;
|
|
89729
|
+
return lyric.replace(/(<text\b[^>]*>)([\s\S]*?)(<\/text>)/, (m, a, texto4, b) => {
|
|
89730
|
+
if (texto4.trimEnd().endsWith("-")) return m;
|
|
89731
|
+
silabas2++;
|
|
89732
|
+
return `${a}${texto4.trimEnd()}-${b}`;
|
|
89733
|
+
});
|
|
89734
|
+
});
|
|
89735
|
+
if (silabas2) correcciones.push(`${silabas2} s\xEDlabas unidas de la letra se marcaron con su guion.`);
|
|
89736
|
+
let tempos = 0;
|
|
89737
|
+
salida = salida.replace(/<metronome\b[^>]*>[\s\S]*?<\/metronome>/g, (met) => {
|
|
89738
|
+
const unidad = /<beat-unit>\s*([\w-]+)\s*<\/beat-unit>/.exec(met)?.[1];
|
|
89739
|
+
const porMinuto = /<per-minute>\s*([\d.]+)\s*<\/per-minute>/.exec(met)?.[1];
|
|
89740
|
+
const negras = unidad ? NEGRAS_POR_FIGURA[unidad] : void 0;
|
|
89741
|
+
if (!unidad || !porMinuto || negras === void 0 || /<beat-unit>[\s\S]*<beat-unit>/.test(met)) return met;
|
|
89742
|
+
const puntillos = (met.match(/<beat-unit-dot\s*\/>/g) ?? []).length;
|
|
89743
|
+
const factor = negras * (puntillos === 0 ? 1 : puntillos === 1 ? 1.5 : 1.75);
|
|
89744
|
+
if (factor === 1) return met;
|
|
89745
|
+
tempos++;
|
|
89746
|
+
const bpm = Math.round(Number.parseFloat(porMinuto) * factor * 100) / 100;
|
|
89747
|
+
return met.replace(/<beat-unit>[\s\S]*?<\/beat-unit>/, "<beat-unit>quarter</beat-unit>").replace(/<beat-unit-dot\s*\/>/g, "").replace(/<per-minute>[\s\S]*?<\/per-minute>/, `<per-minute>${bpm}</per-minute>`);
|
|
89748
|
+
});
|
|
89749
|
+
if (tempos) correcciones.push(`${tempos} indicaciones de tempo se pasaron a negras (mismo pulso).`);
|
|
89750
|
+
return { xml: salida, bytes: new TextEncoder().encode(salida), correcciones };
|
|
89751
|
+
}
|
|
89752
|
+
function compasesDe(parte) {
|
|
89753
|
+
return [...parte.matchAll(/(<measure\b[^>]*>)([\s\S]*?)<\/measure>/g)].map((m) => ({
|
|
89754
|
+
inicio: m.index,
|
|
89755
|
+
fin: m.index + m[0].length,
|
|
89756
|
+
apertura: m[1],
|
|
89757
|
+
contenido: m[2]
|
|
89758
|
+
}));
|
|
89759
|
+
}
|
|
89760
|
+
function rearmar(parte, compases, nuevos) {
|
|
89761
|
+
let salida = "";
|
|
89762
|
+
let cursor = 0;
|
|
89763
|
+
compases.forEach((c, i2) => {
|
|
89764
|
+
salida += parte.slice(cursor, c.inicio) + c.apertura + nuevos[i2] + "</measure>";
|
|
89765
|
+
cursor = c.fin;
|
|
89766
|
+
});
|
|
89767
|
+
return salida + parte.slice(cursor);
|
|
89768
|
+
}
|
|
89769
|
+
function tiempoAl(pedazo) {
|
|
89770
|
+
let t = 0;
|
|
89771
|
+
for (const m of pedazo.matchAll(/<(note|backup|forward)\b[\s\S]*?<\/\1>/g)) {
|
|
89772
|
+
const dur = entero(m[0], /<duration>\s*(\d+)\s*<\/duration>/) ?? 0;
|
|
89773
|
+
if (m[1] === "backup") t -= dur;
|
|
89774
|
+
else if (m[1] === "forward") t += dur;
|
|
89775
|
+
else if (!/<chord\s*\/>/.test(m[0]) && !/<grace\b/.test(m[0])) t += dur;
|
|
89776
|
+
}
|
|
89777
|
+
return t;
|
|
89778
|
+
}
|
|
89779
|
+
function moverAtributosDeFinDeCompas(parte) {
|
|
89780
|
+
const compases = compasesDe(parte);
|
|
89781
|
+
let cuantos = 0;
|
|
89782
|
+
let arrastre = "";
|
|
89783
|
+
const nuevos = compases.map((c) => {
|
|
89784
|
+
let contenido = c.contenido;
|
|
89785
|
+
const primeraNota = contenido.search(/<note\b/);
|
|
89786
|
+
if (primeraNota >= 0) {
|
|
89787
|
+
let llevar = "";
|
|
89788
|
+
let alPrincipio = "";
|
|
89789
|
+
const despues = contenido.slice(primeraNota);
|
|
89790
|
+
contenido = contenido.slice(0, primeraNota) + despues.replace(/<attributes\b[^>]*>([\s\S]*?)<\/attributes>/g, (bloque, adentro, donde) => {
|
|
89791
|
+
const hijos = adentro.match(HIJO_QUE_SE_MUEVE);
|
|
89792
|
+
if (!hijos) return bloque;
|
|
89793
|
+
cuantos += hijos.length;
|
|
89794
|
+
if (tiempoAl(despues.slice(0, donde)) <= 0) alPrincipio += hijos.join("");
|
|
89795
|
+
else llevar += hijos.join("");
|
|
89796
|
+
const resto = adentro.replace(HIJO_QUE_SE_MUEVE, "");
|
|
89797
|
+
return resto.trim() ? `<attributes>${resto}</attributes>` : "";
|
|
89798
|
+
});
|
|
89799
|
+
const entra2 = arrastre + alPrincipio;
|
|
89800
|
+
arrastre = llevar;
|
|
89801
|
+
return (entra2 ? `<attributes>${entra2}</attributes>` : "") + contenido;
|
|
89802
|
+
}
|
|
89803
|
+
const entra = arrastre;
|
|
89804
|
+
arrastre = "";
|
|
89805
|
+
return (entra ? `<attributes>${entra}</attributes>` : "") + contenido;
|
|
89806
|
+
});
|
|
89807
|
+
return cuantos ? { texto: rearmar(parte, compases, nuevos), cuantos } : { texto: parte, cuantos: 0 };
|
|
89808
|
+
}
|
|
89809
|
+
function separarAcordesEntrePentagramas(parte) {
|
|
89810
|
+
const compases = compasesDe(parte);
|
|
89811
|
+
let cuantos = 0;
|
|
89812
|
+
const nuevos = compases.map((c) => {
|
|
89813
|
+
const notas = [...c.contenido.matchAll(/<note\b[\s\S]*?<\/note>/g)];
|
|
89814
|
+
if (notas.length < 2) return c.contenido;
|
|
89815
|
+
let salida = "";
|
|
89816
|
+
let cursor = 0;
|
|
89817
|
+
let i2 = 0;
|
|
89818
|
+
while (i2 < notas.length) {
|
|
89819
|
+
const grupo = [notas[i2]];
|
|
89820
|
+
let j = i2 + 1;
|
|
89821
|
+
while (j < notas.length) {
|
|
89822
|
+
const anterior = notas[j - 1];
|
|
89823
|
+
const entre = c.contenido.slice(anterior.index + anterior[0].length, notas[j].index);
|
|
89824
|
+
if (entre.trim() || !/<chord\s*\/>/.test(notas[j][0])) break;
|
|
89825
|
+
grupo.push(notas[j]);
|
|
89826
|
+
j++;
|
|
89827
|
+
}
|
|
89828
|
+
i2 = j;
|
|
89829
|
+
const pent = (n) => entero(n[0], /<staff>\s*(\d+)\s*<\/staff>/) ?? 1;
|
|
89830
|
+
const cabeza = grupo[0];
|
|
89831
|
+
const pentDeCabeza = pent(cabeza);
|
|
89832
|
+
const ajenas = grupo.filter((n) => pent(n) !== pentDeCabeza);
|
|
89833
|
+
const durCabeza = entero(cabeza[0], /<duration>\s*(\d+)\s*<\/duration>/);
|
|
89834
|
+
if (ajenas.length === 0 || /<chord\s*\/>/.test(cabeza[0]) || grupo.some((n) => /<grace\b|<cue\s*\/>/.test(n[0])) || durCabeza === null) {
|
|
89835
|
+
continue;
|
|
89836
|
+
}
|
|
89837
|
+
cuantos += ajenas.length;
|
|
89838
|
+
const propias = grupo.filter((n) => pent(n) === pentDeCabeza).map((n) => n[0]);
|
|
89839
|
+
let texto4 = propias.join("");
|
|
89840
|
+
const porPentagrama = /* @__PURE__ */ new Map();
|
|
89841
|
+
for (const n of ajenas) porPentagrama.set(pent(n), [...porPentagrama.get(pent(n)) ?? [], n[0]]);
|
|
89842
|
+
for (const notasDelPent of porPentagrama.values()) {
|
|
89843
|
+
const primera = notasDelPent[0].replace(/<chord\s*\/>\s*/, "");
|
|
89844
|
+
const durPrimera = entero(primera, /<duration>\s*(\d+)\s*<\/duration>/) ?? durCabeza;
|
|
89845
|
+
texto4 += `<backup><duration>${durCabeza}</duration></backup>` + primera + notasDelPent.slice(1).join("");
|
|
89846
|
+
const delta = durCabeza - durPrimera;
|
|
89847
|
+
if (delta > 0) texto4 += `<forward><duration>${delta}</duration></forward>`;
|
|
89848
|
+
else if (delta < 0) texto4 += `<backup><duration>${-delta}</duration></backup>`;
|
|
89849
|
+
}
|
|
89850
|
+
const ultimo = grupo[grupo.length - 1];
|
|
89851
|
+
salida += c.contenido.slice(cursor, cabeza.index) + texto4;
|
|
89852
|
+
cursor = ultimo.index + ultimo[0].length;
|
|
89853
|
+
}
|
|
89854
|
+
return salida + c.contenido.slice(cursor);
|
|
89855
|
+
});
|
|
89856
|
+
return cuantos ? { texto: rearmar(parte, compases, nuevos), cuantos } : { texto: parte, cuantos: 0 };
|
|
89857
|
+
}
|
|
89858
|
+
function sacarSaltosDeLaIndicacion(parte) {
|
|
89859
|
+
let cuantos = 0;
|
|
89860
|
+
const texto4 = parte.replace(/<direction\b[^>]*>[\s\S]*?<\/direction>/g, (dir, desde, todo) => {
|
|
89861
|
+
const sonido = /<sound\b([^>]*?)\/?>/.exec(dir)?.[1];
|
|
89862
|
+
if (!sonido) return dir;
|
|
89863
|
+
const atributos = ATRIBUTOS_DE_SALTO.map((a) => new RegExp(`\\b${a}="([^"]*)"`).exec(sonido)?.[0]).filter((a) => a !== void 0);
|
|
89864
|
+
if (atributos.length === 0) return dir;
|
|
89865
|
+
const copia = `<sound ${atributos.join(" ")}/>`;
|
|
89866
|
+
if (todo.slice(desde + dir.length).trimStart().startsWith(copia)) return dir;
|
|
89867
|
+
cuantos++;
|
|
89868
|
+
return dir + copia;
|
|
89869
|
+
});
|
|
89870
|
+
return { texto: texto4, cuantos };
|
|
89871
|
+
}
|
|
89872
|
+
function compactarVoces(parte) {
|
|
89873
|
+
const porPentagrama = /* @__PURE__ */ new Map();
|
|
89874
|
+
const pentagramaDeVoz = /* @__PURE__ */ new Map();
|
|
89875
|
+
for (const m of parte.matchAll(/<note\b[\s\S]*?<\/note>/g)) {
|
|
89876
|
+
const voz = entero(m[0], /<voice>\s*(\d+)\s*<\/voice>/);
|
|
89877
|
+
if (voz === null) continue;
|
|
89878
|
+
const pent = entero(m[0], /<staff>\s*(\d+)\s*<\/staff>/) ?? 1;
|
|
89879
|
+
const lista2 = porPentagrama.get(pent) ?? [];
|
|
89880
|
+
if (!lista2.includes(voz)) lista2.push(voz);
|
|
89881
|
+
porPentagrama.set(pent, lista2);
|
|
89882
|
+
if (!pentagramaDeVoz.has(voz)) pentagramaDeVoz.set(voz, pent);
|
|
89883
|
+
}
|
|
89884
|
+
const nueva = /* @__PURE__ */ new Map();
|
|
89885
|
+
let hayCambio = false;
|
|
89886
|
+
for (const [pent, voces] of porPentagrama) {
|
|
89887
|
+
;
|
|
89888
|
+
[...voces].sort((a, b) => a - b).forEach((voz, i2) => {
|
|
89889
|
+
nueva.set(`${pent}|${voz}`, i2 + 1);
|
|
89890
|
+
if (voz !== i2 + 1) hayCambio = true;
|
|
89891
|
+
});
|
|
89892
|
+
}
|
|
89893
|
+
if (!hayCambio) return { texto: parte, cambio: null };
|
|
89894
|
+
const renumerar = (bloque, pentPorOmision) => {
|
|
89895
|
+
const voz = entero(bloque, /<voice>\s*(\d+)\s*<\/voice>/);
|
|
89896
|
+
if (voz === null) return bloque;
|
|
89897
|
+
const pent = entero(bloque, /<staff>\s*(\d+)\s*<\/staff>/) ?? pentPorOmision(voz);
|
|
89898
|
+
const n = nueva.get(`${pent}|${voz}`);
|
|
89899
|
+
return n === void 0 ? bloque : bloque.replace(/<voice>\s*\d+\s*<\/voice>/, `<voice>${n}</voice>`);
|
|
89900
|
+
};
|
|
89901
|
+
const texto4 = parte.replace(/<note\b[\s\S]*?<\/note>/g, (b) => renumerar(b, () => 1)).replace(/<forward\b[\s\S]*?<\/forward>/g, (b) => renumerar(b, (v) => pentagramaDeVoz.get(v) ?? 1));
|
|
89902
|
+
const id2 = /<part\b[^>]*\bid="([^"]*)"/.exec(parte)?.[1] ?? "?";
|
|
89903
|
+
const detalle = [...porPentagrama].map(([p, vs]) => `pentagrama ${p}: voces ${[...vs].sort((a, b) => a - b).join(", ")}`).join("; ");
|
|
89904
|
+
return { texto: texto4, cambio: `Parte ${id2}: las voces se renumeraron por pentagrama (${detalle}).` };
|
|
89905
|
+
}
|
|
89906
|
+
function leerOrtografia(xml) {
|
|
89907
|
+
return leerDelArchivo(xml).ortografia;
|
|
89908
|
+
}
|
|
89909
|
+
function direccionesDeLaIndicacion(bloque) {
|
|
89910
|
+
const sonido = /<sound\b([^>]*?)\/?>/.exec(bloque)?.[1] ?? "";
|
|
89911
|
+
const atributo = (n) => new RegExp(`(?:^|\\s)${n}="([^"]*)"`).exec(sonido)?.[1];
|
|
89912
|
+
const palabras = [...bloque.matchAll(/<words\b[^>]*>([\s\S]*?)<\/words>/g)].map((m) => m[1]).join(" ").trim();
|
|
89913
|
+
const dicho = palabras ? direccionDeLasPalabras(palabras) : null;
|
|
89914
|
+
const salida = /* @__PURE__ */ new Set();
|
|
89915
|
+
const segno = atributo("segno");
|
|
89916
|
+
if (/<segno\b/.test(bloque) || segno !== void 0) salida.add(segno === "segno2" ? "TargetSegnoSegno" : "TargetSegno");
|
|
89917
|
+
const coda = atributo("coda");
|
|
89918
|
+
if (/<coda\b/.test(bloque) || coda !== void 0) salida.add(coda === "coda2" ? "TargetDoubleCoda" : "TargetCoda");
|
|
89919
|
+
if (atributo("fine") !== void 0) salida.add("TargetFine");
|
|
89920
|
+
const tocoda = atributo("tocoda");
|
|
89921
|
+
if (tocoda !== void 0) salida.add(tocoda === "coda2" ? "JumpDaDoubleCoda" : "JumpDaCoda");
|
|
89922
|
+
if (atributo("dacapo") !== void 0) salida.add(dicho?.startsWith("JumpDaCapo") ? dicho : "JumpDaCapo");
|
|
89923
|
+
const dalsegno = atributo("dalsegno");
|
|
89924
|
+
if (dalsegno !== void 0) {
|
|
89925
|
+
const familia = dalsegno === "segno2" ? "JumpDalSegnoSegno" : "JumpDalSegno";
|
|
89926
|
+
const delaFamilia = dicho !== null && dicho.startsWith(familia) && (familia === "JumpDalSegnoSegno" || !dicho.startsWith("JumpDalSegnoSegno"));
|
|
89927
|
+
salida.add(delaFamilia ? dicho : familia);
|
|
89928
|
+
}
|
|
89929
|
+
return [...salida];
|
|
89930
|
+
}
|
|
89931
|
+
function leerDelArchivo(xml) {
|
|
89932
|
+
const ortografia = /* @__PURE__ */ new Map();
|
|
89933
|
+
const bajos = /* @__PURE__ */ new Map();
|
|
89934
|
+
const matices = /* @__PURE__ */ new Map();
|
|
89935
|
+
const saltos = /* @__PURE__ */ new Map();
|
|
89936
|
+
let iParte = -1;
|
|
89937
|
+
for (const parte of xml.matchAll(/<part\b[^>]*>([\s\S]*?)<\/part>/g)) {
|
|
89938
|
+
iParte++;
|
|
89939
|
+
let divisiones = 1;
|
|
89940
|
+
let transposicion = 0;
|
|
89941
|
+
let iCompas = -1;
|
|
89942
|
+
for (const compas of parte[1].matchAll(/<measure\b[^>]*>([\s\S]*?)<\/measure>/g)) {
|
|
89943
|
+
iCompas++;
|
|
89944
|
+
let tic = 0;
|
|
89945
|
+
let ticAnterior = 0;
|
|
89946
|
+
let bajoPendiente = null;
|
|
89947
|
+
for (const el of compas[1].matchAll(/<(note|backup|forward|attributes|harmony|direction)\b[\s\S]*?<\/\1>/g)) {
|
|
89948
|
+
const bloque = el[0];
|
|
89949
|
+
const tipo = el[1];
|
|
89950
|
+
if (tipo === "direction") {
|
|
89951
|
+
if (iParte === 0) {
|
|
89952
|
+
const aca = direccionesDeLaIndicacion(bloque);
|
|
89953
|
+
if (aca.length > 0) saltos.set(iCompas, [.../* @__PURE__ */ new Set([...saltos.get(iCompas) ?? [], ...aca])]);
|
|
89954
|
+
}
|
|
89955
|
+
const nombre = /<dynamics\b[^>]*>\s*<([a-z]+)\s*\/>/.exec(bloque)?.[1];
|
|
89956
|
+
if (nombre) {
|
|
89957
|
+
const pent2 = (entero(bloque, /<staff>\s*(\d+)\s*<\/staff>/) ?? 1) - 1;
|
|
89958
|
+
const clave2 = `${iParte}|${pent2}`;
|
|
89959
|
+
const lista2 = matices.get(clave2) ?? [];
|
|
89960
|
+
lista2.push({ compas: iCompas, tic: Math.round(tic * TICS_POR_NEGRA2 / divisiones), nombre });
|
|
89961
|
+
matices.set(clave2, lista2);
|
|
89962
|
+
}
|
|
88858
89963
|
continue;
|
|
88859
89964
|
}
|
|
88860
89965
|
if (tipo === "attributes") {
|
|
@@ -88911,12 +90016,13 @@ function leerDelArchivo(xml) {
|
|
|
88911
90016
|
}
|
|
88912
90017
|
}
|
|
88913
90018
|
}
|
|
88914
|
-
return { ortografia, bajos, matices };
|
|
90019
|
+
return { ortografia, bajos, matices, saltos };
|
|
88915
90020
|
}
|
|
88916
90021
|
var MODO_DE_ALTERACION, MODO_POR_ALTER, SEMITONOS, TICS_POR_NEGRA2, entero, HIJO_QUE_SE_MUEVE, ATRIBUTOS_DE_SALTO, NEGRAS_POR_FIGURA;
|
|
88917
90022
|
var init_musicxmlEntrada = __esm({
|
|
88918
90023
|
"packages/io/src/musicxmlEntrada.ts"() {
|
|
88919
90024
|
init_esm();
|
|
90025
|
+
init_musicxml();
|
|
88920
90026
|
MODO_DE_ALTERACION = {
|
|
88921
90027
|
porDefecto: 0,
|
|
88922
90028
|
natural: 2,
|
|
@@ -88969,7 +90075,7 @@ function importarGp(bytes, opciones = {}) {
|
|
|
88969
90075
|
const preparado = prepararMusicXml(xml);
|
|
88970
90076
|
const score = _barrel_exports$1.ScoreLoader.loadScoreFromBytes(preparado.bytes);
|
|
88971
90077
|
const leido = leerDelArchivo(preparado.xml);
|
|
88972
|
-
const resultado = importarScore(score, opciones, { ortografia: leido.ortografia, bajos: leido.bajos, matices: leido.matices });
|
|
90078
|
+
const resultado = importarScore(score, opciones, { ortografia: leido.ortografia, bajos: leido.bajos, matices: leido.matices, saltos: leido.saltos });
|
|
88973
90079
|
resultado.avisos.push(...preparado.correcciones);
|
|
88974
90080
|
return resultado;
|
|
88975
90081
|
}
|
|
@@ -89046,7 +90152,11 @@ function importarScore(score, opciones = {}, datos = {}) {
|
|
|
89046
90152
|
//
|
|
89047
90153
|
// ★ El nombre y no el número, además, porque acá es una LISTA y se lee: un
|
|
89048
90154
|
// `["JumpDalSegnoAlCoda"]` en el documento dice algo; un `[10]` no.
|
|
89049
|
-
|
|
90155
|
+
//
|
|
90156
|
+
// ⛔ (2026-11-11) De un MusicXML mandan las que se leyeron del archivo (`datos.saltos`):
|
|
90157
|
+
// alphaTab 1.8.4 confunde Segno Segno con Segno, Double Coda con Coda, y en un compás
|
|
90158
|
+
// vacío pierde todos los «al Coda» y «al Fine». Ver `LoQueSeLeeDelArchivo.saltos`.
|
|
90159
|
+
direcciones: datos.saltos?.get(maestro.index) ? [...datos.saltos.get(maestro.index)] : maestro.directions ? [...saltosEscritos.precisos.get(maestro.index) ?? maestro.directions].map(
|
|
89050
90160
|
(d) => _barrel_exports$4.Direction[d] ?? String(d)
|
|
89051
90161
|
) : []
|
|
89052
90162
|
}))
|
|
@@ -89309,7 +90419,12 @@ function importarScore(score, opciones = {}, datos = {}) {
|
|
|
89309
90419
|
);
|
|
89310
90420
|
}
|
|
89311
90421
|
const audioEmbebido = importarAudioYSync(score, documento, idsDeCompasMaestro, avisos);
|
|
89312
|
-
|
|
90422
|
+
const manosJuntadas = juntarManosDelPiano(documento);
|
|
90423
|
+
if (manosJuntadas > 0)
|
|
90424
|
+
avisos.push(
|
|
90425
|
+
manosJuntadas === 1 ? "El piano ven\xEDa con una pista por mano: se junt\xF3 en un solo instrumento, con su llave." : `${manosJuntadas} pianos ven\xEDan con una pista por mano: se juntaron, cada uno con su llave.`
|
|
90426
|
+
);
|
|
90427
|
+
return { documento, avisos, manosJuntadas, ...audioEmbebido ? { audioEmbebido } : {} };
|
|
89313
90428
|
}
|
|
89314
90429
|
function importarAudioYSync(score, documento, idsDeCompasMaestro, avisos) {
|
|
89315
90430
|
const puntos = score.exportFlatSyncPoints();
|
|
@@ -89426,13 +90541,15 @@ function ortografiaDe(ortografia, parte, pentagrama, compas, tic, nota) {
|
|
|
89426
90541
|
const base = `${parte}|${pentagrama}|${compas}|${tic}|`;
|
|
89427
90542
|
return ortografia.get(base + nota.calculateRealValue(false, false)) ?? ortografia.get(base + (nota.octave * 12 + nota.tone));
|
|
89428
90543
|
}
|
|
89429
|
-
var SALIDA_DE_ID_GP, PARIENTE_GM, DIR, SALTO_POR_TEXTO
|
|
90544
|
+
var SALIDA_DE_ID_GP, PARIENTE_GM, DIR, SALTO_POR_TEXTO;
|
|
89430
90545
|
var init_importarGp = __esm({
|
|
89431
90546
|
"packages/io/src/importarGp.ts"() {
|
|
89432
90547
|
init_alphaTab();
|
|
89433
90548
|
init_src2();
|
|
89434
90549
|
init_src2();
|
|
90550
|
+
init_manosDelPiano();
|
|
89435
90551
|
init_musicxmlEntrada();
|
|
90552
|
+
init_musicxml();
|
|
89436
90553
|
SALIDA_DE_ID_GP = {
|
|
89437
90554
|
31: 40,
|
|
89438
90555
|
83: 53,
|
|
@@ -89497,6 +90614,7 @@ var init_importarGp = __esm({
|
|
|
89497
90614
|
dsalfine: [DIR.JumpDalSegno, DIR.JumpDalSegnoAlFine],
|
|
89498
90615
|
dssalcoda: [DIR.JumpDalSegno, DIR.JumpDalSegnoSegnoAlCoda],
|
|
89499
90616
|
dssalfine: [DIR.JumpDalSegno, DIR.JumpDalSegnoSegnoAlFine],
|
|
90617
|
+
dssalcoda2: [DIR.JumpDalSegno, DIR.JumpDalSegnoSegnoAlDoubleCoda],
|
|
89500
90618
|
dss: [DIR.JumpDalSegno, DIR.JumpDalSegnoSegno],
|
|
89501
90619
|
dcalcoda: [DIR.JumpDaCapo, DIR.JumpDaCapoAlCoda],
|
|
89502
90620
|
dcalcoda2: [DIR.JumpDaCapo, DIR.JumpDaCapoAlDoubleCoda],
|
|
@@ -89507,644 +90625,1581 @@ var init_importarGp = __esm({
|
|
|
89507
90625
|
tocoda2: [DIR.JumpDaCoda, DIR.JumpDaDoubleCoda],
|
|
89508
90626
|
fine: [DIR.TargetFine, DIR.TargetFine]
|
|
89509
90627
|
};
|
|
89510
|
-
claveDeSalto = (texto4) => texto4.toLowerCase().replace(/dals*segno/g, "ds").replace(/das*capo/g, "dc").replace(/[^a-z0-9]/g, "");
|
|
89511
90628
|
}
|
|
89512
90629
|
});
|
|
89513
90630
|
|
|
89514
|
-
// packages/io/src/
|
|
89515
|
-
function
|
|
89516
|
-
|
|
89517
|
-
|
|
89518
|
-
|
|
89519
|
-
|
|
89520
|
-
|
|
89521
|
-
|
|
89522
|
-
|
|
89523
|
-
|
|
89524
|
-
|
|
89525
|
-
|
|
89526
|
-
|
|
89527
|
-
for (const pista of documento.pistas.values()) {
|
|
89528
|
-
const pentagramas = pista.get("pentagramas");
|
|
89529
|
-
if (typeof pentagramas === "number" && pentagramas > 1) return 5;
|
|
89530
|
-
}
|
|
89531
|
-
return 4;
|
|
90631
|
+
// packages/io/src/importarMidi.ts
|
|
90632
|
+
function esMidi(bytes) {
|
|
90633
|
+
return firmaEn(bytes, 0, "MThd") || firmaEn(bytes, 0, "RIFF") && firmaEn(bytes, 8, "RMID");
|
|
90634
|
+
}
|
|
90635
|
+
function importarMidi(bytes, opciones = {}) {
|
|
90636
|
+
const smf = leerSmf(bytes);
|
|
90637
|
+
const avisos = new Avisos();
|
|
90638
|
+
const leido = recolectar(smf, avisos);
|
|
90639
|
+
const score = armarScore(leido, opciones, avisos);
|
|
90640
|
+
const resultado = importarScore(score, opciones);
|
|
90641
|
+
resultado.avisos = resultado.avisos.filter((a) => !a.startsWith("Las preferencias de dibujo del archivo"));
|
|
90642
|
+
resultado.avisos.push(...avisos.lista());
|
|
90643
|
+
return resultado;
|
|
89532
90644
|
}
|
|
89533
|
-
function
|
|
89534
|
-
|
|
89535
|
-
|
|
89536
|
-
|
|
89537
|
-
|
|
89538
|
-
|
|
89539
|
-
|
|
89540
|
-
|
|
89541
|
-
|
|
89542
|
-
|
|
89543
|
-
|
|
90645
|
+
function firmaEn(bytes, desde, firma) {
|
|
90646
|
+
if (bytes.length < desde + firma.length) return false;
|
|
90647
|
+
for (let i2 = 0; i2 < firma.length; i2++) if (bytes[desde + i2] !== firma.charCodeAt(i2)) return false;
|
|
90648
|
+
return true;
|
|
90649
|
+
}
|
|
90650
|
+
function desenvolverRmid(bytes) {
|
|
90651
|
+
if (!(firmaEn(bytes, 0, "RIFF") && firmaEn(bytes, 8, "RMID"))) return bytes;
|
|
90652
|
+
const vista = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
90653
|
+
let pos = 12;
|
|
90654
|
+
while (pos + 8 <= bytes.length) {
|
|
90655
|
+
const largo = vista.getUint32(pos + 4, true);
|
|
90656
|
+
if (firmaEn(bytes, pos, "data")) {
|
|
90657
|
+
if (pos + 8 + largo > bytes.length) throw truncado("el bloque \xABdata\xBB del RMID");
|
|
90658
|
+
return bytes.subarray(pos + 8, pos + 8 + largo);
|
|
90659
|
+
}
|
|
90660
|
+
pos += 8 + largo + largo % 2;
|
|
90661
|
+
}
|
|
90662
|
+
throw new MidiIlegible("El archivo RMID no tiene adentro un bloque de datos MIDI.");
|
|
90663
|
+
}
|
|
90664
|
+
function leerSmf(entrada) {
|
|
90665
|
+
const bytes = desenvolverRmid(entrada);
|
|
90666
|
+
if (!firmaEn(bytes, 0, "MThd")) {
|
|
90667
|
+
throw new MidiIlegible("El archivo no es un MIDI: no empieza con la firma \xABMThd\xBB.");
|
|
90668
|
+
}
|
|
90669
|
+
if (bytes.length < 14) throw truncado("la cabecera");
|
|
90670
|
+
const vista = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
90671
|
+
const largoDeCabecera = vista.getUint32(4);
|
|
90672
|
+
if (largoDeCabecera < 6) throw new MidiIlegible("La cabecera del MIDI es m\xE1s corta de lo que manda el formato.");
|
|
90673
|
+
if (8 + largoDeCabecera > bytes.length) throw truncado("la cabecera");
|
|
90674
|
+
const formato = vista.getUint16(8);
|
|
90675
|
+
const declaradas = vista.getUint16(10);
|
|
90676
|
+
const division = vista.getUint16(12);
|
|
90677
|
+
let smpte = null;
|
|
90678
|
+
if (division & 32768) {
|
|
90679
|
+
const cuadros = -(division >> 8 << 24 >> 24);
|
|
90680
|
+
smpte = { cuadrosPorSegundo: cuadros === 29 ? 29.97 : cuadros, ticsPorCuadro: division & 255 };
|
|
90681
|
+
if (smpte.cuadrosPorSegundo <= 0 || smpte.ticsPorCuadro === 0) {
|
|
90682
|
+
throw new MidiIlegible("La cabecera del MIDI declara una divisi\xF3n de tiempo imposible.");
|
|
90683
|
+
}
|
|
90684
|
+
} else if (division === 0) {
|
|
90685
|
+
throw new MidiIlegible("La cabecera del MIDI declara 0 tics por negra.");
|
|
90686
|
+
}
|
|
90687
|
+
const pistas = [];
|
|
90688
|
+
let pos = 8 + largoDeCabecera;
|
|
90689
|
+
while (pistas.length < declaradas) {
|
|
90690
|
+
if (pos + 8 > bytes.length) {
|
|
90691
|
+
throw truncado(`la cabecera anuncia ${declaradas} pista(s) y s\xF3lo hay ${pistas.length}`);
|
|
90692
|
+
}
|
|
90693
|
+
const largo = vista.getUint32(pos + 4);
|
|
90694
|
+
const esPista = firmaEn(bytes, pos, "MTrk");
|
|
90695
|
+
pos += 8;
|
|
90696
|
+
if (pos + largo > bytes.length) throw truncado(`la pista ${pistas.length + 1}`);
|
|
90697
|
+
if (esPista) pistas.push(leerPista(bytes.subarray(pos, pos + largo), pistas.length + 1));
|
|
90698
|
+
pos += largo;
|
|
90699
|
+
}
|
|
90700
|
+
return { formato, division, smpte, pistas };
|
|
90701
|
+
}
|
|
90702
|
+
function leerPista(datos, numero2) {
|
|
90703
|
+
let p = 0;
|
|
90704
|
+
let tic = 0;
|
|
90705
|
+
let estado = 0;
|
|
90706
|
+
const eventos = [];
|
|
90707
|
+
const byte = () => {
|
|
90708
|
+
if (p >= datos.length) throw truncado(`un evento a medias en la pista ${numero2}`);
|
|
90709
|
+
return datos[p++];
|
|
89544
90710
|
};
|
|
89545
|
-
const
|
|
89546
|
-
|
|
89547
|
-
|
|
90711
|
+
const largoVariable = () => {
|
|
90712
|
+
let valor = 0;
|
|
90713
|
+
for (let i2 = 0; i2 < 4; i2++) {
|
|
90714
|
+
const b = byte();
|
|
90715
|
+
valor = valor * 128 + (b & 127);
|
|
90716
|
+
if (!(b & 128)) return valor;
|
|
90717
|
+
}
|
|
90718
|
+
throw new MidiIlegible(`La pista ${numero2} trae un n\xFAmero de m\xE1s de 4 bytes: el archivo est\xE1 da\xF1ado.`);
|
|
89548
90719
|
};
|
|
89549
|
-
|
|
89550
|
-
|
|
89551
|
-
|
|
89552
|
-
|
|
89553
|
-
|
|
90720
|
+
const tomar = (n) => {
|
|
90721
|
+
if (p + n > datos.length) throw truncado(`un evento a medias en la pista ${numero2}`);
|
|
90722
|
+
const trozo = datos.subarray(p, p + n);
|
|
90723
|
+
p += n;
|
|
90724
|
+
return trozo;
|
|
90725
|
+
};
|
|
90726
|
+
while (p < datos.length) {
|
|
90727
|
+
tic += largoVariable();
|
|
90728
|
+
let b = byte();
|
|
90729
|
+
if (b === 255) {
|
|
90730
|
+
const meta3 = byte();
|
|
90731
|
+
const contenido = tomar(largoVariable());
|
|
90732
|
+
if (meta3 === 47) break;
|
|
90733
|
+
eventos.push({ tipo: "meta", tic, meta: meta3, datos: contenido });
|
|
90734
|
+
continue;
|
|
90735
|
+
}
|
|
90736
|
+
if (b === 240 || b === 247) {
|
|
90737
|
+
tomar(largoVariable());
|
|
90738
|
+
eventos.push({ tipo: "sysex", tic });
|
|
90739
|
+
continue;
|
|
90740
|
+
}
|
|
90741
|
+
let dato1;
|
|
90742
|
+
if (b < 128) {
|
|
90743
|
+
if (!estado) throw new MidiIlegible(`La pista ${numero2} trae datos sin un evento que los explique: el archivo est\xE1 da\xF1ado.`);
|
|
90744
|
+
dato1 = b;
|
|
90745
|
+
b = estado;
|
|
90746
|
+
} else {
|
|
90747
|
+
if (b >= 240) throw new MidiIlegible(`La pista ${numero2} trae un mensaje de sistema que no puede ir en un archivo (0x${b.toString(16)}).`);
|
|
90748
|
+
estado = b;
|
|
90749
|
+
dato1 = byte();
|
|
90750
|
+
}
|
|
90751
|
+
const canal = b & 15;
|
|
90752
|
+
switch (b & 240) {
|
|
90753
|
+
case 128:
|
|
90754
|
+
byte();
|
|
90755
|
+
eventos.push({ tipo: "nota", tic, canal, altura: dato1 & 127, velocidad: 0 });
|
|
90756
|
+
break;
|
|
90757
|
+
case 144:
|
|
90758
|
+
eventos.push({ tipo: "nota", tic, canal, altura: dato1 & 127, velocidad: byte() & 127 });
|
|
90759
|
+
break;
|
|
90760
|
+
case 160:
|
|
90761
|
+
byte();
|
|
90762
|
+
eventos.push({ tipo: "presion", tic, canal });
|
|
90763
|
+
break;
|
|
90764
|
+
case 176:
|
|
90765
|
+
eventos.push({ tipo: "control", tic, canal, control: dato1, valor: byte() });
|
|
90766
|
+
break;
|
|
90767
|
+
case 192:
|
|
90768
|
+
eventos.push({ tipo: "programa", tic, canal, programa: dato1 & 127 });
|
|
90769
|
+
break;
|
|
90770
|
+
case 208:
|
|
90771
|
+
eventos.push({ tipo: "presion", tic, canal });
|
|
90772
|
+
break;
|
|
90773
|
+
case 224:
|
|
90774
|
+
eventos.push({ tipo: "bend", tic, canal, valor: dato1 | byte() << 7 });
|
|
90775
|
+
break;
|
|
90776
|
+
}
|
|
89554
90777
|
}
|
|
89555
|
-
return
|
|
90778
|
+
return { eventos, fin: tic };
|
|
89556
90779
|
}
|
|
89557
|
-
function
|
|
89558
|
-
let entradas;
|
|
89559
|
-
try {
|
|
89560
|
-
entradas = unzipSync(bytes);
|
|
89561
|
-
} catch {
|
|
89562
|
-
throw new ArchivoIlegible("Esto no parece un archivo .mtabs: no se pudo abrir el contenedor.");
|
|
89563
|
-
}
|
|
89564
|
-
const crudo = entradas[MANIFIESTO];
|
|
89565
|
-
if (!crudo) {
|
|
89566
|
-
throw new ArchivoIlegible(
|
|
89567
|
-
"El archivo no trae su manifiesto, as\xED que no se puede saber ni de qu\xE9 versi\xF3n es."
|
|
89568
|
-
);
|
|
89569
|
-
}
|
|
89570
|
-
let manifiesto;
|
|
90780
|
+
function textoDe(datos) {
|
|
89571
90781
|
try {
|
|
89572
|
-
|
|
90782
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(datos).trim();
|
|
89573
90783
|
} catch {
|
|
89574
|
-
|
|
89575
|
-
}
|
|
89576
|
-
if (!manifiesto || typeof manifiesto !== "object") {
|
|
89577
|
-
throw new ArchivoIlegible("El manifiesto del archivo est\xE1 da\xF1ado.");
|
|
90784
|
+
return new TextDecoder("latin1").decode(datos).trim();
|
|
89578
90785
|
}
|
|
89579
|
-
|
|
89580
|
-
|
|
89581
|
-
|
|
90786
|
+
}
|
|
90787
|
+
function recolectar(smf, avisos) {
|
|
90788
|
+
if (smf.formato === 2) {
|
|
90789
|
+
avisos.decir(
|
|
90790
|
+
"El archivo es MIDI de formato 2 (secuencias independientes): se ley\xF3 como si todas las pistas sonaran a la vez, que es lo que hacen casi todos los programas."
|
|
89582
90791
|
);
|
|
89583
90792
|
}
|
|
89584
|
-
const
|
|
89585
|
-
|
|
89586
|
-
|
|
89587
|
-
|
|
89588
|
-
|
|
89589
|
-
|
|
89590
|
-
|
|
90793
|
+
const temposCrudos = [];
|
|
90794
|
+
for (const pista of smf.pistas)
|
|
90795
|
+
for (const e of pista.eventos)
|
|
90796
|
+
if (e.tipo === "meta" && e.meta === 81 && e.datos.length >= 3) {
|
|
90797
|
+
const us = e.datos[0] << 16 | e.datos[1] << 8 | e.datos[2];
|
|
90798
|
+
if (us > 0) temposCrudos.push({ tic: e.tic, microsegundos: us });
|
|
90799
|
+
}
|
|
90800
|
+
temposCrudos.sort((a, b) => a.tic - b.tic);
|
|
90801
|
+
const reloj = armarReloj(smf, temposCrudos);
|
|
90802
|
+
const tempos = temposCrudos.map((t) => ({
|
|
90803
|
+
tic: reloj(t.tic),
|
|
90804
|
+
// ★ Redondeado a centésimas: 60 000 000 / 428 571 da 140,0002, y ese 0,0002 no lo escribió
|
|
90805
|
+
// nadie — es el redondeo del propio formato, que guarda microsegundos enteros.
|
|
90806
|
+
bpm: Math.round(6e7 / t.microsegundos * 100) / 100
|
|
90807
|
+
}));
|
|
90808
|
+
const metricas = [];
|
|
90809
|
+
const tonalidades = [];
|
|
90810
|
+
const marcadores = [];
|
|
90811
|
+
const nombres = /* @__PURE__ */ new Map();
|
|
90812
|
+
const instrumentos = /* @__PURE__ */ new Map();
|
|
90813
|
+
let letras = 0;
|
|
90814
|
+
let textos = 0;
|
|
90815
|
+
for (const [indice, pista] of smf.pistas.entries()) {
|
|
90816
|
+
for (const e of pista.eventos) {
|
|
90817
|
+
if (e.tipo !== "meta") continue;
|
|
90818
|
+
const tic = reloj(e.tic);
|
|
90819
|
+
switch (e.meta) {
|
|
90820
|
+
case 88:
|
|
90821
|
+
if (e.datos.length >= 2) {
|
|
90822
|
+
const numerador = e.datos[0];
|
|
90823
|
+
const potencia = e.datos[1];
|
|
90824
|
+
const denominador = 2 ** potencia;
|
|
90825
|
+
if (numerador >= 1 && numerador <= 32 && denominador >= 1 && denominador <= 32) {
|
|
90826
|
+
metricas.push({ tic, numerador, denominador });
|
|
90827
|
+
} else {
|
|
90828
|
+
avisos.contar("metrica-imposible");
|
|
90829
|
+
}
|
|
90830
|
+
}
|
|
90831
|
+
break;
|
|
90832
|
+
case 89:
|
|
90833
|
+
if (e.datos.length >= 2) {
|
|
90834
|
+
const alteraciones = e.datos[0] << 24 >> 24;
|
|
90835
|
+
if (alteraciones >= -7 && alteraciones <= 7) tonalidades.push({ tic, alteraciones, menor: e.datos[1] === 1 });
|
|
90836
|
+
}
|
|
90837
|
+
break;
|
|
90838
|
+
case 3:
|
|
90839
|
+
if (!nombres.has(indice)) nombres.set(indice, textoDe(e.datos));
|
|
90840
|
+
break;
|
|
90841
|
+
case 4:
|
|
90842
|
+
if (!instrumentos.has(indice)) instrumentos.set(indice, textoDe(e.datos));
|
|
90843
|
+
break;
|
|
90844
|
+
case 6: {
|
|
90845
|
+
const texto4 = textoDe(e.datos);
|
|
90846
|
+
if (texto4) marcadores.push({ tic, texto: texto4 });
|
|
90847
|
+
break;
|
|
90848
|
+
}
|
|
90849
|
+
case 5:
|
|
90850
|
+
letras++;
|
|
90851
|
+
break;
|
|
90852
|
+
case 1:
|
|
90853
|
+
case 2:
|
|
90854
|
+
case 7:
|
|
90855
|
+
textos++;
|
|
90856
|
+
break;
|
|
90857
|
+
}
|
|
90858
|
+
}
|
|
89591
90859
|
}
|
|
89592
|
-
|
|
89593
|
-
|
|
89594
|
-
|
|
89595
|
-
|
|
89596
|
-
|
|
89597
|
-
|
|
89598
|
-
|
|
90860
|
+
metricas.sort((a, b) => a.tic - b.tic);
|
|
90861
|
+
tonalidades.sort((a, b) => a.tic - b.tic);
|
|
90862
|
+
marcadores.sort((a, b) => a.tic - b.tic);
|
|
90863
|
+
if (avisos.cuantas("metrica-imposible") > 0) {
|
|
90864
|
+
avisos.decir(`${avisos.cuantas("metrica-imposible")} cambio(s) de m\xE9trica con valores imposibles se ignoraron.`);
|
|
90865
|
+
}
|
|
90866
|
+
if (letras > 0) {
|
|
90867
|
+
avisos.decir(`El archivo trae ${letras} s\xEDlaba(s) de letra: todav\xEDa no se importan desde MIDI.`);
|
|
90868
|
+
}
|
|
90869
|
+
if (textos > 0) {
|
|
90870
|
+
avisos.decir(`El archivo trae ${textos} texto(s) sueltos (comentarios, derechos, indicaciones): no se importaron.`);
|
|
90871
|
+
}
|
|
90872
|
+
const porPista = [];
|
|
90873
|
+
const programas = [];
|
|
90874
|
+
const controles = [];
|
|
90875
|
+
let sinCerrar = 0;
|
|
90876
|
+
let pedal = 0;
|
|
90877
|
+
let bends = 0;
|
|
90878
|
+
let presiones = 0;
|
|
90879
|
+
let otrosControles = 0;
|
|
90880
|
+
let sysex = 0;
|
|
90881
|
+
for (const [indice, pista] of smf.pistas.entries()) {
|
|
90882
|
+
const notas = [];
|
|
90883
|
+
const abiertas = /* @__PURE__ */ new Map();
|
|
90884
|
+
for (const e of pista.eventos) {
|
|
90885
|
+
switch (e.tipo) {
|
|
90886
|
+
case "nota": {
|
|
90887
|
+
const clave = e.canal * 128 + e.altura;
|
|
90888
|
+
if (e.velocidad > 0) {
|
|
90889
|
+
const cola = abiertas.get(clave) ?? [];
|
|
90890
|
+
cola.push({ tic: e.tic, velocidad: e.velocidad });
|
|
90891
|
+
abiertas.set(clave, cola);
|
|
90892
|
+
} else {
|
|
90893
|
+
const abierta2 = abiertas.get(clave)?.shift();
|
|
90894
|
+
if (abierta2) notas.push({ ini: reloj(abierta2.tic), fin: reloj(e.tic), altura: e.altura, velocidad: abierta2.velocidad, canal: e.canal });
|
|
90895
|
+
}
|
|
90896
|
+
break;
|
|
90897
|
+
}
|
|
90898
|
+
case "programa":
|
|
90899
|
+
programas.push({ pista: indice, canal: e.canal, tic: e.tic, programa: e.programa });
|
|
90900
|
+
break;
|
|
90901
|
+
case "control":
|
|
90902
|
+
if (e.control === 7 || e.control === 10) controles.push({ pista: indice, canal: e.canal, tic: e.tic, control: e.control, valor: e.valor });
|
|
90903
|
+
else if (e.control === 64) {
|
|
90904
|
+
if (e.valor >= 64) pedal++;
|
|
90905
|
+
} else if (!CONTROLES_QUE_NO_SON_MUSICA.has(e.control) && e.control < 120 && !(e.control === 1 && e.valor === 0) && !(e.control === 11 && e.valor === 127)) otrosControles++;
|
|
90906
|
+
break;
|
|
90907
|
+
case "bend":
|
|
90908
|
+
if (e.valor !== 8192) bends++;
|
|
90909
|
+
break;
|
|
90910
|
+
case "presion":
|
|
90911
|
+
presiones++;
|
|
90912
|
+
break;
|
|
90913
|
+
case "sysex":
|
|
90914
|
+
sysex++;
|
|
90915
|
+
break;
|
|
90916
|
+
}
|
|
89599
90917
|
}
|
|
89600
|
-
|
|
89601
|
-
const
|
|
89602
|
-
|
|
90918
|
+
for (const [clave, cola] of abiertas)
|
|
90919
|
+
for (const abierta2 of cola) {
|
|
90920
|
+
sinCerrar++;
|
|
90921
|
+
notas.push({ ini: reloj(abierta2.tic), fin: reloj(pista.fin), altura: clave % 128, velocidad: abierta2.velocidad, canal: Math.floor(clave / 128) });
|
|
90922
|
+
}
|
|
90923
|
+
porPista.push(notas);
|
|
90924
|
+
}
|
|
90925
|
+
if (sinCerrar > 0) avisos.decir(`${sinCerrar} nota(s) no se apagaban nunca: se cortaron donde termina su pista.`);
|
|
90926
|
+
if (pedal > 0) avisos.decir("El archivo usa el pedal de resonancia: no se importa desde MIDI, y las notas duran lo que dura la tecla apretada.");
|
|
90927
|
+
if (bends > 0) avisos.decir(`El archivo trae ${bends} movimiento(s) de pitch bend (bends, vibratos, glissandos): no se importan.`);
|
|
90928
|
+
if (presiones > 0) avisos.decir(`El archivo trae ${presiones} evento(s) de presi\xF3n (aftertouch): no se importan.`);
|
|
90929
|
+
if (otrosControles > 0) avisos.decir(`El archivo trae ${otrosControles} cambio(s) de controladores (expresi\xF3n, modulaci\xF3n\u2026): no se importan; s\xED el volumen y el paneo iniciales.`);
|
|
90930
|
+
if (sysex > 0) avisos.decir(`El archivo trae ${sysex} mensaje(s) de sistema exclusivo, propios de un sintetizador: no se importan.`);
|
|
90931
|
+
const programaEn = (pista, canal, tic) => {
|
|
90932
|
+
let deLaPista = null;
|
|
90933
|
+
let deCualquiera = null;
|
|
90934
|
+
for (const p of programas) {
|
|
90935
|
+
if (p.canal !== canal || p.tic > tic) continue;
|
|
90936
|
+
if (p.pista === pista) deLaPista = p.programa;
|
|
90937
|
+
else deCualquiera = p.programa;
|
|
90938
|
+
}
|
|
90939
|
+
return deLaPista ?? deCualquiera ?? 0;
|
|
90940
|
+
};
|
|
90941
|
+
const controlInicial = (pista, canal, control, hasta) => {
|
|
90942
|
+
let valor = null;
|
|
90943
|
+
for (const c of controles) {
|
|
90944
|
+
if (c.canal !== canal || c.control !== control || c.tic > hasta) continue;
|
|
90945
|
+
if (c.pista === pista || valor === null) valor = c.valor;
|
|
89603
90946
|
}
|
|
89604
|
-
|
|
89605
|
-
|
|
89606
|
-
|
|
89607
|
-
|
|
89608
|
-
|
|
89609
|
-
|
|
89610
|
-
|
|
89611
|
-
|
|
89612
|
-
|
|
89613
|
-
|
|
89614
|
-
|
|
89615
|
-
|
|
89616
|
-
|
|
89617
|
-
|
|
89618
|
-
|
|
89619
|
-
|
|
89620
|
-
|
|
90947
|
+
return valor;
|
|
90948
|
+
};
|
|
90949
|
+
const grupos = [];
|
|
90950
|
+
for (const [indice, notas] of porPista.entries()) {
|
|
90951
|
+
const porCanal = /* @__PURE__ */ new Map();
|
|
90952
|
+
for (const n of notas) {
|
|
90953
|
+
const lista2 = porCanal.get(n.canal) ?? [];
|
|
90954
|
+
lista2.push(n);
|
|
90955
|
+
porCanal.set(n.canal, lista2);
|
|
90956
|
+
}
|
|
90957
|
+
const deEstaPista = [];
|
|
90958
|
+
for (const canal of [...porCanal.keys()].sort((a, b) => a - b)) {
|
|
90959
|
+
const lista2 = porCanal.get(canal);
|
|
90960
|
+
let ticCrudoDeLaPrimera = Infinity;
|
|
90961
|
+
for (const e of smf.pistas[indice].eventos) {
|
|
90962
|
+
if (e.tipo === "nota" && e.canal === canal && e.velocidad > 0) {
|
|
90963
|
+
ticCrudoDeLaPrimera = e.tic;
|
|
90964
|
+
break;
|
|
90965
|
+
}
|
|
89621
90966
|
}
|
|
89622
|
-
|
|
89623
|
-
|
|
89624
|
-
|
|
89625
|
-
|
|
89626
|
-
|
|
89627
|
-
|
|
89628
|
-
|
|
89629
|
-
|
|
89630
|
-
|
|
89631
|
-
|
|
89632
|
-
|
|
89633
|
-
}
|
|
89634
|
-
|
|
89635
|
-
const octavaAlphaTab = Math.floor(midi / 12);
|
|
89636
|
-
const clase = midi - octavaAlphaTab * 12;
|
|
89637
|
-
const octava = octavaAlphaTab - 1;
|
|
89638
|
-
const pedida = ALTERACION_POR_MODO[modo];
|
|
89639
|
-
if (pedida !== void 0) {
|
|
89640
|
-
const sinAlterar = clase - pedida;
|
|
89641
|
-
const vueltas = Math.floor(sinAlterar / 12);
|
|
89642
|
-
const paso = PASOS.find((p) => p.semitonos === sinAlterar - vueltas * 12);
|
|
89643
|
-
if (paso) return { paso: paso.paso, alteracion: pedida, octava: octava + vueltas };
|
|
89644
|
-
}
|
|
89645
|
-
const natural = PASOS.find((p) => p.semitonos === clase);
|
|
89646
|
-
if (natural) return { paso: natural.paso, alteracion: 0, octava };
|
|
89647
|
-
if (fifths < 0) {
|
|
89648
|
-
const arriba = PASOS.find((p) => p.semitonos === clase + 1);
|
|
89649
|
-
if (arriba) return { paso: arriba.paso, alteracion: -1, octava };
|
|
89650
|
-
}
|
|
89651
|
-
const abajo = PASOS.find((p) => p.semitonos === clase - 1);
|
|
89652
|
-
if (abajo) return { paso: abajo.paso, alteracion: 1, octava };
|
|
89653
|
-
throw new Error(`altura MIDI no representable: ${midi}`);
|
|
89654
|
-
}
|
|
89655
|
-
function claveDelPentagrama(staff, bar) {
|
|
89656
|
-
if (staff.isPercussion) return { signo: "percussion", linea: 2, lineas: 5, conAfinacion: false };
|
|
89657
|
-
if (staff.showTablature && staff.tuning.length > 0)
|
|
89658
|
-
return { signo: "TAB", linea: 5, lineas: staff.tuning.length, conAfinacion: true };
|
|
89659
|
-
switch (bar.clef) {
|
|
89660
|
-
case _barrel_exports$4.Clef.C3:
|
|
89661
|
-
return { signo: "C", linea: 3, lineas: 5, conAfinacion: false };
|
|
89662
|
-
case _barrel_exports$4.Clef.C4:
|
|
89663
|
-
return { signo: "C", linea: 4, lineas: 5, conAfinacion: false };
|
|
89664
|
-
case _barrel_exports$4.Clef.F4:
|
|
89665
|
-
return { signo: "F", linea: 4, lineas: 5, conAfinacion: false };
|
|
89666
|
-
case _barrel_exports$4.Clef.Neutral:
|
|
89667
|
-
return { signo: "percussion", linea: 2, lineas: 5, conAfinacion: false };
|
|
89668
|
-
default:
|
|
89669
|
-
return { signo: "G", linea: 2, lineas: 5, conAfinacion: false };
|
|
89670
|
-
}
|
|
89671
|
-
}
|
|
89672
|
-
function gruposDeTresillo(beats) {
|
|
89673
|
-
const abren = /* @__PURE__ */ new Set();
|
|
89674
|
-
const cierran = /* @__PURE__ */ new Set();
|
|
89675
|
-
let i2 = 0;
|
|
89676
|
-
while (i2 < beats.length) {
|
|
89677
|
-
const b = beats[i2];
|
|
89678
|
-
if (b.tupletNumerator <= 0 || b.tupletDenominator <= 0) {
|
|
89679
|
-
i2++;
|
|
89680
|
-
continue;
|
|
90967
|
+
const esBateria = canal === 9;
|
|
90968
|
+
const programa = esBateria ? 0 : programaEn(indice, canal, ticCrudoDeLaPrimera);
|
|
90969
|
+
const cambia = !esBateria && programas.some((p) => p.canal === canal && p.pista === indice && p.tic > ticCrudoDeLaPrimera && p.programa !== programa);
|
|
90970
|
+
if (cambia) avisos.contar("cambio-de-programa");
|
|
90971
|
+
const existente = smf.formato !== 0 && !esBateria ? deEstaPista.find((g) => !g.esBateria && g.programa === programa) : void 0;
|
|
90972
|
+
const volumen = controlInicial(indice, canal, 7, ticCrudoDeLaPrimera);
|
|
90973
|
+
const paneo = controlInicial(indice, canal, 10, ticCrudoDeLaPrimera);
|
|
90974
|
+
if (existente) {
|
|
90975
|
+
existente.canales.push(canal);
|
|
90976
|
+
existente.notas.push(...lista2);
|
|
90977
|
+
continue;
|
|
90978
|
+
}
|
|
90979
|
+
deEstaPista.push({ pista: indice, canales: [canal], esBateria, programa, nombre: "", volumen, paneo, notas: [...lista2] });
|
|
89681
90980
|
}
|
|
89682
|
-
|
|
89683
|
-
|
|
89684
|
-
|
|
89685
|
-
|
|
89686
|
-
|
|
89687
|
-
|
|
89688
|
-
}
|
|
89689
|
-
return { abren, cierran };
|
|
89690
|
-
}
|
|
89691
|
-
function saltosDelCompas(master) {
|
|
89692
|
-
const s = [];
|
|
89693
|
-
for (const [direccion, salto] of SALTOS) {
|
|
89694
|
-
if (!master?.directions?.has(direccion)) continue;
|
|
89695
|
-
s.push('<direction placement="above">', "<direction-type>");
|
|
89696
|
-
s.push(salto.simbolo ? `<${salto.simbolo}/>` : `<words>${escapar(salto.texto ?? "")}</words>`);
|
|
89697
|
-
s.push("</direction-type>", `<sound ${salto.sonido}/>`, "</direction>");
|
|
90981
|
+
const nombreDeLaPista = smf.formato === 0 ? "" : nombres.get(indice) || instrumentos.get(indice) || "";
|
|
90982
|
+
for (const g of deEstaPista) {
|
|
90983
|
+
const delPrograma = g.esBateria ? "Bater\xEDa" : NOMBRES_GM[g.programa];
|
|
90984
|
+
g.nombre = nombreDeLaPista ? deEstaPista.length > 1 ? `${nombreDeLaPista} (${delPrograma})` : nombreDeLaPista : delPrograma;
|
|
90985
|
+
}
|
|
90986
|
+
grupos.push(...deEstaPista);
|
|
89698
90987
|
}
|
|
89699
|
-
|
|
89700
|
-
|
|
89701
|
-
|
|
89702
|
-
return NOMBRE_DE_LA_FIGURA2.get(duracion) ?? "quarter";
|
|
89703
|
-
}
|
|
89704
|
-
function instrumentosDePercusion(track) {
|
|
89705
|
-
const usadas = /* @__PURE__ */ new Set();
|
|
89706
|
-
for (const staff of track.staves)
|
|
89707
|
-
for (const bar of staff.bars)
|
|
89708
|
-
for (const voice of bar.voices)
|
|
89709
|
-
for (const beat of voice.beats)
|
|
89710
|
-
for (const note of beat.notes)
|
|
89711
|
-
if (note.percussionArticulation >= 0) usadas.add(note.percussionArticulation);
|
|
89712
|
-
const ids = /* @__PURE__ */ new Map();
|
|
89713
|
-
for (const art of [...usadas].sort((a, b) => a - b))
|
|
89714
|
-
ids.set(art, `P${track.index + 1}-I${art + 1}`);
|
|
89715
|
-
return ids;
|
|
89716
|
-
}
|
|
89717
|
-
function posicionDePercusion(staffLine) {
|
|
89718
|
-
const indiceDeB = 6;
|
|
89719
|
-
const bruto = indiceDeB + (5 - staffLine);
|
|
89720
|
-
const paso = PASOS[(bruto % 7 + 7) % 7].paso;
|
|
89721
|
-
return { paso, octava: 4 + Math.floor(bruto / 7) };
|
|
89722
|
-
}
|
|
89723
|
-
function escribirNota(note, beat, staff, opciones) {
|
|
89724
|
-
const s = ["<note>"];
|
|
89725
|
-
const esAdorno = beat.graceType !== _barrel_exports$4.GraceType.None;
|
|
89726
|
-
if (esAdorno) s.push(beat.graceType === _barrel_exports$4.GraceType.BeforeBeat ? "<grace/>" : '<grace slash="yes"/>');
|
|
89727
|
-
if (opciones.esAcorde) s.push("<chord/>");
|
|
89728
|
-
const esGolpeDeKit = staff.isPercussion && note.percussionArticulation >= 0;
|
|
89729
|
-
if (esGolpeDeKit) {
|
|
89730
|
-
const art = staff.track.percussionArticulations[note.percussionArticulation];
|
|
89731
|
-
const { paso, octava } = posicionDePercusion(art?.staffLine ?? 5);
|
|
89732
|
-
s.push("<unpitched>");
|
|
89733
|
-
s.push(`<display-step>${paso}</display-step>`);
|
|
89734
|
-
s.push(`<display-octave>${octava}</display-octave>`);
|
|
89735
|
-
s.push("</unpitched>");
|
|
89736
|
-
} else {
|
|
89737
|
-
const { paso, alteracion, octava } = alturaMusicXml(
|
|
89738
|
-
note.calculateRealValue(false, false),
|
|
89739
|
-
opciones.fifths,
|
|
89740
|
-
note.accidentalMode
|
|
90988
|
+
if (avisos.cuantas("cambio-de-programa") > 0) {
|
|
90989
|
+
avisos.decir(
|
|
90990
|
+
`${avisos.cuantas("cambio-de-programa")} pista(s) cambian de instrumento a mitad de la obra: se us\xF3 el primero. Tabs lleva un instrumento por pista.`
|
|
89741
90991
|
);
|
|
89742
|
-
s.push("<pitch>");
|
|
89743
|
-
s.push(`<step>${paso}</step>`);
|
|
89744
|
-
if (alteracion !== 0) s.push(`<alter>${alteracion}</alter>`);
|
|
89745
|
-
s.push(`<octave>${octava}</octave>`);
|
|
89746
|
-
s.push("</pitch>");
|
|
89747
|
-
}
|
|
89748
|
-
if (!esAdorno) s.push(`<duration>${opciones.duracion}</duration>`);
|
|
89749
|
-
if (note.isTieDestination) s.push('<tie type="stop"/>');
|
|
89750
|
-
if (note.isTieOrigin) s.push('<tie type="start"/>');
|
|
89751
|
-
const idDeInstrumento = opciones.instrumentos.get(note.percussionArticulation);
|
|
89752
|
-
if (esGolpeDeKit && idDeInstrumento) s.push(`<instrument id="${idDeInstrumento}"/>`);
|
|
89753
|
-
s.push(`<voice>${opciones.numeroDeVoz}</voice>`);
|
|
89754
|
-
s.push(...elemento("type", nombreDeFigura(beat.duration)));
|
|
89755
|
-
for (let d = 0; d < beat.dots; d++) s.push("<dot/>");
|
|
89756
|
-
if (beat.tupletNumerator > 0 && beat.tupletDenominator > 0) {
|
|
89757
|
-
s.push("<time-modification>");
|
|
89758
|
-
s.push(`<actual-notes>${beat.tupletNumerator}</actual-notes>`);
|
|
89759
|
-
s.push(`<normal-notes>${beat.tupletDenominator}</normal-notes>`);
|
|
89760
|
-
s.push("</time-modification>");
|
|
89761
|
-
}
|
|
89762
|
-
if (note.isDead) s.push("<notehead>x</notehead>");
|
|
89763
|
-
else if (esGolpeDeKit) {
|
|
89764
|
-
const art = staff.track.percussionArticulations[note.percussionArticulation];
|
|
89765
|
-
if (art?.noteHeadDefault === _barrel_exports$4.MusicFontSymbol.NoteheadXBlack)
|
|
89766
|
-
s.push("<notehead>x</notehead>");
|
|
89767
|
-
} else if (note.isGhost) s.push('<notehead parentheses="yes">normal</notehead>');
|
|
89768
|
-
if (opciones.numeroDePentagrama !== null) s.push(`<staff>${opciones.numeroDePentagrama}</staff>`);
|
|
89769
|
-
const notaciones = [];
|
|
89770
|
-
if (note.isTieDestination) notaciones.push('<tied type="stop"/>');
|
|
89771
|
-
if (note.isTieOrigin) notaciones.push('<tied type="start"/>');
|
|
89772
|
-
if (opciones.abreTresillo) notaciones.push('<tuplet type="start" number="1"/>');
|
|
89773
|
-
if (opciones.cierraTresillo) notaciones.push('<tuplet type="stop" number="1"/>');
|
|
89774
|
-
const tecnica = [];
|
|
89775
|
-
if (note.string > 0 && staff.tuning.length > 0) {
|
|
89776
|
-
tecnica.push(`<string>${staff.tuning.length - note.string + 1}</string>`);
|
|
89777
|
-
tecnica.push(`<fret>${note.fret}</fret>`);
|
|
89778
|
-
}
|
|
89779
|
-
const ligado = (desde, hasta) => hasta >= desde ? "hammer-on" : "pull-off";
|
|
89780
|
-
const origen = note.hammerPullOrigin;
|
|
89781
|
-
if (origen !== null) {
|
|
89782
|
-
const nombre = ligado(origen.fret, note.fret);
|
|
89783
|
-
tecnica.push(`<${nombre} type="stop"/>`);
|
|
89784
|
-
}
|
|
89785
|
-
const destino = note.hammerPullDestination;
|
|
89786
|
-
if (note.isHammerPullOrigin && destino) {
|
|
89787
|
-
const nombre = ligado(note.fret, destino.fret);
|
|
89788
|
-
tecnica.push(`<${nombre} type="start">${nombre === "hammer-on" ? "H" : "P"}</${nombre}>`);
|
|
89789
|
-
}
|
|
89790
|
-
if (note.harmonicType !== _barrel_exports$4.HarmonicType.None) tecnica.push("<harmonic/>");
|
|
89791
|
-
if (beat.isPalmMute) tecnica.push("<other-technical>palm-mute</other-technical>");
|
|
89792
|
-
if (beat.isLetRing) tecnica.push("<other-technical>let-ring</other-technical>");
|
|
89793
|
-
if (tecnica.length > 0) notaciones.push("<technical>", ...tecnica, "</technical>");
|
|
89794
|
-
const articulaciones = [];
|
|
89795
|
-
if (note.accentuated === _barrel_exports$4.AccentuationType.Normal) articulaciones.push("<accent/>");
|
|
89796
|
-
else if (note.accentuated === _barrel_exports$4.AccentuationType.Heavy)
|
|
89797
|
-
articulaciones.push("<strong-accent/>");
|
|
89798
|
-
else if (note.accentuated === _barrel_exports$4.AccentuationType.Tenuto)
|
|
89799
|
-
articulaciones.push("<tenuto/>");
|
|
89800
|
-
if (note.isStaccato) articulaciones.push("<staccato/>");
|
|
89801
|
-
if (articulaciones.length > 0)
|
|
89802
|
-
notaciones.push("<articulations>", ...articulaciones, "</articulations>");
|
|
89803
|
-
if (notaciones.length > 0) s.push("<notations>", ...notaciones, "</notations>");
|
|
89804
|
-
if (!opciones.esAcorde) s.push(...letraDelGolpe(beat));
|
|
89805
|
-
s.push("</note>");
|
|
89806
|
-
return s;
|
|
89807
|
-
}
|
|
89808
|
-
function letraDelGolpe(beat) {
|
|
89809
|
-
if (!beat.lyrics) return [];
|
|
89810
|
-
const s = [];
|
|
89811
|
-
beat.lyrics.forEach((verso, i2) => {
|
|
89812
|
-
if (!verso) return;
|
|
89813
|
-
const sigue = verso.endsWith("-") && verso.length > 1;
|
|
89814
|
-
let anterior = beat.previousBeat;
|
|
89815
|
-
while (anterior && !anterior.lyrics?.[i2]) anterior = anterior.previousBeat;
|
|
89816
|
-
const viene = !!anterior?.lyrics?.[i2]?.endsWith("-");
|
|
89817
|
-
const silabico = sigue ? viene ? "middle" : "begin" : viene ? "end" : "single";
|
|
89818
|
-
s.push(`<lyric number="${i2 + 1}">`);
|
|
89819
|
-
s.push(`<syllabic>${silabico}</syllabic>`);
|
|
89820
|
-
s.push(...elemento("text", sigue ? verso.slice(0, -1) : verso));
|
|
89821
|
-
s.push("</lyric>");
|
|
89822
|
-
});
|
|
89823
|
-
return s;
|
|
89824
|
-
}
|
|
89825
|
-
function escribirSilencio2(beat, duracion, numeroDeVoz, numeroDePentagrama) {
|
|
89826
|
-
const s = ["<note>", "<rest/>", `<duration>${duracion}</duration>`];
|
|
89827
|
-
s.push(`<voice>${numeroDeVoz}</voice>`);
|
|
89828
|
-
s.push(...elemento("type", nombreDeFigura(beat.duration)));
|
|
89829
|
-
for (let d = 0; d < beat.dots; d++) s.push("<dot/>");
|
|
89830
|
-
if (beat.tupletNumerator > 0 && beat.tupletDenominator > 0) {
|
|
89831
|
-
s.push("<time-modification>");
|
|
89832
|
-
s.push(`<actual-notes>${beat.tupletNumerator}</actual-notes>`);
|
|
89833
|
-
s.push(`<normal-notes>${beat.tupletDenominator}</normal-notes>`);
|
|
89834
|
-
s.push("</time-modification>");
|
|
89835
90992
|
}
|
|
89836
|
-
|
|
89837
|
-
|
|
89838
|
-
|
|
89839
|
-
|
|
90993
|
+
const repetidos = /* @__PURE__ */ new Map();
|
|
90994
|
+
for (const g of grupos) repetidos.set(g.nombre, (repetidos.get(g.nombre) ?? 0) + 1);
|
|
90995
|
+
const vistos = /* @__PURE__ */ new Map();
|
|
90996
|
+
for (const g of grupos) {
|
|
90997
|
+
if ((repetidos.get(g.nombre) ?? 0) < 2) continue;
|
|
90998
|
+
const n = (vistos.get(g.nombre) ?? 0) + 1;
|
|
90999
|
+
vistos.set(g.nombre, n);
|
|
91000
|
+
g.nombre = `${g.nombre} ${n}`;
|
|
91001
|
+
}
|
|
91002
|
+
let titulo = "";
|
|
91003
|
+
if (smf.formato === 0) titulo = nombres.get(0) ?? "";
|
|
91004
|
+
else {
|
|
91005
|
+
const director = porPista.findIndex((n, i2) => n.length === 0 && (nombres.get(i2) ?? "") !== "");
|
|
91006
|
+
if (director >= 0) titulo = nombres.get(director) ?? "";
|
|
91007
|
+
}
|
|
91008
|
+
for (const g of grupos) {
|
|
91009
|
+
g.volumen = g.volumen === null ? null : Math.round(g.volumen / 127 * 16);
|
|
91010
|
+
g.paneo = g.paneo === null ? null : Math.round(g.paneo / 127 * 16);
|
|
91011
|
+
}
|
|
91012
|
+
return { titulo, grupos, tempos, metricas, tonalidades, marcadores };
|
|
91013
|
+
}
|
|
91014
|
+
function armarReloj(smf, tempos) {
|
|
91015
|
+
if (!smf.smpte) return (tic) => tic * TICS_POR_NEGRA3 / smf.division;
|
|
91016
|
+
const porSegundo = smf.smpte.cuadrosPorSegundo * smf.smpte.ticsPorCuadro;
|
|
91017
|
+
const puntos = [{ segundo: 0, negras: 0, usPorNegra: 5e5 }];
|
|
91018
|
+
for (const t of tempos) {
|
|
91019
|
+
const anterior = puntos[puntos.length - 1];
|
|
91020
|
+
const segundo = t.tic / porSegundo;
|
|
91021
|
+
const negras = anterior.negras + (segundo - anterior.segundo) * 1e6 / anterior.usPorNegra;
|
|
91022
|
+
if (segundo === anterior.segundo) puntos[puntos.length - 1] = { segundo, negras: anterior.negras, usPorNegra: t.microsegundos };
|
|
91023
|
+
else puntos.push({ segundo, negras, usPorNegra: t.microsegundos });
|
|
91024
|
+
}
|
|
91025
|
+
return (tic) => {
|
|
91026
|
+
const segundo = tic / porSegundo;
|
|
91027
|
+
let punto = puntos[0];
|
|
91028
|
+
for (const p of puntos) if (p.segundo <= segundo) punto = p;
|
|
91029
|
+
return (punto.negras + (segundo - punto.segundo) * 1e6 / punto.usPorNegra) * TICS_POR_NEGRA3;
|
|
91030
|
+
};
|
|
89840
91031
|
}
|
|
89841
|
-
function
|
|
89842
|
-
const
|
|
89843
|
-
|
|
89844
|
-
|
|
89845
|
-
|
|
89846
|
-
|
|
89847
|
-
|
|
89848
|
-
|
|
89849
|
-
|
|
89850
|
-
|
|
89851
|
-
|
|
89852
|
-
|
|
89853
|
-
|
|
89854
|
-
|
|
89855
|
-
l.push("</identification>");
|
|
89856
|
-
const instrumentosPorPista = /* @__PURE__ */ new Map();
|
|
89857
|
-
l.push("<part-list>");
|
|
89858
|
-
for (const track of score.tracks) {
|
|
89859
|
-
const id2 = `P${track.index + 1}`;
|
|
89860
|
-
l.push(`<score-part id="${id2}">`);
|
|
89861
|
-
l.push(...elemento("part-name", track.name || `Pista ${track.index + 1}`));
|
|
89862
|
-
l.push(...elemento("part-abbreviation", track.shortName));
|
|
89863
|
-
const esPercusion = track.staves.some((st) => st.isPercussion);
|
|
89864
|
-
const instrumentos = esPercusion ? instrumentosDePercusion(track) : /* @__PURE__ */ new Map();
|
|
89865
|
-
instrumentosPorPista.set(track.index, instrumentos);
|
|
89866
|
-
if (esPercusion) {
|
|
89867
|
-
for (const [art, idInstrumento] of instrumentos) {
|
|
89868
|
-
const a = track.percussionArticulations[art];
|
|
89869
|
-
l.push(`<score-instrument id="${idInstrumento}">`);
|
|
89870
|
-
l.push(...elemento("instrument-name", `Percusi\xF3n ${art + 1}`));
|
|
89871
|
-
l.push("</score-instrument>");
|
|
89872
|
-
l.push(`<midi-instrument id="${idInstrumento}">`);
|
|
89873
|
-
l.push("<midi-channel>10</midi-channel>");
|
|
89874
|
-
l.push(`<midi-unpitched>${(a?.outputMidiNumber ?? 36) + 1}</midi-unpitched>`);
|
|
89875
|
-
l.push("</midi-instrument>");
|
|
91032
|
+
function armarCompases(leido, hasta, avisos) {
|
|
91033
|
+
const compases = [];
|
|
91034
|
+
let numerador = 4;
|
|
91035
|
+
let denominador = 4;
|
|
91036
|
+
let cursor = 0;
|
|
91037
|
+
let siguiente = 0;
|
|
91038
|
+
let corridos = 0;
|
|
91039
|
+
while (compases.length === 0 || cursor < hasta) {
|
|
91040
|
+
const largo = TICS_POR_NEGRA3 * 4 * numerador / denominador;
|
|
91041
|
+
while (siguiente < leido.metricas.length && leido.metricas[siguiente].tic < cursor + largo - 0.5) {
|
|
91042
|
+
const m = leido.metricas[siguiente];
|
|
91043
|
+
if (m.tic > cursor + 0.5 && (m.numerador !== numerador || m.denominador !== denominador)) {
|
|
91044
|
+
corridos++;
|
|
91045
|
+
break;
|
|
89876
91046
|
}
|
|
89877
|
-
|
|
89878
|
-
|
|
89879
|
-
|
|
89880
|
-
|
|
89881
|
-
|
|
89882
|
-
|
|
89883
|
-
|
|
89884
|
-
|
|
89885
|
-
|
|
89886
|
-
|
|
89887
|
-
|
|
89888
|
-
|
|
89889
|
-
|
|
89890
|
-
|
|
89891
|
-
|
|
89892
|
-
|
|
89893
|
-
|
|
89894
|
-
|
|
89895
|
-
|
|
89896
|
-
|
|
89897
|
-
|
|
89898
|
-
|
|
89899
|
-
|
|
89900
|
-
|
|
89901
|
-
|
|
89902
|
-
|
|
89903
|
-
|
|
89904
|
-
|
|
89905
|
-
|
|
89906
|
-
|
|
89907
|
-
|
|
89908
|
-
|
|
89909
|
-
|
|
89910
|
-
|
|
89911
|
-
const
|
|
89912
|
-
|
|
89913
|
-
|
|
89914
|
-
|
|
89915
|
-
|
|
89916
|
-
|
|
89917
|
-
|
|
89918
|
-
|
|
89919
|
-
|
|
89920
|
-
|
|
89921
|
-
|
|
89922
|
-
|
|
89923
|
-
|
|
89924
|
-
|
|
91047
|
+
numerador = m.numerador;
|
|
91048
|
+
denominador = m.denominador;
|
|
91049
|
+
siguiente++;
|
|
91050
|
+
}
|
|
91051
|
+
const largoFinal = TICS_POR_NEGRA3 * 4 * numerador / denominador;
|
|
91052
|
+
compases.push({ inicio: cursor, fin: cursor + largoFinal, numerador, denominador });
|
|
91053
|
+
cursor += largoFinal;
|
|
91054
|
+
if (siguiente < leido.metricas.length && leido.metricas[siguiente].tic < cursor) {
|
|
91055
|
+
const m = leido.metricas[siguiente];
|
|
91056
|
+
numerador = m.numerador;
|
|
91057
|
+
denominador = m.denominador;
|
|
91058
|
+
siguiente++;
|
|
91059
|
+
}
|
|
91060
|
+
if (compases.length > 2e4) break;
|
|
91061
|
+
}
|
|
91062
|
+
if (corridos > 0) {
|
|
91063
|
+
avisos.decir(`${corridos} cambio(s) de m\xE9trica ca\xEDan a mitad de comp\xE1s: se aplicaron en la barra siguiente.`);
|
|
91064
|
+
}
|
|
91065
|
+
return compases;
|
|
91066
|
+
}
|
|
91067
|
+
function rejillaDe(c) {
|
|
91068
|
+
const figura = c?.rejilla ?? 16;
|
|
91069
|
+
const recta = TICS_POR_NEGRA3 * 4 / figura;
|
|
91070
|
+
const conTresillos = c?.tresillos ?? true;
|
|
91071
|
+
const nombre = figura === 8 ? "la corchea" : figura === 32 ? "la fusa" : "la semicorchea";
|
|
91072
|
+
if (figura === 8 || !conTresillos) return { recta, tresillo: null, nombre, nombreTresillo: "" };
|
|
91073
|
+
return { recta, tresillo: recta * 4 / 3, nombre, nombreTresillo: figura === 32 ? "al tresillo de semicorchea" : "al tresillo de corchea" };
|
|
91074
|
+
}
|
|
91075
|
+
function decidirVentanas(compases, comienzos, rejilla) {
|
|
91076
|
+
const ventanas = [];
|
|
91077
|
+
const ordenados = [...comienzos].sort((a, b) => a - b);
|
|
91078
|
+
let k = 0;
|
|
91079
|
+
for (const compas of compases) {
|
|
91080
|
+
for (let inicio = compas.inicio; inicio < compas.fin - 0.5; inicio += TICS_POR_NEGRA3) {
|
|
91081
|
+
const fin = Math.min(inicio + TICS_POR_NEGRA3, compas.fin);
|
|
91082
|
+
let tresillo = false;
|
|
91083
|
+
if (rejilla.tresillo !== null && fin - inicio === TICS_POR_NEGRA3) {
|
|
91084
|
+
while (k < ordenados.length && ordenados[k] < inicio) k++;
|
|
91085
|
+
let errorRecto = 0;
|
|
91086
|
+
let errorTresillo = 0;
|
|
91087
|
+
let fueraDeLaRecta = false;
|
|
91088
|
+
for (let j = k; j < ordenados.length && ordenados[j] < fin; j++) {
|
|
91089
|
+
const desde = ordenados[j] - inicio;
|
|
91090
|
+
errorRecto += Math.abs(desde - Math.round(desde / rejilla.recta) * rejilla.recta);
|
|
91091
|
+
const enTresillo = Math.round(desde / rejilla.tresillo) * rejilla.tresillo;
|
|
91092
|
+
errorTresillo += Math.abs(desde - enTresillo);
|
|
91093
|
+
if (enTresillo % rejilla.recta !== 0) fueraDeLaRecta = true;
|
|
91094
|
+
}
|
|
91095
|
+
tresillo = fueraDeLaRecta && errorTresillo < errorRecto * 0.5;
|
|
91096
|
+
}
|
|
91097
|
+
ventanas.push({ inicio, fin, paso: tresillo ? rejilla.tresillo : rejilla.recta, tresillo });
|
|
91098
|
+
}
|
|
91099
|
+
}
|
|
91100
|
+
return ventanas;
|
|
91101
|
+
}
|
|
91102
|
+
function ventanaEn(ventanas, tic) {
|
|
91103
|
+
let bajo = 0;
|
|
91104
|
+
let alto = ventanas.length - 1;
|
|
91105
|
+
while (bajo < alto) {
|
|
91106
|
+
const medio = bajo + alto + 1 >> 1;
|
|
91107
|
+
if (ventanas[medio].inicio <= tic) bajo = medio;
|
|
91108
|
+
else alto = medio - 1;
|
|
91109
|
+
}
|
|
91110
|
+
return ventanas[bajo];
|
|
91111
|
+
}
|
|
91112
|
+
function cuantizar(ventanas, tic) {
|
|
91113
|
+
const v = ventanaEn(ventanas, tic);
|
|
91114
|
+
const punto = v.inicio + Math.round((tic - v.inicio) / v.paso) * v.paso;
|
|
91115
|
+
return Math.min(Math.max(punto, v.inicio), v.fin);
|
|
91116
|
+
}
|
|
91117
|
+
function pasoEn(ventanas, tic) {
|
|
91118
|
+
const v = ventanaEn(ventanas, tic);
|
|
91119
|
+
return Math.min(v.paso, v.fin - tic);
|
|
91120
|
+
}
|
|
91121
|
+
function claseDe(g) {
|
|
91122
|
+
if (g.esBateria) return "bateria";
|
|
91123
|
+
if (g.programa >= 24 && g.programa <= 31) return "guitarra";
|
|
91124
|
+
if (g.programa >= 32 && g.programa <= 39) return "bajo";
|
|
91125
|
+
if (g.programa <= 7 || g.programa >= 16 && g.programa <= 20) return "piano";
|
|
91126
|
+
return "altura";
|
|
91127
|
+
}
|
|
91128
|
+
function digitar(alturas, afinacion, ocupadas) {
|
|
91129
|
+
const conOcupadas = mejorDigitacion(alturas, afinacion, ocupadas);
|
|
91130
|
+
const colocadas = (d) => d.filter((c) => c !== null).length;
|
|
91131
|
+
if (ocupadas.size === 0 || colocadas(conOcupadas) === alturas.length) return conOcupadas;
|
|
91132
|
+
const sinOcupadas = mejorDigitacion(alturas, afinacion, /* @__PURE__ */ new Set());
|
|
91133
|
+
return colocadas(sinOcupadas) > colocadas(conOcupadas) ? sinOcupadas : conOcupadas;
|
|
91134
|
+
}
|
|
91135
|
+
function mejorDigitacion(alturas, afinacion, prohibidas) {
|
|
91136
|
+
let mejor = null;
|
|
91137
|
+
const actual = [];
|
|
91138
|
+
const usadas = /* @__PURE__ */ new Set();
|
|
91139
|
+
const probar = (i2, colocadas, maximo, suma) => {
|
|
91140
|
+
if (i2 === alturas.length) {
|
|
91141
|
+
if (!mejor || colocadas > mejor.colocadas || colocadas === mejor.colocadas && (maximo < mejor.maximo || maximo === mejor.maximo && suma < mejor.suma)) {
|
|
91142
|
+
mejor = { cuerdas: [...actual], colocadas, maximo, suma };
|
|
89925
91143
|
}
|
|
89926
|
-
|
|
89927
|
-
|
|
89928
|
-
|
|
89929
|
-
|
|
89930
|
-
|
|
89931
|
-
|
|
91144
|
+
return;
|
|
91145
|
+
}
|
|
91146
|
+
for (let cuerda = 1; cuerda <= afinacion.length; cuerda++) {
|
|
91147
|
+
if (usadas.has(cuerda) || prohibidas.has(cuerda)) continue;
|
|
91148
|
+
const traste = alturas[i2] - afinacion[cuerda - 1];
|
|
91149
|
+
if (traste < 0 || traste > TRASTES) continue;
|
|
91150
|
+
usadas.add(cuerda);
|
|
91151
|
+
actual.push(cuerda);
|
|
91152
|
+
probar(i2 + 1, colocadas + 1, Math.max(maximo, traste), suma + traste);
|
|
91153
|
+
actual.pop();
|
|
91154
|
+
usadas.delete(cuerda);
|
|
91155
|
+
}
|
|
91156
|
+
actual.push(null);
|
|
91157
|
+
probar(i2 + 1, colocadas, maximo, suma);
|
|
91158
|
+
actual.pop();
|
|
91159
|
+
};
|
|
91160
|
+
probar(0, 0, 0, 0);
|
|
91161
|
+
return mejor.cuerdas;
|
|
91162
|
+
}
|
|
91163
|
+
function repartirEnVoces(notas, ventanas, avisos, digitarEn) {
|
|
91164
|
+
const voces = [];
|
|
91165
|
+
const porComienzo = /* @__PURE__ */ new Map();
|
|
91166
|
+
for (const n of notas) {
|
|
91167
|
+
const lista2 = porComienzo.get(n.ini) ?? [];
|
|
91168
|
+
lista2.push(n);
|
|
91169
|
+
porComienzo.set(n.ini, lista2);
|
|
91170
|
+
}
|
|
91171
|
+
for (const ini of [...porComienzo.keys()].sort((a, b) => a - b)) {
|
|
91172
|
+
let juntas = porComienzo.get(ini);
|
|
91173
|
+
const paso = pasoEn(ventanas, ini);
|
|
91174
|
+
if (digitarEn) {
|
|
91175
|
+
const ocupadas = /* @__PURE__ */ new Set();
|
|
91176
|
+
for (const voz of voces) {
|
|
91177
|
+
const ultimo = voz[voz.length - 1];
|
|
91178
|
+
if (ultimo && ultimo.fin > ini) for (const n of ultimo.notas) ocupadas.add(n.cuerda);
|
|
91179
|
+
}
|
|
91180
|
+
juntas = [...juntas].sort((a, b) => b.altura - a.altura);
|
|
91181
|
+
const cuerdas = digitarEn(juntas.map((n) => n.altura), ocupadas);
|
|
91182
|
+
const entran = [];
|
|
91183
|
+
juntas.forEach((n, i2) => {
|
|
91184
|
+
const cuerda = cuerdas[i2];
|
|
91185
|
+
if (cuerda === null || cuerda === void 0) avisos.contar("sin-cuerda");
|
|
91186
|
+
else entran.push({ ...n, cuerda });
|
|
91187
|
+
});
|
|
91188
|
+
juntas = entran;
|
|
91189
|
+
if (juntas.length === 0) continue;
|
|
91190
|
+
}
|
|
91191
|
+
const subgrupos = [];
|
|
91192
|
+
for (const n of [...juntas].sort((a, b) => b.fin - a.fin)) {
|
|
91193
|
+
const cerca = subgrupos.find((s) => Math.abs(s.fin - n.fin) <= paso);
|
|
91194
|
+
if (cerca) {
|
|
91195
|
+
if (cerca.fin !== n.fin) avisos.contar("duracion-ajustada");
|
|
91196
|
+
cerca.notas.push(n);
|
|
91197
|
+
} else subgrupos.push({ fin: n.fin, notas: [n] });
|
|
91198
|
+
}
|
|
91199
|
+
subgrupos.sort((a, b) => Math.max(...b.notas.map((n) => n.altura)) - Math.max(...a.notas.map((n) => n.altura)));
|
|
91200
|
+
for (const s of subgrupos) {
|
|
91201
|
+
const libreDesde = (v) => v[v.length - 1]?.fin ?? 0;
|
|
91202
|
+
let voz = voces.find((v) => libreDesde(v) <= ini);
|
|
91203
|
+
if (!voz) {
|
|
91204
|
+
const recortable = voces.filter((v) => libreDesde(v) - ini <= paso && v[v.length - 1].ini < ini).sort((a, b) => libreDesde(a) - libreDesde(b))[0];
|
|
91205
|
+
if (recortable) {
|
|
91206
|
+
const anterior = recortable[recortable.length - 1];
|
|
91207
|
+
avisos.contar("acortadas", anterior.notas.length);
|
|
91208
|
+
anterior.fin = ini;
|
|
91209
|
+
voz = recortable;
|
|
91210
|
+
}
|
|
91211
|
+
}
|
|
91212
|
+
if (!voz && voces.length < MAXIMO_DE_VOCES) {
|
|
91213
|
+
voz = [];
|
|
91214
|
+
voces.push(voz);
|
|
91215
|
+
}
|
|
91216
|
+
if (!voz) {
|
|
91217
|
+
avisos.contar("sin-voz", s.notas.length);
|
|
91218
|
+
continue;
|
|
89932
91219
|
}
|
|
89933
|
-
|
|
89934
|
-
|
|
89935
|
-
|
|
89936
|
-
|
|
89937
|
-
|
|
89938
|
-
|
|
89939
|
-
|
|
89940
|
-
|
|
89941
|
-
|
|
91220
|
+
voz.push({ ini, fin: s.fin, notas: s.notas.map((n) => ({ ...n, fin: s.fin })) });
|
|
91221
|
+
}
|
|
91222
|
+
}
|
|
91223
|
+
return voces.length > 0 ? voces : [[]];
|
|
91224
|
+
}
|
|
91225
|
+
function figurasQueLlenan(ini, fin, ventana) {
|
|
91226
|
+
const salida = [];
|
|
91227
|
+
let resto = Math.round(fin - ini);
|
|
91228
|
+
const tresillo = ventana.tresillo && !(ini === ventana.inicio && fin === ventana.fin);
|
|
91229
|
+
const catalogo = tresillo ? FIGURAS_DE_TRESILLO : FIGURAS_RECTAS;
|
|
91230
|
+
while (resto > 0) {
|
|
91231
|
+
const f = catalogo.find((c) => c.largo <= resto + 1e-6) ?? FIGURAS_RECTAS[FIGURAS_RECTAS.length - 1];
|
|
91232
|
+
salida.push(f);
|
|
91233
|
+
resto -= f.largo;
|
|
91234
|
+
}
|
|
91235
|
+
return salida;
|
|
91236
|
+
}
|
|
91237
|
+
function juntarPistasDeManos(grupos, avisos) {
|
|
91238
|
+
const salida = [];
|
|
91239
|
+
for (let i2 = 0; i2 < grupos.length; i2++) {
|
|
91240
|
+
const a = grupos[i2];
|
|
91241
|
+
const b = grupos[i2 + 1];
|
|
91242
|
+
const base = b && claseDe(a) === "piano" && claseDe(b) === "piano" ? baseDeLasManos(a.nombre, b.nombre) : null;
|
|
91243
|
+
if (!b || base === null) {
|
|
91244
|
+
salida.push(a);
|
|
91245
|
+
continue;
|
|
91246
|
+
}
|
|
91247
|
+
salida.push({
|
|
91248
|
+
...a,
|
|
91249
|
+
nombre: base,
|
|
91250
|
+
canales: [.../* @__PURE__ */ new Set([...a.canales, ...b.canales])],
|
|
91251
|
+
notas: [...a.notas.map((n) => ({ ...n, mano: 0 })), ...b.notas.map((n) => ({ ...n, mano: 1 }))].sort(
|
|
91252
|
+
(x2, y) => x2.ini - y.ini || x2.altura - y.altura
|
|
91253
|
+
)
|
|
91254
|
+
});
|
|
91255
|
+
avisos.decir(`\xAB${a.nombre}\xBB y \xAB${b.nombre}\xBB son las dos manos de un piano: se abrieron como un solo instrumento.`);
|
|
91256
|
+
i2++;
|
|
91257
|
+
}
|
|
91258
|
+
return salida;
|
|
91259
|
+
}
|
|
91260
|
+
function armarScore(leido, opciones, avisos) {
|
|
91261
|
+
const rejilla = rejillaDe(opciones.cuantizacion);
|
|
91262
|
+
const grupos = juntarPistasDeManos(leido.grupos.filter((g) => g.notas.length > 0), avisos);
|
|
91263
|
+
if (grupos.length === 0) {
|
|
91264
|
+
avisos.decir("El archivo no trae ninguna nota: se abri\xF3 una obra vac\xEDa con un piano.");
|
|
91265
|
+
}
|
|
91266
|
+
const medioPasoMaximo = Math.max(rejilla.recta, rejilla.tresillo ?? 0) / 2;
|
|
91267
|
+
let hasta = 0;
|
|
91268
|
+
for (const g of grupos)
|
|
91269
|
+
for (const n of g.notas) hasta = Math.max(hasta, n.fin, n.ini + medioPasoMaximo + 1);
|
|
91270
|
+
const compases = armarCompases(leido, hasta, avisos);
|
|
91271
|
+
const finDeLaObra2 = compases[compases.length - 1].fin;
|
|
91272
|
+
const compasEn = (tic) => {
|
|
91273
|
+
let i2 = 0;
|
|
91274
|
+
while (i2 + 1 < compases.length && compases[i2 + 1].inicio <= tic) i2++;
|
|
91275
|
+
return i2;
|
|
91276
|
+
};
|
|
91277
|
+
let redondeadas = 0;
|
|
91278
|
+
let hayTresillos = false;
|
|
91279
|
+
const velocidades = /* @__PURE__ */ new Set();
|
|
91280
|
+
const pistas = [];
|
|
91281
|
+
for (const grupo of grupos) {
|
|
91282
|
+
const clase = claseDe(grupo);
|
|
91283
|
+
const ventanas = decidirVentanas(compases, grupo.notas.map((n) => n.ini), rejilla);
|
|
91284
|
+
if (ventanas.some((v) => v.tresillo)) hayTresillos = true;
|
|
91285
|
+
let notas = [];
|
|
91286
|
+
for (const cruda of grupo.notas) {
|
|
91287
|
+
velocidades.add(cruda.velocidad);
|
|
91288
|
+
const ini = Math.min(cuantizar(ventanas, cruda.ini), finDeLaObra2 - pasoEn(ventanas, finDeLaObra2 - 1));
|
|
91289
|
+
let fin = cuantizar(ventanas, cruda.fin);
|
|
91290
|
+
if (fin <= ini) fin = ini + pasoEn(ventanas, ini);
|
|
91291
|
+
if (Math.abs(ini - cruda.ini) > 2) redondeadas++;
|
|
91292
|
+
else if (Math.abs(fin - cruda.fin) > 2 && clase !== "bateria") avisos.contar("duracion-ajustada");
|
|
91293
|
+
notas.push({ ini, fin: Math.min(fin, finDeLaObra2), altura: cruda.altura, cuerda: 0, ...cruda.mano !== void 0 ? { mano: cruda.mano } : {} });
|
|
91294
|
+
}
|
|
91295
|
+
notas.sort((a, b) => a.altura - b.altura || a.ini - b.ini || b.fin - a.fin);
|
|
91296
|
+
const limpias = [];
|
|
91297
|
+
for (const n of notas) {
|
|
91298
|
+
const anterior = limpias[limpias.length - 1];
|
|
91299
|
+
if (anterior && anterior.altura === n.altura && anterior.mano === n.mano) {
|
|
91300
|
+
if (anterior.ini === n.ini) {
|
|
91301
|
+
avisos.contar("repetidas");
|
|
91302
|
+
continue;
|
|
89942
91303
|
}
|
|
89943
|
-
|
|
89944
|
-
|
|
89945
|
-
|
|
89946
|
-
if (clave.conAfinacion)
|
|
89947
|
-
clave.pentagrama.tuning.forEach((midi, i2) => {
|
|
89948
|
-
const linea = clave.pentagrama.tuning.length - i2;
|
|
89949
|
-
const { paso, alteracion, octava } = alturaMusicXml(midi, fifths);
|
|
89950
|
-
cambios.push(`<staff-tuning line="${linea}">`);
|
|
89951
|
-
cambios.push(`<tuning-step>${paso}</tuning-step>`);
|
|
89952
|
-
if (alteracion !== 0) cambios.push(`<tuning-alter>${alteracion}</tuning-alter>`);
|
|
89953
|
-
cambios.push(`<tuning-octave>${octava}</tuning-octave>`);
|
|
89954
|
-
cambios.push("</staff-tuning>");
|
|
89955
|
-
});
|
|
89956
|
-
cambios.push("</staff-details>");
|
|
91304
|
+
if (anterior.fin > n.ini) {
|
|
91305
|
+
anterior.fin = n.ini;
|
|
91306
|
+
avisos.contar("acortadas");
|
|
89957
91307
|
}
|
|
89958
|
-
clavesAnteriores = firmaDeClaves;
|
|
89959
91308
|
}
|
|
89960
|
-
|
|
89961
|
-
|
|
89962
|
-
|
|
89963
|
-
|
|
89964
|
-
|
|
89965
|
-
|
|
89966
|
-
|
|
89967
|
-
|
|
89968
|
-
|
|
89969
|
-
|
|
89970
|
-
|
|
91309
|
+
limpias.push(n);
|
|
91310
|
+
}
|
|
91311
|
+
notas = limpias;
|
|
91312
|
+
const pista = { grupo, clase, ventanas, pentagramas: [], teclasDeBateria: [] };
|
|
91313
|
+
if (clase === "bateria") {
|
|
91314
|
+
pista.teclasDeBateria = [...new Set(notas.map((n) => n.altura))].sort((a, b) => a - b);
|
|
91315
|
+
const porComienzo = /* @__PURE__ */ new Map();
|
|
91316
|
+
for (const n of notas) {
|
|
91317
|
+
const lista2 = porComienzo.get(n.ini) ?? [];
|
|
91318
|
+
lista2.push(n);
|
|
91319
|
+
porComienzo.set(n.ini, lista2);
|
|
89971
91320
|
}
|
|
89972
|
-
|
|
89973
|
-
|
|
89974
|
-
|
|
89975
|
-
|
|
89976
|
-
|
|
89977
|
-
|
|
89978
|
-
|
|
89979
|
-
|
|
89980
|
-
|
|
89981
|
-
const
|
|
89982
|
-
const
|
|
89983
|
-
|
|
89984
|
-
|
|
89985
|
-
|
|
89986
|
-
|
|
89987
|
-
|
|
89988
|
-
l.push(
|
|
89989
|
-
'<direction placement="above">',
|
|
89990
|
-
"<direction-type>",
|
|
89991
|
-
"<metronome>",
|
|
89992
|
-
"<beat-unit>quarter</beat-unit>",
|
|
89993
|
-
`<per-minute>${bpm}</per-minute>`,
|
|
89994
|
-
"</metronome>",
|
|
89995
|
-
"</direction-type>",
|
|
89996
|
-
...offset > 0 ? [`<offset>${offset}</offset>`] : [],
|
|
89997
|
-
`<sound tempo="${bpm}"/>`,
|
|
89998
|
-
"</direction>"
|
|
91321
|
+
const comienzos = [...porComienzo.keys()].sort((a, b) => a - b);
|
|
91322
|
+
const eventos = comienzos.map((ini, i2) => {
|
|
91323
|
+
const finDelCompas = compases[compasEn(ini)].fin;
|
|
91324
|
+
const fin = Math.min(comienzos[i2 + 1] ?? finDelCompas, finDelCompas);
|
|
91325
|
+
return { ini, fin, notas: porComienzo.get(ini).map((n) => ({ ...n, fin })) };
|
|
91326
|
+
});
|
|
91327
|
+
pista.pentagramas.push({ voces: [eventos], clave: _barrel_exports$4.Clef.Neutral });
|
|
91328
|
+
} else if (clase === "guitarra" || clase === "bajo") {
|
|
91329
|
+
const afinacion = clase === "guitarra" ? AFINACION_GUITARRA : AFINACION_BAJO;
|
|
91330
|
+
const grave = afinacion[0];
|
|
91331
|
+
const aguda = afinacion[afinacion.length - 1] + TRASTES;
|
|
91332
|
+
const enRegistro = notas.filter((n) => n.altura >= grave && n.altura <= aguda);
|
|
91333
|
+
const fuera = notas.length - enRegistro.length;
|
|
91334
|
+
if (fuera > 0) {
|
|
91335
|
+
avisos.decir(
|
|
91336
|
+
`Se descartaron ${fuera} nota(s) fuera del registro ${clase === "guitarra" ? "de la guitarra" : "del bajo"} \xAB${grupo.nombre}\xBB (de ${nombreDeAltura(grave)} a ${nombreDeAltura(aguda)} con ${TRASTES} trastes).`
|
|
89999
91337
|
);
|
|
90000
91338
|
}
|
|
90001
|
-
|
|
90002
|
-
|
|
90003
|
-
|
|
90004
|
-
|
|
90005
|
-
|
|
90006
|
-
|
|
90007
|
-
|
|
90008
|
-
|
|
90009
|
-
|
|
90010
|
-
|
|
90011
|
-
|
|
90012
|
-
|
|
90013
|
-
voice.beats.forEach((beat, i2) => {
|
|
90014
|
-
const duracion = beat.displayDuration;
|
|
90015
|
-
if (beat.graceType === _barrel_exports$4.GraceType.None) avance += duracion;
|
|
90016
|
-
if (beat.isRest || beat.notes.length === 0) {
|
|
90017
|
-
l.push(...escribirSilencio2(beat, duracion, indiceDeVoz + 1, numeroDePentagrama));
|
|
90018
|
-
return;
|
|
90019
|
-
}
|
|
90020
|
-
beat.notes.forEach((note, k) => {
|
|
90021
|
-
l.push(
|
|
90022
|
-
...escribirNota(note, beat, pentagrama, {
|
|
90023
|
-
esAcorde: k > 0,
|
|
90024
|
-
fifths,
|
|
90025
|
-
duracion,
|
|
90026
|
-
// ★ La marca de tresillo va en la PRIMERA nota del golpe: es una marca del
|
|
90027
|
-
// golpe, no de cada cuerda que suena en él.
|
|
90028
|
-
abreTresillo: k === 0 && abren.has(i2),
|
|
90029
|
-
cierraTresillo: k === 0 && cierran.has(i2),
|
|
90030
|
-
instrumentos,
|
|
90031
|
-
numeroDeVoz: indiceDeVoz + 1,
|
|
90032
|
-
numeroDePentagrama
|
|
90033
|
-
})
|
|
90034
|
-
);
|
|
90035
|
-
});
|
|
90036
|
-
});
|
|
90037
|
-
ultimoAvance = avance;
|
|
90038
|
-
hayAlgoEscrito = true;
|
|
90039
|
-
});
|
|
91339
|
+
const voces = repartirEnVoces(enRegistro, ventanas, avisos, (alturas, ocupadas) => digitar(alturas, afinacion, ocupadas));
|
|
91340
|
+
pista.pentagramas.push({ voces, clave: clase === "guitarra" ? _barrel_exports$4.Clef.G2 : _barrel_exports$4.Clef.F4 });
|
|
91341
|
+
} else if (clase === "piano") {
|
|
91342
|
+
let derecha;
|
|
91343
|
+
let izquierda;
|
|
91344
|
+
if (notas.some((n) => n.mano !== void 0)) {
|
|
91345
|
+
derecha = notas.filter((n) => n.mano !== 1);
|
|
91346
|
+
izquierda = notas.filter((n) => n.mano === 1);
|
|
91347
|
+
} else {
|
|
91348
|
+
const manos = repartirManos(notas);
|
|
91349
|
+
derecha = manos.derecha.map((i2) => notas[i2]).sort((a, b) => a.ini - b.ini || a.altura - b.altura);
|
|
91350
|
+
izquierda = manos.izquierda.map((i2) => notas[i2]).sort((a, b) => a.ini - b.ini || a.altura - b.altura);
|
|
90040
91351
|
}
|
|
90041
|
-
|
|
90042
|
-
|
|
90043
|
-
|
|
90044
|
-
|
|
90045
|
-
|
|
90046
|
-
|
|
90047
|
-
|
|
90048
|
-
|
|
90049
|
-
|
|
90050
|
-
|
|
91352
|
+
pista.pentagramas.push({ voces: repartirEnVoces(derecha, ventanas, avisos, null), clave: _barrel_exports$4.Clef.G2 });
|
|
91353
|
+
pista.pentagramas.push({ voces: repartirEnVoces(izquierda, ventanas, avisos, null), clave: _barrel_exports$4.Clef.F4 });
|
|
91354
|
+
} else {
|
|
91355
|
+
const ordenadas = notas.map((n) => n.altura).sort((a, b) => a - b);
|
|
91356
|
+
const mediana = ordenadas[Math.floor(ordenadas.length / 2)] ?? 60;
|
|
91357
|
+
pista.pentagramas.push({
|
|
91358
|
+
voces: repartirEnVoces(notas, ventanas, avisos, null),
|
|
91359
|
+
clave: mediana < 55 ? _barrel_exports$4.Clef.F4 : _barrel_exports$4.Clef.G2
|
|
91360
|
+
});
|
|
91361
|
+
}
|
|
91362
|
+
pistas.push(pista);
|
|
91363
|
+
}
|
|
91364
|
+
if (redondeadas > 0) {
|
|
91365
|
+
avisos.decir(
|
|
91366
|
+
`Se redondearon ${redondeadas} nota(s) a ${rejilla.nombre}` + (hayTresillos ? ` o ${rejilla.nombreTresillo}` : "") + ": no ca\xEDan justo en la rejilla."
|
|
91367
|
+
);
|
|
91368
|
+
}
|
|
91369
|
+
if (avisos.cuantas("duracion-ajustada") > 0) {
|
|
91370
|
+
avisos.decir(`Se ajust\xF3 la duraci\xF3n de ${avisos.cuantas("duracion-ajustada")} nota(s) a la rejilla.`);
|
|
91371
|
+
}
|
|
91372
|
+
if (avisos.cuantas("acortadas") > 0) {
|
|
91373
|
+
avisos.decir(`Se acortaron ${avisos.cuantas("acortadas")} nota(s) que se pisaban con la siguiente.`);
|
|
91374
|
+
}
|
|
91375
|
+
if (avisos.cuantas("repetidas") > 0) {
|
|
91376
|
+
avisos.decir(`Se juntaron ${avisos.cuantas("repetidas")} nota(s) repetidas: la misma tecla dos veces en el mismo instante.`);
|
|
91377
|
+
}
|
|
91378
|
+
if (avisos.cuantas("sin-voz") > 0) {
|
|
91379
|
+
avisos.decir(`Se descartaron ${avisos.cuantas("sin-voz")} nota(s) porque sonaban m\xE1s de ${MAXIMO_DE_VOCES} voces a la vez en el mismo pentagrama.`);
|
|
91380
|
+
}
|
|
91381
|
+
if (avisos.cuantas("sin-cuerda") > 0) {
|
|
91382
|
+
avisos.decir(`Se descartaron ${avisos.cuantas("sin-cuerda")} nota(s) que no cab\xEDan en las cuerdas (dos notas en la misma cuerda a la vez).`);
|
|
91383
|
+
}
|
|
91384
|
+
if (velocidades.size > 1) {
|
|
91385
|
+
avisos.decir("La intensidad de cada nota (velocity) no se importa: todas quedan con el mismo matiz.");
|
|
91386
|
+
}
|
|
91387
|
+
const score = new _barrel_exports$4.Score();
|
|
91388
|
+
score.title = leido.titulo || opciones.titulo || "";
|
|
91389
|
+
score.stylesheet.hideDynamics = true;
|
|
91390
|
+
const rejillaDelTempo = pistas[0]?.ventanas ?? decidirVentanas(compases, [], rejilla);
|
|
91391
|
+
const temposPorTic = /* @__PURE__ */ new Map();
|
|
91392
|
+
for (const t of leido.tempos) {
|
|
91393
|
+
const tic = t.tic < finDeLaObra2 ? cuantizar(rejillaDelTempo, t.tic) : finDeLaObra2;
|
|
91394
|
+
if (tic < finDeLaObra2) temposPorTic.set(tic, t.bpm);
|
|
91395
|
+
}
|
|
91396
|
+
if (!temposPorTic.has(0)) temposPorTic.set(0, leido.tempos.find((t) => t.tic <= 0)?.bpm ?? 120);
|
|
91397
|
+
const cambiosDeTempo = [];
|
|
91398
|
+
for (const tic of [...temposPorTic.keys()].sort((a, b) => a - b)) {
|
|
91399
|
+
const bpm = temposPorTic.get(tic);
|
|
91400
|
+
if (cambiosDeTempo.length > 0 && cambiosDeTempo[cambiosDeTempo.length - 1].bpm === bpm) continue;
|
|
91401
|
+
cambiosDeTempo.push({ tic, bpm });
|
|
91402
|
+
}
|
|
91403
|
+
const tonalidadPorCompas = [];
|
|
91404
|
+
{
|
|
91405
|
+
let vigente = { alteraciones: 0, menor: false };
|
|
91406
|
+
let j = 0;
|
|
91407
|
+
let corridas = 0;
|
|
91408
|
+
for (const compas of compases) {
|
|
91409
|
+
while (j < leido.tonalidades.length && leido.tonalidades[j].tic < compas.fin - 0.5) {
|
|
91410
|
+
const t = leido.tonalidades[j];
|
|
91411
|
+
if (t.tic > compas.inicio + 0.5 && t.alteraciones !== vigente.alteraciones) {
|
|
91412
|
+
corridas++;
|
|
91413
|
+
break;
|
|
91414
|
+
}
|
|
91415
|
+
vigente = { alteraciones: t.alteraciones, menor: t.menor };
|
|
91416
|
+
j++;
|
|
90051
91417
|
}
|
|
90052
|
-
|
|
91418
|
+
tonalidadPorCompas.push(vigente);
|
|
90053
91419
|
}
|
|
90054
|
-
|
|
91420
|
+
if (corridas > 0) avisos.decir(`${corridas} cambio(s) de armadura ca\xEDan a mitad de comp\xE1s: se escribieron en la barra siguiente.`);
|
|
90055
91421
|
}
|
|
90056
|
-
|
|
90057
|
-
|
|
91422
|
+
const seccionPorCompas = /* @__PURE__ */ new Map();
|
|
91423
|
+
let marcadoresDeMas = 0;
|
|
91424
|
+
for (const m of leido.marcadores) {
|
|
91425
|
+
const i2 = compasEn(m.tic);
|
|
91426
|
+
if (seccionPorCompas.has(i2)) marcadoresDeMas++;
|
|
91427
|
+
else seccionPorCompas.set(i2, m.texto);
|
|
91428
|
+
}
|
|
91429
|
+
if (marcadoresDeMas > 0) avisos.decir(`${marcadoresDeMas} marcador(es) ca\xEDan en un comp\xE1s que ya ten\xEDa uno: se guard\xF3 el primero.`);
|
|
91430
|
+
for (const [i2, compas] of compases.entries()) {
|
|
91431
|
+
const maestro = new _barrel_exports$4.MasterBar();
|
|
91432
|
+
maestro.timeSignatureNumerator = compas.numerador;
|
|
91433
|
+
maestro.timeSignatureDenominator = compas.denominador;
|
|
91434
|
+
const seccion = seccionPorCompas.get(i2);
|
|
91435
|
+
if (seccion) {
|
|
91436
|
+
maestro.section = new _barrel_exports$4.Section();
|
|
91437
|
+
maestro.section.text = seccion;
|
|
91438
|
+
maestro.section.marker = "";
|
|
91439
|
+
}
|
|
91440
|
+
for (const cambio of cambiosDeTempo) {
|
|
91441
|
+
if (cambio.tic < compas.inicio || cambio.tic >= compas.fin) continue;
|
|
91442
|
+
const automatizacion = new _barrel_exports$4.Automation();
|
|
91443
|
+
automatizacion.isLinear = false;
|
|
91444
|
+
automatizacion.type = _barrel_exports$4.AutomationType.Tempo;
|
|
91445
|
+
automatizacion.value = cambio.bpm;
|
|
91446
|
+
automatizacion.ratioPosition = (cambio.tic - compas.inicio) / (compas.fin - compas.inicio);
|
|
91447
|
+
maestro.tempoAutomations.push(automatizacion);
|
|
91448
|
+
}
|
|
91449
|
+
score.addMasterBar(maestro);
|
|
91450
|
+
}
|
|
91451
|
+
if (pistas.length === 0) {
|
|
91452
|
+
pistas.push({
|
|
91453
|
+
grupo: { pista: 0, canales: [0], esBateria: false, programa: 0, nombre: NOMBRES_GM[0], volumen: null, paneo: null, notas: [] },
|
|
91454
|
+
clase: "piano",
|
|
91455
|
+
ventanas: decidirVentanas(compases, [], rejilla),
|
|
91456
|
+
pentagramas: [{ voces: [[]], clave: _barrel_exports$4.Clef.G2 }, { voces: [[]], clave: _barrel_exports$4.Clef.F4 }],
|
|
91457
|
+
teclasDeBateria: []
|
|
91458
|
+
});
|
|
91459
|
+
}
|
|
91460
|
+
const cortesDeTempo = cambiosDeTempo.map((c) => c.tic).filter((t) => t > 0);
|
|
91461
|
+
const piezasQueFaltan = /* @__PURE__ */ new Map();
|
|
91462
|
+
for (const [indiceDePista, pista] of pistas.entries()) {
|
|
91463
|
+
const track = new _barrel_exports$4.Track();
|
|
91464
|
+
track.name = pista.grupo.nombre;
|
|
91465
|
+
track.shortName = pista.clase === "bateria" ? "bat" : NOMBRES_CORTOS_GM[Math.floor(pista.grupo.programa / 8)];
|
|
91466
|
+
track.playbackInfo.program = pista.grupo.programa;
|
|
91467
|
+
track.playbackInfo.volume = pista.grupo.volumen ?? 16;
|
|
91468
|
+
track.playbackInfo.balance = pista.grupo.paneo ?? 8;
|
|
91469
|
+
const canal = pista.clase === "bateria" ? 9 : pista.grupo.canales[0];
|
|
91470
|
+
track.playbackInfo.primaryChannel = canal;
|
|
91471
|
+
track.playbackInfo.secondaryChannel = canal;
|
|
91472
|
+
score.addTrack(track);
|
|
91473
|
+
const indiceDeTecla = /* @__PURE__ */ new Map();
|
|
91474
|
+
if (pista.clase === "bateria") {
|
|
91475
|
+
track.percussionArticulations = pista.teclasDeBateria.map((tecla, indice) => {
|
|
91476
|
+
const art = new _barrel_exports$4.InstrumentArticulation();
|
|
91477
|
+
art.elementType = `midi ${tecla}`;
|
|
91478
|
+
art.id = indice;
|
|
91479
|
+
art.outputMidiNumber = tecla;
|
|
91480
|
+
indiceDeTecla.set(tecla, indice);
|
|
91481
|
+
return art;
|
|
91482
|
+
});
|
|
91483
|
+
for (const [tecla, indice] of indiceDeTecla) {
|
|
91484
|
+
const pieza = piezaDeBateria(track, indice);
|
|
91485
|
+
const art = track.percussionArticulations[indice];
|
|
91486
|
+
if (pieza === null) {
|
|
91487
|
+
indiceDeTecla.delete(tecla);
|
|
91488
|
+
continue;
|
|
91489
|
+
}
|
|
91490
|
+
const delKit = KIT[pieza];
|
|
91491
|
+
art.staffLine = delKit.linea;
|
|
91492
|
+
art.noteHeadDefault = delKit.cabeza === "x" ? _barrel_exports$4.MusicFontSymbol.NoteheadXBlack : _barrel_exports$4.MusicFontSymbol.NoteheadBlack;
|
|
91493
|
+
art.noteHeadHalf = art.noteHeadDefault;
|
|
91494
|
+
art.noteHeadWhole = art.noteHeadDefault;
|
|
91495
|
+
}
|
|
91496
|
+
for (const voz of pista.pentagramas[0].voces)
|
|
91497
|
+
for (const evento of voz) {
|
|
91498
|
+
const quedan = evento.notas.filter((n) => indiceDeTecla.has(n.altura));
|
|
91499
|
+
for (const n of evento.notas)
|
|
91500
|
+
if (!indiceDeTecla.has(n.altura)) piezasQueFaltan.set(n.altura, (piezasQueFaltan.get(n.altura) ?? 0) + 1);
|
|
91501
|
+
evento.notas = quedan;
|
|
91502
|
+
}
|
|
91503
|
+
}
|
|
91504
|
+
for (const [numeroDePentagrama, datos] of pista.pentagramas.entries()) {
|
|
91505
|
+
const staff = new _barrel_exports$4.Staff();
|
|
91506
|
+
const esDeTrastes = pista.clase === "guitarra" || pista.clase === "bajo";
|
|
91507
|
+
const afinacion = pista.clase === "guitarra" ? AFINACION_GUITARRA : pista.clase === "bajo" ? AFINACION_BAJO : [];
|
|
91508
|
+
const descendente = [...afinacion].reverse();
|
|
91509
|
+
staff.stringTuning = _barrel_exports$4.Tuning.findTuning(descendente) ?? new _barrel_exports$4.Tuning("", descendente, false);
|
|
91510
|
+
staff.showTablature = esDeTrastes;
|
|
91511
|
+
staff.showStandardNotation = true;
|
|
91512
|
+
staff.isPercussion = pista.clase === "bateria";
|
|
91513
|
+
if (esDeTrastes) staff.displayTranspositionPitch = -12;
|
|
91514
|
+
track.addStaff(staff);
|
|
91515
|
+
const cortesDeEstaVoz0 = indiceDePista === 0 && numeroDePentagrama === 0 ? cortesDeTempo : [];
|
|
91516
|
+
const cortesDeTresillo = [];
|
|
91517
|
+
for (const v of pista.ventanas) if (v.tresillo) cortesDeTresillo.push(v.inicio, v.fin);
|
|
91518
|
+
for (const [indiceDeCompas2, compas] of compases.entries()) {
|
|
91519
|
+
const bar = new _barrel_exports$4.Bar();
|
|
91520
|
+
staff.addBar(bar);
|
|
91521
|
+
bar.clef = datos.clave;
|
|
91522
|
+
bar.clefOttava = _barrel_exports$4.Ottavia.Regular;
|
|
91523
|
+
if (!staff.isPercussion) {
|
|
91524
|
+
bar.keySignature = tonalidadPorCompas[indiceDeCompas2].alteraciones;
|
|
91525
|
+
bar.keySignatureType = tonalidadPorCompas[indiceDeCompas2].menor ? _barrel_exports$4.KeySignatureType.Minor : _barrel_exports$4.KeySignatureType.Major;
|
|
91526
|
+
}
|
|
91527
|
+
for (const [indiceDeVoz, eventos] of datos.voces.entries()) {
|
|
91528
|
+
const voice = new _barrel_exports$4.Voice();
|
|
91529
|
+
bar.addVoice(voice);
|
|
91530
|
+
llenarVoz(voice, eventos, compas, indiceDeVoz, pista, cortesDeTresillo, indiceDeVoz === 0 ? cortesDeEstaVoz0 : [], indiceDeTecla);
|
|
91531
|
+
}
|
|
91532
|
+
}
|
|
91533
|
+
}
|
|
91534
|
+
}
|
|
91535
|
+
if (piezasQueFaltan.size > 0) {
|
|
91536
|
+
const total = [...piezasQueFaltan.values()].reduce((a, b) => a + b, 0);
|
|
91537
|
+
avisos.decir(
|
|
91538
|
+
`Se descartaron ${total} golpe(s) de bater\xEDa de piezas que el kit de Tabs todav\xEDa no tiene (notas MIDI ${[...piezasQueFaltan.keys()].sort((a, b) => a - b).join(", ")}).`
|
|
91539
|
+
);
|
|
91540
|
+
}
|
|
91541
|
+
score.finish(new Settings());
|
|
91542
|
+
return score;
|
|
90058
91543
|
}
|
|
90059
|
-
function
|
|
90060
|
-
const
|
|
90061
|
-
|
|
90062
|
-
|
|
90063
|
-
|
|
90064
|
-
|
|
90065
|
-
|
|
90066
|
-
|
|
90067
|
-
|
|
91544
|
+
function llenarVoz(voice, eventos, compas, indiceDeVoz, pista, cortesDeTresillo, cortesForzados, indiceDeTecla) {
|
|
91545
|
+
const tramos = [];
|
|
91546
|
+
for (const e of eventos) {
|
|
91547
|
+
if (e.fin <= compas.inicio || e.ini >= compas.fin) continue;
|
|
91548
|
+
if (e.notas.length === 0) continue;
|
|
91549
|
+
tramos.push({
|
|
91550
|
+
ini: Math.max(e.ini, compas.inicio),
|
|
91551
|
+
fin: Math.min(e.fin, compas.fin),
|
|
91552
|
+
notas: e.notas,
|
|
91553
|
+
// ★ Empezó en un compás anterior: lo de acá es la continuación, ligada.
|
|
91554
|
+
continua: e.ini < compas.inicio
|
|
91555
|
+
});
|
|
91556
|
+
}
|
|
91557
|
+
if (tramos.length === 0 && indiceDeVoz > 0) {
|
|
91558
|
+
const vacio = new _barrel_exports$4.Beat();
|
|
91559
|
+
vacio.isEmpty = true;
|
|
91560
|
+
voice.addBeat(vacio);
|
|
91561
|
+
return;
|
|
91562
|
+
}
|
|
91563
|
+
const conSilencios = [];
|
|
91564
|
+
let cursor = compas.inicio;
|
|
91565
|
+
for (const t of tramos) {
|
|
91566
|
+
if (t.ini > cursor) conSilencios.push({ ini: cursor, fin: t.ini, notas: null, continua: false });
|
|
91567
|
+
conSilencios.push(t);
|
|
91568
|
+
cursor = t.fin;
|
|
91569
|
+
}
|
|
91570
|
+
if (cursor < compas.fin) conSilencios.push({ ini: cursor, fin: compas.fin, notas: null, continua: false });
|
|
91571
|
+
const cortes = [...cortesDeTresillo, ...cortesForzados].filter((c) => c > compas.inicio && c < compas.fin);
|
|
91572
|
+
for (const tramo of conSilencios) {
|
|
91573
|
+
const puntos = [tramo.ini, ...cortes.filter((c) => c > tramo.ini && c < tramo.fin).sort((a, b) => a - b), tramo.fin];
|
|
91574
|
+
let primera = true;
|
|
91575
|
+
for (let k = 0; k + 1 < puntos.length; k++) {
|
|
91576
|
+
const desde = puntos[k];
|
|
91577
|
+
const hastaTic = puntos[k + 1];
|
|
91578
|
+
if (hastaTic - desde < 0.5) continue;
|
|
91579
|
+
const ventana = ventanaEn(pista.ventanas, desde);
|
|
91580
|
+
for (const figura of figurasQueLlenan(desde, hastaTic, ventana)) {
|
|
91581
|
+
const beat = new _barrel_exports$4.Beat();
|
|
91582
|
+
beat.duration = figura.valor;
|
|
91583
|
+
beat.dots = figura.puntillos;
|
|
91584
|
+
if (figura.tresillo) {
|
|
91585
|
+
beat.tupletNumerator = 3;
|
|
91586
|
+
beat.tupletDenominator = 2;
|
|
91587
|
+
}
|
|
91588
|
+
for (const n of tramo.notas ?? []) {
|
|
91589
|
+
const note = new _barrel_exports$4.Note();
|
|
91590
|
+
if (pista.clase === "bateria") {
|
|
91591
|
+
note.percussionArticulation = indiceDeTecla.get(n.altura);
|
|
91592
|
+
} else if (pista.clase === "guitarra" || pista.clase === "bajo") {
|
|
91593
|
+
const afinacion = pista.clase === "guitarra" ? AFINACION_GUITARRA : AFINACION_BAJO;
|
|
91594
|
+
note.string = n.cuerda;
|
|
91595
|
+
note.fret = n.altura - afinacion[n.cuerda - 1];
|
|
91596
|
+
} else {
|
|
91597
|
+
note.octave = Math.floor(n.altura / 12);
|
|
91598
|
+
note.tone = n.altura % 12;
|
|
91599
|
+
}
|
|
91600
|
+
note.isTieDestination = pista.clase !== "bateria" && (!primera || tramo.continua);
|
|
91601
|
+
beat.addNote(note);
|
|
91602
|
+
}
|
|
91603
|
+
voice.addBeat(beat);
|
|
91604
|
+
primera = false;
|
|
91605
|
+
}
|
|
91606
|
+
}
|
|
90068
91607
|
}
|
|
90069
|
-
return salida.join("\n") + "\n";
|
|
90070
91608
|
}
|
|
90071
|
-
function
|
|
90072
|
-
|
|
90073
|
-
const contenedor = `<?xml version="1.0" encoding="UTF-8"?>
|
|
90074
|
-
<container>
|
|
90075
|
-
<rootfiles>
|
|
90076
|
-
<rootfile full-path="partitura.musicxml" media-type="application/vnd.recordare.musicxml+xml"/>
|
|
90077
|
-
</rootfiles>
|
|
90078
|
-
</container>
|
|
90079
|
-
`;
|
|
90080
|
-
const codificador = new TextEncoder();
|
|
90081
|
-
return zipSync(
|
|
90082
|
-
{
|
|
90083
|
-
"META-INF/container.xml": [codificador.encode(contenedor), { level: 0 }],
|
|
90084
|
-
"partitura.musicxml": codificador.encode(xml)
|
|
90085
|
-
},
|
|
90086
|
-
// ⚠️ Fecha FIJA, no la de hoy: dos exportaciones iguales tienen que dar dos archivos
|
|
90087
|
-
// iguales byte a byte, o no hay prueba que pueda compararlos ni `diff` de git que
|
|
90088
|
-
// sirva. El porqué del valor concreto está en la constante — se tardó dos rojos en
|
|
90089
|
-
// encontrarlo, y ninguno de los dos era el que yo esperaba.
|
|
90090
|
-
{ mtime: FECHA_FIJA_DEL_ZIP }
|
|
90091
|
-
);
|
|
91609
|
+
function nombreDeAltura(altura) {
|
|
91610
|
+
return `${NOMBRES_DE_NOTA2[altura % 12]}${Math.floor(altura / 12) - 1}`;
|
|
90092
91611
|
}
|
|
90093
|
-
var
|
|
90094
|
-
var
|
|
90095
|
-
"packages/io/src/
|
|
91612
|
+
var MidiIlegible, truncado, TICS_POR_NEGRA3, Avisos, CONTROLES_QUE_NO_SON_MUSICA, AFINACION_GUITARRA, AFINACION_BAJO, TRASTES, MAXIMO_DE_VOCES, FIGURAS_RECTAS, FIGURAS_DE_TRESILLO, NOMBRES_DE_NOTA2, NOMBRES_GM, NOMBRES_CORTOS_GM;
|
|
91613
|
+
var init_importarMidi = __esm({
|
|
91614
|
+
"packages/io/src/importarMidi.ts"() {
|
|
90096
91615
|
init_alphaTab();
|
|
90097
|
-
|
|
90098
|
-
|
|
90099
|
-
|
|
90100
|
-
|
|
90101
|
-
{
|
|
90102
|
-
|
|
90103
|
-
|
|
90104
|
-
|
|
90105
|
-
|
|
90106
|
-
|
|
90107
|
-
|
|
91616
|
+
init_src2();
|
|
91617
|
+
init_manosDelPiano();
|
|
91618
|
+
init_importarGp();
|
|
91619
|
+
MidiIlegible = class extends Error {
|
|
91620
|
+
constructor(mensaje) {
|
|
91621
|
+
super(mensaje);
|
|
91622
|
+
this.name = "MidiIlegible";
|
|
91623
|
+
}
|
|
91624
|
+
};
|
|
91625
|
+
truncado = (donde) => new MidiIlegible(`El archivo MIDI est\xE1 cortado o da\xF1ado (${donde}). Puede que no se haya terminado de descargar.`);
|
|
91626
|
+
TICS_POR_NEGRA3 = 960;
|
|
91627
|
+
Avisos = class {
|
|
91628
|
+
cuentas = /* @__PURE__ */ new Map();
|
|
91629
|
+
sueltos = [];
|
|
91630
|
+
contar(clave, cuantas = 1) {
|
|
91631
|
+
this.cuentas.set(clave, (this.cuentas.get(clave) ?? 0) + cuantas);
|
|
91632
|
+
}
|
|
91633
|
+
cuantas(clave) {
|
|
91634
|
+
return this.cuentas.get(clave) ?? 0;
|
|
91635
|
+
}
|
|
91636
|
+
decir(texto4) {
|
|
91637
|
+
if (!this.sueltos.includes(texto4)) this.sueltos.push(texto4);
|
|
91638
|
+
}
|
|
91639
|
+
lista() {
|
|
91640
|
+
return this.sueltos;
|
|
91641
|
+
}
|
|
91642
|
+
};
|
|
91643
|
+
CONTROLES_QUE_NO_SON_MUSICA = /* @__PURE__ */ new Set([0, 32, 6, 38, 96, 97, 98, 99, 100, 101]);
|
|
91644
|
+
AFINACION_GUITARRA = [40, 45, 50, 55, 59, 64];
|
|
91645
|
+
AFINACION_BAJO = [28, 33, 38, 43];
|
|
91646
|
+
TRASTES = 24;
|
|
91647
|
+
MAXIMO_DE_VOCES = 4;
|
|
91648
|
+
FIGURAS_RECTAS = [
|
|
91649
|
+
[1, 0],
|
|
91650
|
+
[2, 1],
|
|
91651
|
+
[2, 0],
|
|
91652
|
+
[4, 1],
|
|
91653
|
+
[4, 0],
|
|
91654
|
+
[8, 1],
|
|
91655
|
+
[8, 0],
|
|
91656
|
+
[16, 1],
|
|
91657
|
+
[16, 0],
|
|
91658
|
+
[32, 1],
|
|
91659
|
+
[32, 0],
|
|
91660
|
+
[64, 1],
|
|
91661
|
+
[64, 0],
|
|
91662
|
+
[128, 0]
|
|
91663
|
+
].map(([valor, puntillos]) => {
|
|
91664
|
+
const base = TICS_POR_NEGRA3 * 4 / valor;
|
|
91665
|
+
return { valor, puntillos, tresillo: false, largo: puntillos ? base * 1.5 : base };
|
|
91666
|
+
});
|
|
91667
|
+
FIGURAS_DE_TRESILLO = [4, 8, 16, 32].map((valor) => ({
|
|
91668
|
+
valor,
|
|
91669
|
+
puntillos: 0,
|
|
91670
|
+
tresillo: true,
|
|
91671
|
+
largo: TICS_POR_NEGRA3 * 4 / valor * (2 / 3)
|
|
91672
|
+
}));
|
|
91673
|
+
NOMBRES_DE_NOTA2 = ["do", "do\u266F", "re", "re\u266F", "mi", "fa", "fa\u266F", "sol", "sol\u266F", "la", "la\u266F", "si"];
|
|
91674
|
+
NOMBRES_GM = [
|
|
91675
|
+
// Pianos
|
|
91676
|
+
"Piano de cola",
|
|
91677
|
+
"Piano brillante",
|
|
91678
|
+
"Piano el\xE9ctrico de cola",
|
|
91679
|
+
"Piano de cantina",
|
|
91680
|
+
"Piano el\xE9ctrico",
|
|
91681
|
+
"Piano el\xE9ctrico 2",
|
|
91682
|
+
"Clavec\xEDn",
|
|
91683
|
+
"Clavinet",
|
|
91684
|
+
// Percusión afinada
|
|
91685
|
+
"Celesta",
|
|
91686
|
+
"Glockenspiel",
|
|
91687
|
+
"Caja de m\xFAsica",
|
|
91688
|
+
"Vibr\xE1fono",
|
|
91689
|
+
"Marimba",
|
|
91690
|
+
"Xil\xF3fono",
|
|
91691
|
+
"Campanas tubulares",
|
|
91692
|
+
"Dulc\xE9mele",
|
|
91693
|
+
// Órganos
|
|
91694
|
+
"\xD3rgano Hammond",
|
|
91695
|
+
"\xD3rgano percusivo",
|
|
91696
|
+
"\xD3rgano de rock",
|
|
91697
|
+
"\xD3rgano de iglesia",
|
|
91698
|
+
"Armonio",
|
|
91699
|
+
"Acorde\xF3n",
|
|
91700
|
+
"Arm\xF3nica",
|
|
91701
|
+
"Bandone\xF3n",
|
|
91702
|
+
// Guitarras
|
|
91703
|
+
"Guitarra de nailon",
|
|
91704
|
+
"Guitarra ac\xFAstica",
|
|
91705
|
+
"Guitarra el\xE9ctrica de jazz",
|
|
91706
|
+
"Guitarra el\xE9ctrica limpia",
|
|
91707
|
+
"Guitarra el\xE9ctrica apagada",
|
|
91708
|
+
"Guitarra saturada",
|
|
91709
|
+
"Guitarra distorsionada",
|
|
91710
|
+
"Arm\xF3nicos de guitarra",
|
|
91711
|
+
// Bajos
|
|
91712
|
+
"Bajo ac\xFAstico",
|
|
91713
|
+
"Bajo el\xE9ctrico",
|
|
91714
|
+
"Bajo con p\xFAa",
|
|
91715
|
+
"Bajo sin trastes",
|
|
91716
|
+
"Bajo slap",
|
|
91717
|
+
"Bajo slap 2",
|
|
91718
|
+
"Bajo sintetizado",
|
|
91719
|
+
"Bajo sintetizado 2",
|
|
91720
|
+
// Cuerdas
|
|
91721
|
+
"Viol\xEDn",
|
|
91722
|
+
"Viola",
|
|
91723
|
+
"Violonchelo",
|
|
91724
|
+
"Contrabajo",
|
|
91725
|
+
"Cuerdas en tr\xE9molo",
|
|
91726
|
+
"Cuerdas en pizzicato",
|
|
91727
|
+
"Arpa",
|
|
91728
|
+
"Timbales",
|
|
91729
|
+
// Conjuntos
|
|
91730
|
+
"Cuerdas",
|
|
91731
|
+
"Cuerdas 2",
|
|
91732
|
+
"Cuerdas sintetizadas",
|
|
91733
|
+
"Cuerdas sintetizadas 2",
|
|
91734
|
+
"Coro",
|
|
91735
|
+
"Voz",
|
|
91736
|
+
"Voz sintetizada",
|
|
91737
|
+
"Golpe de orquesta",
|
|
91738
|
+
// Metales
|
|
91739
|
+
"Trompeta",
|
|
91740
|
+
"Tromb\xF3n",
|
|
91741
|
+
"Tuba",
|
|
91742
|
+
"Trompeta con sordina",
|
|
91743
|
+
"Corno franc\xE9s",
|
|
91744
|
+
"Secci\xF3n de metales",
|
|
91745
|
+
"Metales sintetizados",
|
|
91746
|
+
"Metales sintetizados 2",
|
|
91747
|
+
// Lengüetas
|
|
91748
|
+
"Saxo soprano",
|
|
91749
|
+
"Saxo alto",
|
|
91750
|
+
"Saxo tenor",
|
|
91751
|
+
"Saxo bar\xEDtono",
|
|
91752
|
+
"Oboe",
|
|
91753
|
+
"Corno ingl\xE9s",
|
|
91754
|
+
"Fagot",
|
|
91755
|
+
"Clarinete",
|
|
91756
|
+
// Flautas
|
|
91757
|
+
"Flaut\xEDn",
|
|
91758
|
+
"Flauta",
|
|
91759
|
+
"Flauta dulce",
|
|
91760
|
+
"Flauta de pan",
|
|
91761
|
+
"Botella soplada",
|
|
91762
|
+
"Shakuhachi",
|
|
91763
|
+
"Silbido",
|
|
91764
|
+
"Ocarina",
|
|
91765
|
+
// Sintetizador solista
|
|
91766
|
+
"Sintetizador (cuadrada)",
|
|
91767
|
+
"Sintetizador (sierra)",
|
|
91768
|
+
"Sintetizador (cal\xEDope)",
|
|
91769
|
+
"Sintetizador (chiff)",
|
|
91770
|
+
"Sintetizador (charango)",
|
|
91771
|
+
"Sintetizador (voz)",
|
|
91772
|
+
"Sintetizador (quintas)",
|
|
91773
|
+
"Sintetizador (bajo y melod\xEDa)",
|
|
91774
|
+
// Colchones
|
|
91775
|
+
"Colch\xF3n new age",
|
|
91776
|
+
"Colch\xF3n c\xE1lido",
|
|
91777
|
+
"Colch\xF3n polif\xF3nico",
|
|
91778
|
+
"Colch\xF3n de coro",
|
|
91779
|
+
"Colch\xF3n de arco",
|
|
91780
|
+
"Colch\xF3n met\xE1lico",
|
|
91781
|
+
"Colch\xF3n halo",
|
|
91782
|
+
"Colch\xF3n de barrido",
|
|
91783
|
+
// Efectos de sintetizador
|
|
91784
|
+
"Efecto lluvia",
|
|
91785
|
+
"Efecto banda sonora",
|
|
91786
|
+
"Efecto cristal",
|
|
91787
|
+
"Efecto atm\xF3sfera",
|
|
91788
|
+
"Efecto brillo",
|
|
91789
|
+
"Efecto duendes",
|
|
91790
|
+
"Efecto ecos",
|
|
91791
|
+
"Efecto ciencia ficci\xF3n",
|
|
91792
|
+
// Étnicos
|
|
91793
|
+
"Sitar",
|
|
91794
|
+
"Banjo",
|
|
91795
|
+
"Shamisen",
|
|
91796
|
+
"Koto",
|
|
91797
|
+
"Kalimba",
|
|
91798
|
+
"Gaita",
|
|
91799
|
+
"Viol\xEDn folcl\xF3rico",
|
|
91800
|
+
"Shehnai",
|
|
91801
|
+
// Percusivos
|
|
91802
|
+
"Campanillas",
|
|
91803
|
+
"Agog\xF3",
|
|
91804
|
+
"Steel drum",
|
|
91805
|
+
"Caja china",
|
|
91806
|
+
"Taiko",
|
|
91807
|
+
"Tom mel\xF3dico",
|
|
91808
|
+
"Tambor sintetizado",
|
|
91809
|
+
"Platillo al rev\xE9s",
|
|
91810
|
+
// Efectos de sonido
|
|
91811
|
+
"Ruido de traste",
|
|
91812
|
+
"Respiraci\xF3n",
|
|
91813
|
+
"Olas",
|
|
91814
|
+
"P\xE1jaros",
|
|
91815
|
+
"Tel\xE9fono",
|
|
91816
|
+
"Helic\xF3ptero",
|
|
91817
|
+
"Aplausos",
|
|
91818
|
+
"Disparo"
|
|
90108
91819
|
];
|
|
90109
|
-
|
|
90110
|
-
|
|
90111
|
-
|
|
90112
|
-
|
|
90113
|
-
|
|
90114
|
-
|
|
90115
|
-
|
|
90116
|
-
|
|
90117
|
-
|
|
90118
|
-
|
|
90119
|
-
|
|
90120
|
-
|
|
90121
|
-
|
|
90122
|
-
|
|
90123
|
-
|
|
90124
|
-
|
|
90125
|
-
|
|
90126
|
-
[D.TargetSegnoSegno, { simbolo: "segno", sonido: 'segno="segno2"' }],
|
|
90127
|
-
[D.TargetCoda, { simbolo: "coda", sonido: 'coda="coda"' }],
|
|
90128
|
-
[D.TargetDoubleCoda, { simbolo: "coda", sonido: 'coda="coda2"' }],
|
|
90129
|
-
[D.TargetFine, { texto: "Fine", sonido: 'fine="yes"' }],
|
|
90130
|
-
[D.JumpDaCapo, { texto: "D.C.", sonido: 'dacapo="yes"' }],
|
|
90131
|
-
[D.JumpDaCapoAlCoda, { texto: "D.C. al Coda", sonido: 'dacapo="yes"' }],
|
|
90132
|
-
[D.JumpDaCapoAlDoubleCoda, { texto: "D.C. al Coda 2", sonido: 'dacapo="yes"' }],
|
|
90133
|
-
[D.JumpDaCapoAlFine, { texto: "D.C. al Fine", sonido: 'dacapo="yes"' }],
|
|
90134
|
-
[D.JumpDalSegno, { texto: "D.S.", sonido: 'dalsegno="segno"' }],
|
|
90135
|
-
[D.JumpDalSegnoAlCoda, { texto: "D.S. al Coda", sonido: 'dalsegno="segno"' }],
|
|
90136
|
-
[D.JumpDalSegnoAlDoubleCoda, { texto: "D.S. al Coda 2", sonido: 'dalsegno="segno"' }],
|
|
90137
|
-
[D.JumpDalSegnoAlFine, { texto: "D.S. al Fine", sonido: 'dalsegno="segno"' }],
|
|
90138
|
-
[D.JumpDalSegnoSegno, { texto: "D.S.S.", sonido: 'dalsegno="segno2"' }],
|
|
90139
|
-
[D.JumpDalSegnoSegnoAlCoda, { texto: "D.S.S. al Coda", sonido: 'dalsegno="segno2"' }],
|
|
90140
|
-
[D.JumpDalSegnoSegnoAlDoubleCoda, { texto: "D.S.S. al Coda 2", sonido: 'dalsegno="segno2"' }],
|
|
90141
|
-
[D.JumpDalSegnoSegnoAlFine, { texto: "D.S.S. al Fine", sonido: 'dalsegno="segno2"' }],
|
|
90142
|
-
[D.JumpDaCoda, { texto: "To Coda", sonido: 'tocoda="coda"' }],
|
|
90143
|
-
[D.JumpDaDoubleCoda, { texto: "To Coda 2", sonido: 'tocoda="coda2"' }]
|
|
91820
|
+
NOMBRES_CORTOS_GM = [
|
|
91821
|
+
"pno",
|
|
91822
|
+
"perc",
|
|
91823
|
+
"\xF3rg",
|
|
91824
|
+
"gtr",
|
|
91825
|
+
"bajo",
|
|
91826
|
+
"cuer",
|
|
91827
|
+
"cuer",
|
|
91828
|
+
"met",
|
|
91829
|
+
"saxo",
|
|
91830
|
+
"fl",
|
|
91831
|
+
"sint",
|
|
91832
|
+
"sint",
|
|
91833
|
+
"sint",
|
|
91834
|
+
"\xE9tn",
|
|
91835
|
+
"perc",
|
|
91836
|
+
"efec"
|
|
90144
91837
|
];
|
|
90145
91838
|
}
|
|
90146
91839
|
});
|
|
90147
91840
|
|
|
91841
|
+
// packages/io/src/archivoMtabs.ts
|
|
91842
|
+
function formatoQueNecesita(documento) {
|
|
91843
|
+
for (const pista of documento.pistas.values()) {
|
|
91844
|
+
const transposicion = pista.get("transposicion");
|
|
91845
|
+
if (typeof transposicion === "number" && transposicion !== 0) return 6;
|
|
91846
|
+
}
|
|
91847
|
+
for (const nota of documento.notas.values()) {
|
|
91848
|
+
const v = nota.get("armonicoValor");
|
|
91849
|
+
if (typeof v === "number" && v !== 0) return 6;
|
|
91850
|
+
}
|
|
91851
|
+
for (const figura of documento.figuras.values()) {
|
|
91852
|
+
if (figura.get("octava") !== void 0 || figura.get("tempo") !== void 0) return 6;
|
|
91853
|
+
}
|
|
91854
|
+
for (const pista of documento.pistas.values()) {
|
|
91855
|
+
const pentagramas = pista.get("pentagramas");
|
|
91856
|
+
if (typeof pentagramas === "number" && pentagramas > 1) return 5;
|
|
91857
|
+
}
|
|
91858
|
+
return 4;
|
|
91859
|
+
}
|
|
91860
|
+
function empaquetar(documento, opciones = {}) {
|
|
91861
|
+
const grabaciones = opciones.grabaciones ?? [];
|
|
91862
|
+
const fuentes = opciones.fuentes ?? [];
|
|
91863
|
+
const manifiesto = {
|
|
91864
|
+
formato: formatoQueNecesita(documento),
|
|
91865
|
+
aplicacion: opciones.aplicacion ?? "Mandioca Tabs",
|
|
91866
|
+
guardado: opciones.guardado ?? "",
|
|
91867
|
+
titulo: documento.cabecera.get("titulo") ?? "",
|
|
91868
|
+
artista: documento.cabecera.get("artista") ?? "",
|
|
91869
|
+
audios: grabaciones.map((g) => g.fuenteId),
|
|
91870
|
+
fuentes: fuentes.map((f) => f.tipografiaId)
|
|
91871
|
+
};
|
|
91872
|
+
const entradas = {
|
|
91873
|
+
[MANIFIESTO]: new TextEncoder().encode(JSON.stringify(manifiesto, null, 2)),
|
|
91874
|
+
[DOCUMENTO]: documento.aBytes()
|
|
91875
|
+
};
|
|
91876
|
+
for (const g of grabaciones) {
|
|
91877
|
+
entradas[`${CARPETA_DE_AUDIO}${g.fuenteId}`] = g.bytes;
|
|
91878
|
+
}
|
|
91879
|
+
for (const f of fuentes) {
|
|
91880
|
+
entradas[`${CARPETA_DE_FUENTES}${f.tipografiaId}`] = f.bytes;
|
|
91881
|
+
}
|
|
91882
|
+
return zipSync(entradas, { level: 0 });
|
|
91883
|
+
}
|
|
91884
|
+
function desempaquetar(bytes) {
|
|
91885
|
+
let entradas;
|
|
91886
|
+
try {
|
|
91887
|
+
entradas = unzipSync(bytes);
|
|
91888
|
+
} catch {
|
|
91889
|
+
throw new ArchivoIlegible("Esto no parece un archivo .mtabs: no se pudo abrir el contenedor.");
|
|
91890
|
+
}
|
|
91891
|
+
const crudo = entradas[MANIFIESTO];
|
|
91892
|
+
if (!crudo) {
|
|
91893
|
+
throw new ArchivoIlegible(
|
|
91894
|
+
"El archivo no trae su manifiesto, as\xED que no se puede saber ni de qu\xE9 versi\xF3n es."
|
|
91895
|
+
);
|
|
91896
|
+
}
|
|
91897
|
+
let manifiesto;
|
|
91898
|
+
try {
|
|
91899
|
+
manifiesto = JSON.parse(new TextDecoder().decode(crudo));
|
|
91900
|
+
} catch {
|
|
91901
|
+
throw new ArchivoIlegible("El manifiesto del archivo est\xE1 da\xF1ado.");
|
|
91902
|
+
}
|
|
91903
|
+
if (!manifiesto || typeof manifiesto !== "object") {
|
|
91904
|
+
throw new ArchivoIlegible("El manifiesto del archivo est\xE1 da\xF1ado.");
|
|
91905
|
+
}
|
|
91906
|
+
if (!Number.isFinite(manifiesto.formato) || manifiesto.formato > VERSION_DEL_FORMATO) {
|
|
91907
|
+
throw new ArchivoIlegible(
|
|
91908
|
+
`Este archivo se guard\xF3 con una versi\xF3n m\xE1s nueva de Mandioca Tabs (formato ${manifiesto.formato}; esta versi\xF3n entiende hasta el ${VERSION_DEL_FORMATO}). Abrirlo igual podr\xEDa borrarte lo que esa versi\xF3n guard\xF3.`
|
|
91909
|
+
);
|
|
91910
|
+
}
|
|
91911
|
+
const doc = entradas[DOCUMENTO];
|
|
91912
|
+
if (!doc) throw new ArchivoIlegible("El archivo no trae el documento.");
|
|
91913
|
+
let documento;
|
|
91914
|
+
try {
|
|
91915
|
+
documento = abrirDocumento(doc);
|
|
91916
|
+
} catch {
|
|
91917
|
+
throw new ArchivoIlegible("El documento que trae el archivo est\xE1 da\xF1ado.");
|
|
91918
|
+
}
|
|
91919
|
+
const grabaciones = [];
|
|
91920
|
+
const fuentes = [];
|
|
91921
|
+
for (const [nombre, contenido] of Object.entries(entradas)) {
|
|
91922
|
+
if (nombre.startsWith(CARPETA_DE_AUDIO)) {
|
|
91923
|
+
const fuenteId = nombre.slice(CARPETA_DE_AUDIO.length);
|
|
91924
|
+
if (fuenteId) grabaciones.push({ fuenteId, bytes: contenido });
|
|
91925
|
+
continue;
|
|
91926
|
+
}
|
|
91927
|
+
if (nombre.startsWith(CARPETA_DE_FUENTES)) {
|
|
91928
|
+
const tipografiaId = nombre.slice(CARPETA_DE_FUENTES.length);
|
|
91929
|
+
if (tipografiaId) fuentes.push({ tipografiaId, bytes: contenido });
|
|
91930
|
+
}
|
|
91931
|
+
}
|
|
91932
|
+
const manosJuntadas = juntarManosDelPiano(documento);
|
|
91933
|
+
return { documento, manifiesto, grabaciones, fuentes, manosJuntadas };
|
|
91934
|
+
}
|
|
91935
|
+
var VERSION_DEL_FORMATO, MANIFIESTO, DOCUMENTO, CARPETA_DE_AUDIO, CARPETA_DE_FUENTES, ArchivoIlegible;
|
|
91936
|
+
var init_archivoMtabs = __esm({
|
|
91937
|
+
"packages/io/src/archivoMtabs.ts"() {
|
|
91938
|
+
init_esm();
|
|
91939
|
+
init_src2();
|
|
91940
|
+
init_manosDelPiano();
|
|
91941
|
+
VERSION_DEL_FORMATO = 6;
|
|
91942
|
+
MANIFIESTO = "mandioca.json";
|
|
91943
|
+
DOCUMENTO = "documento.ydoc";
|
|
91944
|
+
CARPETA_DE_AUDIO = "audio/";
|
|
91945
|
+
CARPETA_DE_FUENTES = "fuentes/";
|
|
91946
|
+
ArchivoIlegible = class extends Error {
|
|
91947
|
+
constructor(mensaje) {
|
|
91948
|
+
super(mensaje);
|
|
91949
|
+
this.name = "ArchivoIlegible";
|
|
91950
|
+
}
|
|
91951
|
+
};
|
|
91952
|
+
}
|
|
91953
|
+
});
|
|
91954
|
+
|
|
91955
|
+
// packages/io/src/recorridoDeRepeticiones.ts
|
|
91956
|
+
function instalarRecorridoDeRepeticiones() {
|
|
91957
|
+
const version2 = String(VersionInfo?.VersionInfo?.version ?? VersionInfo?.version ?? "");
|
|
91958
|
+
const Generador = _barrel_exports$3.MidiFileGenerator;
|
|
91959
|
+
if (!Generador || typeof Generador._playThroughSong !== "function") return false;
|
|
91960
|
+
if (Generador.__recorridoDe19) return true;
|
|
91961
|
+
if (version2 && !version2.startsWith("1.8.")) return false;
|
|
91962
|
+
Generador._playThroughSong = function(score, syncPoints, createNewSyncPoints, generateMasterBar, generateTracks, finish) {
|
|
91963
|
+
const controller = new RecorridoDeCompases(score);
|
|
91964
|
+
const playContext = {
|
|
91965
|
+
synthTick: 0,
|
|
91966
|
+
synthTime: 0,
|
|
91967
|
+
currentTempo: score.tempo,
|
|
91968
|
+
automationToSyncPoint: /* @__PURE__ */ new Map(),
|
|
91969
|
+
syncPoints,
|
|
91970
|
+
createNewSyncPoints
|
|
91971
|
+
};
|
|
91972
|
+
let previousMasterBar = null;
|
|
91973
|
+
const barOccurence = /* @__PURE__ */ new Map();
|
|
91974
|
+
while (!controller.finished) {
|
|
91975
|
+
const index = controller.index;
|
|
91976
|
+
const bar = score.masterBars[index];
|
|
91977
|
+
const currentTick = controller.currentTick;
|
|
91978
|
+
controller.processCurrent();
|
|
91979
|
+
if (controller.shouldPlay) {
|
|
91980
|
+
let occurence = barOccurence.has(index) ? barOccurence.get(index) : -1;
|
|
91981
|
+
occurence++;
|
|
91982
|
+
barOccurence.set(index, occurence);
|
|
91983
|
+
generateMasterBar(bar, previousMasterBar, currentTick, playContext.currentTempo, occurence);
|
|
91984
|
+
generateTracks(index, currentTick, bar.tempoAutomations.length > 0 ? bar.tempoAutomations[0].value : playContext.currentTempo);
|
|
91985
|
+
playContext.synthTick = currentTick;
|
|
91986
|
+
Generador._processBarTime(bar, occurence, playContext);
|
|
91987
|
+
}
|
|
91988
|
+
controller.moveNext();
|
|
91989
|
+
previousMasterBar = bar;
|
|
91990
|
+
}
|
|
91991
|
+
if (syncPoints.length > 0) {
|
|
91992
|
+
const lastSyncPoint = syncPoints[syncPoints.length - 1];
|
|
91993
|
+
const remainingTicks = controller.currentTick - lastSyncPoint.synthTick;
|
|
91994
|
+
if (remainingTicks > 0) {
|
|
91995
|
+
const p = new _barrel_exports$7.BackingTrackSyncPoint();
|
|
91996
|
+
p.masterBarIndex = previousMasterBar.index;
|
|
91997
|
+
p.masterBarOccurence = barOccurence.get(previousMasterBar.index) - 1;
|
|
91998
|
+
p.synthTick = controller.currentTick;
|
|
91999
|
+
p.synthBpm = playContext.currentTempo;
|
|
92000
|
+
if (playContext.createNewSyncPoints) {
|
|
92001
|
+
p.syncBpm = lastSyncPoint.synthBpm;
|
|
92002
|
+
p.synthBpm = lastSyncPoint.synthBpm;
|
|
92003
|
+
} else if (syncPoints.length === 1) p.syncBpm = lastSyncPoint.synthBpm;
|
|
92004
|
+
else p.syncBpm = syncPoints[syncPoints.length - 2].syncBpm;
|
|
92005
|
+
p.synthTime = lastSyncPoint.synthTime + ticksAMs(remainingTicks, lastSyncPoint.synthBpm);
|
|
92006
|
+
p.syncTime = lastSyncPoint.syncTime + ticksAMs(remainingTicks, p.syncBpm);
|
|
92007
|
+
if (!playContext.createNewSyncPoints) lastSyncPoint.updateSyncBpm(p.synthTime, p.syncTime);
|
|
92008
|
+
syncPoints.push(p);
|
|
92009
|
+
}
|
|
92010
|
+
}
|
|
92011
|
+
finish(controller.currentTick);
|
|
92012
|
+
return playContext;
|
|
92013
|
+
};
|
|
92014
|
+
Generador.__recorridoDe19 = true;
|
|
92015
|
+
return true;
|
|
92016
|
+
}
|
|
92017
|
+
var D2, Repeticion, RecorridoDeCompases, ticksAMs;
|
|
92018
|
+
var init_recorridoDeRepeticiones = __esm({
|
|
92019
|
+
"packages/io/src/recorridoDeRepeticiones.ts"() {
|
|
92020
|
+
init_alphaTab();
|
|
92021
|
+
D2 = {
|
|
92022
|
+
TargetFine: 0,
|
|
92023
|
+
TargetSegno: 1,
|
|
92024
|
+
TargetSegnoSegno: 2,
|
|
92025
|
+
TargetCoda: 3,
|
|
92026
|
+
TargetDoubleCoda: 4,
|
|
92027
|
+
JumpDaCoda: 17,
|
|
92028
|
+
JumpDaDoubleCoda: 18
|
|
92029
|
+
};
|
|
92030
|
+
Repeticion = class {
|
|
92031
|
+
group;
|
|
92032
|
+
/** Con casillas, cada cierre termina la pasada y todos comparten el contador. */
|
|
92033
|
+
conCasillas;
|
|
92034
|
+
/** La pasada actual (desde 0): elige qué casillas suenan. */
|
|
92035
|
+
pasada = 0;
|
|
92036
|
+
/** Las repeticiones hechas por cierre (sólo sin casillas). */
|
|
92037
|
+
iteraciones;
|
|
92038
|
+
/** Las casillas del último compás que las tenía: los que no tienen, las continúan. */
|
|
92039
|
+
casillasActuales = 0;
|
|
92040
|
+
/** @param pasadaFinal si se toca como última pasada (después de un salto): sólo la última casilla. */
|
|
92041
|
+
constructor(group, pasadaFinal) {
|
|
92042
|
+
this.group = group;
|
|
92043
|
+
this.conCasillas = group.masterBars.some((m) => m.alternateEndings !== 0);
|
|
92044
|
+
this.iteraciones = group.closings.map((c) => pasadaFinal ? Math.max(0, c.repeatCount - 1) : 0);
|
|
92045
|
+
if (pasadaFinal) for (const i2 of this.iteraciones) this.pasada = Math.max(this.pasada, i2);
|
|
92046
|
+
}
|
|
92047
|
+
suena(compas) {
|
|
92048
|
+
let casillas = compas.alternateEndings;
|
|
92049
|
+
if (casillas === 0) casillas = this.casillasActuales;
|
|
92050
|
+
else this.casillasActuales = casillas;
|
|
92051
|
+
return casillas === 0 || (casillas & 1 << this.pasada) !== 0;
|
|
92052
|
+
}
|
|
92053
|
+
/** 0 = seguir, 1 = volver al comienzo de la repetición, 2 = terminó. */
|
|
92054
|
+
alCerrar(cierre, sono) {
|
|
92055
|
+
const cierres = this.group.closings;
|
|
92056
|
+
const esElUltimo = cierre === cierres[cierres.length - 1];
|
|
92057
|
+
if (this.conCasillas) {
|
|
92058
|
+
if (!sono && !esElUltimo) return 0;
|
|
92059
|
+
if (this.pasada < cierre.repeatCount - 1) {
|
|
92060
|
+
this.pasada++;
|
|
92061
|
+
this.casillasActuales = 0;
|
|
92062
|
+
return 1;
|
|
92063
|
+
}
|
|
92064
|
+
return esElUltimo ? 2 : 0;
|
|
92065
|
+
}
|
|
92066
|
+
const i2 = cierres.indexOf(cierre);
|
|
92067
|
+
if (i2 === -1) return 0;
|
|
92068
|
+
if (this.iteraciones[i2] < cierre.repeatCount - 1) {
|
|
92069
|
+
this.iteraciones[i2]++;
|
|
92070
|
+
for (let j = 0; j < i2; j++) this.iteraciones[j] = 0;
|
|
92071
|
+
this.casillasActuales = 0;
|
|
92072
|
+
return 1;
|
|
92073
|
+
}
|
|
92074
|
+
return esElUltimo ? 2 : 0;
|
|
92075
|
+
}
|
|
92076
|
+
/** Si algún cierre todavía va a volver por encima de este compás. */
|
|
92077
|
+
vaAVolver(compas) {
|
|
92078
|
+
const cierres = this.group.closings;
|
|
92079
|
+
for (let i2 = 0; i2 < cierres.length; i2++) {
|
|
92080
|
+
const cierre = cierres[i2];
|
|
92081
|
+
if (cierre.index >= compas.index) {
|
|
92082
|
+
if ((this.conCasillas ? this.pasada : this.iteraciones[i2]) < cierre.repeatCount - 1) return true;
|
|
92083
|
+
}
|
|
92084
|
+
}
|
|
92085
|
+
return false;
|
|
92086
|
+
}
|
|
92087
|
+
};
|
|
92088
|
+
RecorridoDeCompases = class _RecorridoDeCompases {
|
|
92089
|
+
/** Los saltos en el orden en que se revisan si un compás tiene varios. */
|
|
92090
|
+
static SALTOS = [
|
|
92091
|
+
{ jump: 5, target: null, playUntil: null, continueAt: null },
|
|
92092
|
+
{ jump: 6, target: null, playUntil: D2.JumpDaCoda, continueAt: D2.TargetCoda },
|
|
92093
|
+
{ jump: 7, target: null, playUntil: D2.JumpDaDoubleCoda, continueAt: D2.TargetDoubleCoda },
|
|
92094
|
+
{ jump: 8, target: null, playUntil: D2.TargetFine, continueAt: null },
|
|
92095
|
+
{ jump: 9, target: D2.TargetSegno, playUntil: null, continueAt: null },
|
|
92096
|
+
{ jump: 10, target: D2.TargetSegno, playUntil: D2.JumpDaCoda, continueAt: D2.TargetCoda },
|
|
92097
|
+
{ jump: 11, target: D2.TargetSegno, playUntil: D2.JumpDaDoubleCoda, continueAt: D2.TargetDoubleCoda },
|
|
92098
|
+
{ jump: 12, target: D2.TargetSegno, playUntil: D2.TargetFine, continueAt: null },
|
|
92099
|
+
{ jump: 13, target: D2.TargetSegnoSegno, playUntil: null, continueAt: null },
|
|
92100
|
+
{ jump: 14, target: D2.TargetSegnoSegno, playUntil: D2.JumpDaCoda, continueAt: D2.TargetCoda },
|
|
92101
|
+
{ jump: 15, target: D2.TargetSegnoSegno, playUntil: D2.JumpDaDoubleCoda, continueAt: D2.TargetDoubleCoda },
|
|
92102
|
+
{ jump: 16, target: D2.TargetSegnoSegno, playUntil: D2.TargetFine, continueAt: null }
|
|
92103
|
+
];
|
|
92104
|
+
score;
|
|
92105
|
+
pila = [];
|
|
92106
|
+
/** El D.C./D.S. que se siguió; null si se toca normal (antes del salto o después de la coda). */
|
|
92107
|
+
saltoActivo = null;
|
|
92108
|
+
/** Los compases cuyo salto ya se tomó: cada salto se toma una sola vez. */
|
|
92109
|
+
saltosTomados = /* @__PURE__ */ new Set();
|
|
92110
|
+
shouldPlay = true;
|
|
92111
|
+
index = 0;
|
|
92112
|
+
currentTick = 0;
|
|
92113
|
+
constructor(score) {
|
|
92114
|
+
this.score = score;
|
|
92115
|
+
}
|
|
92116
|
+
get finished() {
|
|
92117
|
+
return this.index >= this.score.masterBars.length;
|
|
92118
|
+
}
|
|
92119
|
+
processCurrent() {
|
|
92120
|
+
const compas = this.score.masterBars[this.index];
|
|
92121
|
+
this.entrarARepeticion(compas);
|
|
92122
|
+
const rep = this.pila.length > 0 ? this.pila[this.pila.length - 1] : null;
|
|
92123
|
+
this.shouldPlay = rep === null || rep.suena(compas);
|
|
92124
|
+
if (this.shouldPlay) this.currentTick += compas.calculateDuration();
|
|
92125
|
+
}
|
|
92126
|
+
moveNext() {
|
|
92127
|
+
if (this.moverConSaltos()) return;
|
|
92128
|
+
const compas = this.score.masterBars[this.index];
|
|
92129
|
+
if (this.pila.length > 0 && compas.repeatCount > 1) {
|
|
92130
|
+
const rep = this.pila[this.pila.length - 1];
|
|
92131
|
+
switch (rep.alCerrar(compas, this.shouldPlay)) {
|
|
92132
|
+
case 1:
|
|
92133
|
+
this.index = rep.group.opening.index;
|
|
92134
|
+
return;
|
|
92135
|
+
case 2:
|
|
92136
|
+
this.pila.pop();
|
|
92137
|
+
}
|
|
92138
|
+
}
|
|
92139
|
+
this.index++;
|
|
92140
|
+
}
|
|
92141
|
+
/** Empieza la repetición del compás si hace falta: al llegar a su apertura, o tras un salto que cayó adentro. */
|
|
92142
|
+
entrarARepeticion(compas) {
|
|
92143
|
+
const group = compas.repeatGroup;
|
|
92144
|
+
if (!group.isClosed || this.pila.some((r) => r.group === group)) return;
|
|
92145
|
+
const adentro = compas.index <= group.closings[group.closings.length - 1].index;
|
|
92146
|
+
if (compas === group.opening || this.saltoActivo !== null && adentro) {
|
|
92147
|
+
this.pila.push(new Repeticion(group, this.saltoActivo !== null));
|
|
92148
|
+
}
|
|
92149
|
+
}
|
|
92150
|
+
moverConSaltos() {
|
|
92151
|
+
const compas = this.score.masterBars[this.index];
|
|
92152
|
+
const dir = compas.directions;
|
|
92153
|
+
if (!this.shouldPlay || dir === null || dir === void 0 || dir.size === 0) return false;
|
|
92154
|
+
if (this.saltoActivo === null) return this.tomarSalto(compas, dir);
|
|
92155
|
+
const hasta = this.saltoActivo.playUntil;
|
|
92156
|
+
if (hasta !== null && dir.has(hasta)) return this.seguirTrasElSalto(this.saltoActivo.continueAt);
|
|
92157
|
+
return false;
|
|
92158
|
+
}
|
|
92159
|
+
tomarSalto(compas, dir) {
|
|
92160
|
+
if (this.saltosTomados.has(compas) || this.pila.some((r) => r.vaAVolver(compas))) return false;
|
|
92161
|
+
for (const salto of _RecorridoDeCompases.SALTOS) {
|
|
92162
|
+
if (!dir.has(salto.jump)) continue;
|
|
92163
|
+
const destino = salto.target === null ? 0 : this.buscar(salto.target, true);
|
|
92164
|
+
if (destino === -1) continue;
|
|
92165
|
+
this.saltosTomados.add(compas);
|
|
92166
|
+
this.saltoActivo = salto;
|
|
92167
|
+
this.pila = [];
|
|
92168
|
+
this.index = destino;
|
|
92169
|
+
return true;
|
|
92170
|
+
}
|
|
92171
|
+
return false;
|
|
92172
|
+
}
|
|
92173
|
+
seguirTrasElSalto(seguirEn) {
|
|
92174
|
+
if (seguirEn === null) {
|
|
92175
|
+
this.index = this.score.masterBars.length;
|
|
92176
|
+
return true;
|
|
92177
|
+
}
|
|
92178
|
+
const coda = this.buscar(seguirEn, false);
|
|
92179
|
+
if (coda === -1) return false;
|
|
92180
|
+
this.saltoActivo = null;
|
|
92181
|
+
this.pila = [];
|
|
92182
|
+
this.index = coda;
|
|
92183
|
+
return true;
|
|
92184
|
+
}
|
|
92185
|
+
buscar(direccion, primeroAtras) {
|
|
92186
|
+
const paso = primeroAtras ? -1 : 1;
|
|
92187
|
+
const i2 = this.buscarHacia(direccion, paso);
|
|
92188
|
+
return i2 !== -1 ? i2 : this.buscarHacia(direccion, -paso);
|
|
92189
|
+
}
|
|
92190
|
+
buscarHacia(direccion, paso) {
|
|
92191
|
+
const compases = this.score.masterBars;
|
|
92192
|
+
for (let i2 = this.index; i2 >= 0 && i2 < compases.length; i2 += paso) {
|
|
92193
|
+
const d = compases[i2].directions;
|
|
92194
|
+
if (d !== null && d !== void 0 && d.has(direccion)) return i2;
|
|
92195
|
+
}
|
|
92196
|
+
return -1;
|
|
92197
|
+
}
|
|
92198
|
+
};
|
|
92199
|
+
ticksAMs = (ticks, tempo) => ticks * (6e4 / (tempo * 960)) | 0;
|
|
92200
|
+
}
|
|
92201
|
+
});
|
|
92202
|
+
|
|
90148
92203
|
// packages/io/src/exportar.ts
|
|
90149
92204
|
function formatoDeExportacion(clave) {
|
|
90150
92205
|
return FORMATOS_DE_EXPORTACION.find((f) => f.clave === clave);
|
|
@@ -90159,6 +92214,7 @@ function exportarMidi(score) {
|
|
|
90159
92214
|
const archivo = new _barrel_exports$3.MidiFile();
|
|
90160
92215
|
archivo.format = _barrel_exports$3.MidiFileFormat.MultiTrack;
|
|
90161
92216
|
const manejador = new _barrel_exports$3.AlphaSynthMidiFileHandler(archivo, true);
|
|
92217
|
+
instalarRecorridoDeRepeticiones();
|
|
90162
92218
|
new _barrel_exports$3.MidiFileGenerator(score, null, manejador).generate();
|
|
90163
92219
|
return archivo.toBinary();
|
|
90164
92220
|
}
|
|
@@ -90180,6 +92236,7 @@ var FORMATOS_DE_EXPORTACION;
|
|
|
90180
92236
|
var init_exportar = __esm({
|
|
90181
92237
|
"packages/io/src/exportar.ts"() {
|
|
90182
92238
|
init_alphaTab();
|
|
92239
|
+
init_recorridoDeRepeticiones();
|
|
90183
92240
|
init_musicxml();
|
|
90184
92241
|
FORMATOS_DE_EXPORTACION = [
|
|
90185
92242
|
{
|
|
@@ -90226,9 +92283,11 @@ var src_exports = {};
|
|
|
90226
92283
|
__export(src_exports, {
|
|
90227
92284
|
ArchivoIlegible: () => ArchivoIlegible,
|
|
90228
92285
|
FORMATOS_DE_EXPORTACION: () => FORMATOS_DE_EXPORTACION,
|
|
92286
|
+
MidiIlegible: () => MidiIlegible,
|
|
90229
92287
|
VERSION_DEL_FORMATO: () => VERSION_DEL_FORMATO,
|
|
90230
92288
|
desempaquetar: () => desempaquetar,
|
|
90231
92289
|
empaquetar: () => empaquetar,
|
|
92290
|
+
esMidi: () => esMidi,
|
|
90232
92291
|
exportarAlphaTex: () => exportarAlphaTex,
|
|
90233
92292
|
exportarComo: () => exportarComo,
|
|
90234
92293
|
exportarGp7: () => exportarGp7,
|
|
@@ -90238,7 +92297,9 @@ __export(src_exports, {
|
|
|
90238
92297
|
formatoDeExportacion: () => formatoDeExportacion,
|
|
90239
92298
|
formatoQueNecesita: () => formatoQueNecesita,
|
|
90240
92299
|
importarGp: () => importarGp,
|
|
92300
|
+
importarMidi: () => importarMidi,
|
|
90241
92301
|
importarScore: () => importarScore,
|
|
92302
|
+
instalarRecorridoDeRepeticiones: () => instalarRecorridoDeRepeticiones,
|
|
90242
92303
|
leerOrtografia: () => leerOrtografia,
|
|
90243
92304
|
prepararMusicXml: () => prepararMusicXml,
|
|
90244
92305
|
prepararParaAlphaTab: () => prepararParaAlphaTab,
|
|
@@ -90247,10 +92308,12 @@ __export(src_exports, {
|
|
|
90247
92308
|
var init_src4 = __esm({
|
|
90248
92309
|
"packages/io/src/index.ts"() {
|
|
90249
92310
|
init_importarGp();
|
|
92311
|
+
init_importarMidi();
|
|
90250
92312
|
init_musicxmlEntrada();
|
|
90251
92313
|
init_archivoMtabs();
|
|
90252
92314
|
init_exportar();
|
|
90253
92315
|
init_musicxml();
|
|
92316
|
+
init_recorridoDeRepeticiones();
|
|
90254
92317
|
}
|
|
90255
92318
|
});
|
|
90256
92319
|
|
|
@@ -90313,13 +92376,28 @@ async function abrirDeArchivo(ruta) {
|
|
|
90313
92376
|
abierta = {
|
|
90314
92377
|
documento: archivo.documento,
|
|
90315
92378
|
origen: { clase: "archivo", ruta },
|
|
90316
|
-
|
|
92379
|
+
// ★ (2026-11-11) Una obra vieja con el piano en dos pistas vuelve junta: se dice, para que
|
|
92380
|
+
// la IA no busque la «mano izquierda» como pista aparte.
|
|
92381
|
+
avisos: archivo.manosJuntadas > 0 ? ["El piano estaba guardado en dos pistas (una por mano): ahora es un solo instrumento con dos pentagramas."] : [],
|
|
90317
92382
|
grabaciones: archivo.grabaciones,
|
|
90318
92383
|
grabacionesEnEspera: [],
|
|
90319
92384
|
fuentes: archivo.fuentes
|
|
90320
92385
|
};
|
|
90321
92386
|
return alAbrirLaObra(abierta);
|
|
90322
92387
|
}
|
|
92388
|
+
if (EXTENSIONES_MIDI.has(extension2)) {
|
|
92389
|
+
const { importarMidi: importarMidi2 } = await Promise.resolve().then(() => (init_src4(), src_exports));
|
|
92390
|
+
const resultado = importarMidi2(bytes, { titulo: basename(ruta).replace(/.[^.]+$/, "") });
|
|
92391
|
+
abierta = {
|
|
92392
|
+
documento: resultado.documento,
|
|
92393
|
+
origen: { clase: "archivo", ruta },
|
|
92394
|
+
avisos: resultado.avisos,
|
|
92395
|
+
grabaciones: [],
|
|
92396
|
+
grabacionesEnEspera: [],
|
|
92397
|
+
fuentes: []
|
|
92398
|
+
};
|
|
92399
|
+
return alAbrirLaObra(abierta);
|
|
92400
|
+
}
|
|
90323
92401
|
if (EXTENSIONES_IMPORTABLES.has(extension2)) {
|
|
90324
92402
|
const { importarGp: importarGp2 } = await Promise.resolve().then(() => (init_src4(), src_exports));
|
|
90325
92403
|
const resultado = importarGp2(bytes);
|
|
@@ -90336,7 +92414,7 @@ async function abrirDeArchivo(ruta) {
|
|
|
90336
92414
|
return alAbrirLaObra(abierta);
|
|
90337
92415
|
}
|
|
90338
92416
|
throw new ProblemaConLaObra(
|
|
90339
|
-
`No s\xE9 abrir \xAB${basename(ruta)}\xBB: la extensi\xF3n \xAB${extension2 || "(ninguna)"}\xBB no est\xE1 soportada. Se puede abrir .mtabs (el formato de Mandioca Tabs), Guitar Pro (.gp, .gpx, .gp5, .gp4, .gp3)
|
|
92417
|
+
`No s\xE9 abrir \xAB${basename(ruta)}\xBB: la extensi\xF3n \xAB${extension2 || "(ninguna)"}\xBB no est\xE1 soportada. Se puede abrir .mtabs (el formato de Mandioca Tabs), Guitar Pro (.gp, .gpx, .gp5, .gp4, .gp3), MusicXML (.musicxml, .xml, .mxl) y MIDI (.mid, .midi).`
|
|
90340
92418
|
);
|
|
90341
92419
|
}
|
|
90342
92420
|
function abrirEnBlanco(opciones = {}) {
|
|
@@ -90464,7 +92542,7 @@ function reciboDeLaPesta\u00F1a(respuesta, ruta) {
|
|
|
90464
92542
|
...avisoDeLoQueNoSuena(mudas, 0)
|
|
90465
92543
|
};
|
|
90466
92544
|
}
|
|
90467
|
-
var ProblemaConLaObra, abierta, sigueViva, EXTENSIONES_IMPORTABLES;
|
|
92545
|
+
var ProblemaConLaObra, abierta, sigueViva, EXTENSIONES_IMPORTABLES, EXTENSIONES_MIDI;
|
|
90468
92546
|
var init_obra = __esm({
|
|
90469
92547
|
"apps/mcp/src/obra.ts"() {
|
|
90470
92548
|
"use strict";
|
|
@@ -90475,6 +92553,7 @@ var init_obra = __esm({
|
|
|
90475
92553
|
abierta = null;
|
|
90476
92554
|
sigueViva = null;
|
|
90477
92555
|
EXTENSIONES_IMPORTABLES = /* @__PURE__ */ new Set([".gp", ".gpx", ".gp5", ".gp4", ".gp3", ".musicxml", ".xml", ".mxl"]);
|
|
92556
|
+
EXTENSIONES_MIDI = /* @__PURE__ */ new Set([".mid", ".midi", ".kar", ".rmi"]);
|
|
90478
92557
|
}
|
|
90479
92558
|
});
|
|
90480
92559
|
|
|
@@ -90483,7 +92562,7 @@ var VERSION_DEL_CONECTOR;
|
|
|
90483
92562
|
var init_version = __esm({
|
|
90484
92563
|
"apps/mcp/src/version.ts"() {
|
|
90485
92564
|
"use strict";
|
|
90486
|
-
VERSION_DEL_CONECTOR = true ? "0.2.
|
|
92565
|
+
VERSION_DEL_CONECTOR = true ? "0.2.18" : null;
|
|
90487
92566
|
}
|
|
90488
92567
|
});
|
|
90489
92568
|
|
|
@@ -98346,6 +100425,51 @@ var init_marcas = __esm({
|
|
|
98346
100425
|
}
|
|
98347
100426
|
});
|
|
98348
100427
|
|
|
100428
|
+
// packages/projection/src/diagramas.ts
|
|
100429
|
+
function diagramasValidos(v) {
|
|
100430
|
+
return DIAGRAMAS_POSIBLES.includes(v) ? v : "no";
|
|
100431
|
+
}
|
|
100432
|
+
function claveDeLaForma(forma) {
|
|
100433
|
+
return [...forma].sort((a, b) => a.cuerda - b.cuerda).map((n) => `${n.cuerda}:${n.traste}`).join(" ");
|
|
100434
|
+
}
|
|
100435
|
+
function formaDibujable(forma) {
|
|
100436
|
+
if (forma.length < 2) return false;
|
|
100437
|
+
return new Set(forma.map((n) => n.cuerda)).size === forma.length;
|
|
100438
|
+
}
|
|
100439
|
+
function formasDeLaPista(golpes) {
|
|
100440
|
+
const cuentas = /* @__PURE__ */ new Map();
|
|
100441
|
+
golpes.forEach(({ nombre, forma }, orden) => {
|
|
100442
|
+
if (!formaDibujable(forma)) return;
|
|
100443
|
+
const deEste = cuentas.get(nombre) ?? /* @__PURE__ */ new Map();
|
|
100444
|
+
cuentas.set(nombre, deEste);
|
|
100445
|
+
const clave = claveDeLaForma(forma);
|
|
100446
|
+
const previa = deEste.get(clave);
|
|
100447
|
+
if (previa) previa.veces += 1;
|
|
100448
|
+
else deEste.set(clave, { forma, veces: 1, orden });
|
|
100449
|
+
});
|
|
100450
|
+
const elegidas = /* @__PURE__ */ new Map();
|
|
100451
|
+
for (const [nombre, formas] of cuentas) {
|
|
100452
|
+
const mejor = [...formas.values()].sort((a, b) => b.veces - a.veces || a.orden - b.orden)[0];
|
|
100453
|
+
if (mejor) elegidas.set(nombre, mejor.forma);
|
|
100454
|
+
}
|
|
100455
|
+
return elegidas;
|
|
100456
|
+
}
|
|
100457
|
+
function cuerdasDelDiagrama(forma, cuerdas) {
|
|
100458
|
+
const porCuerda = new Map(forma.map((n) => [n.cuerda, n.traste]));
|
|
100459
|
+
const strings = [];
|
|
100460
|
+
for (let c = cuerdas; c >= 1; c--) strings.push(porCuerda.get(c) ?? -1);
|
|
100461
|
+
const pisados = forma.map((n) => n.traste).filter((t) => t > 0);
|
|
100462
|
+
const maximo = pisados.length ? Math.max(...pisados) : 0;
|
|
100463
|
+
const firstFret = maximo <= 5 ? 1 : Math.min(...pisados);
|
|
100464
|
+
return { strings, firstFret };
|
|
100465
|
+
}
|
|
100466
|
+
var DIAGRAMAS_POSIBLES;
|
|
100467
|
+
var init_diagramas = __esm({
|
|
100468
|
+
"packages/projection/src/diagramas.ts"() {
|
|
100469
|
+
DIAGRAMAS_POSIBLES = ["no", "arriba", "partitura"];
|
|
100470
|
+
}
|
|
100471
|
+
});
|
|
100472
|
+
|
|
98349
100473
|
// packages/projection/src/estilo.ts
|
|
98350
100474
|
function comoLoEscribeCss(fuente) {
|
|
98351
100475
|
const partes = [];
|
|
@@ -98510,6 +100634,9 @@ function proyectar(documento, opciones = {}) {
|
|
|
98510
100634
|
score.album = marcado(cabecera.get("album") ?? "", marcasDe(cabecera, "album"));
|
|
98511
100635
|
const tempoDeCabecera = documento.cabecera.get("tempo") || 120;
|
|
98512
100636
|
score.stylesheet.hideDynamics = documento.cabecera.get("mostrarMatices") === false;
|
|
100637
|
+
const diagramas = diagramasValidos(documento.cabecera.get("diagramasDeAcordes"));
|
|
100638
|
+
score.stylesheet.globalDisplayChordDiagramsOnTop = diagramas === "arriba";
|
|
100639
|
+
score.stylesheet.globalDisplayChordDiagramsInScore = diagramas === "partitura";
|
|
98513
100640
|
score.stylesheet.barNumberDisplay = _barrel_exports$4.BarNumberDisplay.AllBars;
|
|
98514
100641
|
const estiloDeLaObra = documento.leerEstilo();
|
|
98515
100642
|
aplicarEstiloAlDibujo(score, ajustes, estiloDeLaObra);
|
|
@@ -98654,6 +100781,15 @@ function proyectar(documento, opciones = {}) {
|
|
|
98654
100781
|
});
|
|
98655
100782
|
acordesEscritos.sort((a, b) => a.compas - b.compas || a.tiempo - b.tiempo);
|
|
98656
100783
|
const acordeVigente = buscadorDeAcorde(acordesEscritos);
|
|
100784
|
+
const formaDelGolpe = (idFigura) => (notasPorFigura.get(idFigura) ?? []).map((n) => ({ cuerda: n.cuerda, traste: n.traste }));
|
|
100785
|
+
const formasConNombre = diagramas !== "no" && pista.tipo === "trastes" ? formasDeLaPista(
|
|
100786
|
+
maestros.flatMap(
|
|
100787
|
+
(m) => deLaPista.flatMap((mapa) => {
|
|
100788
|
+
const id2 = mapa.get(m.id);
|
|
100789
|
+
return (id2 ? figurasPorCompas.get(id2) ?? [] : []).filter(({ datos: f }) => f.acorde).sort((a, b) => a.datos.tiempo - b.datos.tiempo).map(({ id: idFigura, datos: f }) => ({ nombre: f.acorde, forma: formaDelGolpe(idFigura) }));
|
|
100790
|
+
})
|
|
100791
|
+
)
|
|
100792
|
+
) : null;
|
|
98657
100793
|
maestros.forEach((maestro, indiceDeCompas2) => {
|
|
98658
100794
|
const barra = new _barrel_exports$4.Bar();
|
|
98659
100795
|
pentagrama.addBar(barra);
|
|
@@ -98701,15 +100837,23 @@ function proyectar(documento, opciones = {}) {
|
|
|
98701
100837
|
if (figura.texto) golpe.lyrics = [marcado(figura.texto, figura.textoSegundaTipografia)];
|
|
98702
100838
|
if (figura.acorde) {
|
|
98703
100839
|
const nombre = marcado(figura.acorde, figura.acordeSegundaTipografia);
|
|
98704
|
-
|
|
100840
|
+
const propia = formasConNombre ? formaDelGolpe(idFigura) : [];
|
|
100841
|
+
const forma = formasConNombre ? formaDibujable(propia) ? propia : formasConNombre.get(figura.acorde) : void 0;
|
|
100842
|
+
const id2 = forma ? `${nombre}|${claveDeLaForma(forma)}` : nombre;
|
|
100843
|
+
if (!pentagrama.chords?.has(id2)) {
|
|
98705
100844
|
const acorde = new _barrel_exports$4.Chord();
|
|
98706
100845
|
acorde.name = nombre;
|
|
98707
100846
|
acorde.showName = true;
|
|
98708
|
-
acorde.showDiagram =
|
|
100847
|
+
acorde.showDiagram = forma !== void 0;
|
|
100848
|
+
if (forma) {
|
|
100849
|
+
const { strings, firstFret } = cuerdasDelDiagrama(forma, pista.afinacion.length);
|
|
100850
|
+
acorde.strings = strings;
|
|
100851
|
+
acorde.firstFret = firstFret;
|
|
100852
|
+
}
|
|
98709
100853
|
acorde.staff = pentagrama;
|
|
98710
|
-
pentagrama.addChord(
|
|
100854
|
+
pentagrama.addChord(id2, acorde);
|
|
98711
100855
|
}
|
|
98712
|
-
golpe.chordId =
|
|
100856
|
+
golpe.chordId = id2;
|
|
98713
100857
|
}
|
|
98714
100858
|
golpe.dynamics = figura.dinamica;
|
|
98715
100859
|
golpe.pickStroke = figura.puaDireccion;
|
|
@@ -98908,6 +101052,7 @@ var VOCES_POR_COMPAS, volumenDeMezcla;
|
|
|
98908
101052
|
var init_proyectar = __esm({
|
|
98909
101053
|
"packages/projection/src/proyectar.ts"() {
|
|
98910
101054
|
init_alphaTab();
|
|
101055
|
+
init_diagramas();
|
|
98911
101056
|
init_estilo();
|
|
98912
101057
|
init_src3();
|
|
98913
101058
|
init_marcas();
|
|
@@ -98921,6 +101066,7 @@ var init_proyectar = __esm({
|
|
|
98921
101066
|
// packages/projection/src/index.ts
|
|
98922
101067
|
var src_exports2 = {};
|
|
98923
101068
|
__export(src_exports2, {
|
|
101069
|
+
DIAGRAMAS_POSIBLES: () => DIAGRAMAS_POSIBLES,
|
|
98924
101070
|
ELEMENTOS_QUE_DIBUJA_EL_PROGRAMA: () => ELEMENTOS_QUE_DIBUJA_EL_PROGRAMA,
|
|
98925
101071
|
ELEMENTOS_QUE_NO_SE_DIBUJAN: () => ELEMENTOS_QUE_NO_SE_DIBUJAN,
|
|
98926
101072
|
MARCA_DE_BANDA: () => MARCA_DE_BANDA,
|
|
@@ -98928,6 +101074,7 @@ __export(src_exports2, {
|
|
|
98928
101074
|
aplicarColoresAlDibujo: () => aplicarColoresAlDibujo,
|
|
98929
101075
|
aplicarEstiloAlDibujo: () => aplicarEstiloAlDibujo,
|
|
98930
101076
|
aplicarFuentesAlDibujo: () => aplicarFuentesAlDibujo,
|
|
101077
|
+
diagramasValidos: () => diagramasValidos,
|
|
98931
101078
|
fuentePropiaDe: () => fuentePropiaDe,
|
|
98932
101079
|
pasarLetraALaFila: () => pasarLetraALaFila,
|
|
98933
101080
|
presentarPistas: () => presentarPistas,
|
|
@@ -98938,6 +101085,7 @@ __export(src_exports2, {
|
|
|
98938
101085
|
var init_src5 = __esm({
|
|
98939
101086
|
"packages/projection/src/index.ts"() {
|
|
98940
101087
|
init_marcas();
|
|
101088
|
+
init_diagramas();
|
|
98941
101089
|
init_proyectar();
|
|
98942
101090
|
init_estilo();
|
|
98943
101091
|
}
|
|
@@ -123039,6 +125187,7 @@ var LEEN = /* @__PURE__ */ new Set([
|
|
|
123039
125187
|
"ajustes_de_video",
|
|
123040
125188
|
"atajos_del_programa",
|
|
123041
125189
|
"audios_rechazados_por_largos",
|
|
125190
|
+
"buscar_en_las_paletas",
|
|
123042
125191
|
"captura",
|
|
123043
125192
|
"direcciones_disponibles",
|
|
123044
125193
|
"efectos_disponibles",
|
|
@@ -123313,9 +125462,9 @@ function registrarHerramientasDelDocumento(servidor2) {
|
|
|
123313
125462
|
"abrir_obra",
|
|
123314
125463
|
{
|
|
123315
125464
|
title: "Abrir una obra",
|
|
123316
|
-
description: "Abre un archivo de partitura del disco y lo deja como la obra sobre la que trabajan las dem\xE1s herramientas. Entiende .mtabs (el formato de Mandioca Tabs), Guitar Pro (.gp, .gpx, .gp5, .gp4, .gp3)
|
|
125465
|
+
description: "Abre un archivo de partitura del disco y lo deja como la obra sobre la que trabajan las dem\xE1s herramientas. Entiende .mtabs (el formato de Mandioca Tabs), Guitar Pro (.gp, .gpx, .gp5, .gp4, .gp3), MusicXML (.musicxml, .xml, .mxl) y MIDI (.mid, .midi). \u26A0\uFE0F **Si el m\xFAsico ya tiene el programa abierto y esperando, esto NO es lo que \xE9l ve**: un archivo abierto ac\xE1 es un documento aparte. Se comprueba antes y se avisa; para trabajar sobre su pantalla, `conectar_con_la_app`.",
|
|
123317
125466
|
inputSchema: {
|
|
123318
|
-
ruta: external_exports.string().describe("La ruta completa del archivo: .mtabs, Guitar Pro (.gp, .gpx, .gp5\u2026)
|
|
125467
|
+
ruta: external_exports.string().describe("La ruta completa del archivo: .mtabs, Guitar Pro (.gp, .gpx, .gp5\u2026), MusicXML (.musicxml, .xml, .mxl) o MIDI (.mid)"),
|
|
123319
125468
|
igual: external_exports.boolean().optional().describe(
|
|
123320
125469
|
"Abrir el archivo aunque el m\xFAsico tenga el programa abierto. Sirve para trabajar sobre un archivo del disco a prop\xF3sito, sin tocar lo que \xE9l est\xE1 mirando."
|
|
123321
125470
|
)
|
|
@@ -124069,6 +126218,46 @@ function registrarHerramientasDelPuente(servidor2) {
|
|
|
124069
126218
|
},
|
|
124070
126219
|
async (args2) => texto3(await pedirALaPesta\u00F1a("metronomo", args2))
|
|
124071
126220
|
);
|
|
126221
|
+
servidor2.registerTool(
|
|
126222
|
+
"elegir_voz",
|
|
126223
|
+
{
|
|
126224
|
+
title: "Elegir en qu\xE9 voz escribe el m\xFAsico",
|
|
126225
|
+
description: "Cambia la voz del cursor en la pantalla (1 a 4): lo que el m\xFAsico teclee despu\xE9s cae en esa voz. Es el selector \xABVoz\xBB de la barra. Las herramientas que escriben ya reciben su propia `voz`; \xE9sta es para dejarle la pantalla lista. Sin decir cu\xE1l, pasa a la siguiente. Contesta la voz y d\xF3nde qued\xF3 el cursor.",
|
|
126226
|
+
inputSchema: {
|
|
126227
|
+
voz: external_exports.number().int().min(1).max(4).optional().describe("De 1 a 4. Sin esto, la siguiente.")
|
|
126228
|
+
}
|
|
126229
|
+
},
|
|
126230
|
+
async (args2) => texto3(await pedirALaPesta\u00F1a("elegir_voz", args2))
|
|
126231
|
+
);
|
|
126232
|
+
servidor2.registerTool(
|
|
126233
|
+
"bucle",
|
|
126234
|
+
{
|
|
126235
|
+
title: "Repetir un pasaje en bucle",
|
|
126236
|
+
description: "Pone o saca el bucle: la reproducci\xF3n repite esos compases una y otra vez. Con `compas` (y `hasta`) repite esos; sin ellos, el pasaje marcado en pantalla o el comp\xE1s del cursor. Sin decir nada, alterna. No se guarda en la obra. La cuenta previa y la velocidad que sube se ajustan con `practica`.",
|
|
126237
|
+
inputSchema: {
|
|
126238
|
+
puesto: external_exports.boolean().optional().describe("true lo pone, false lo saca. Sin esto, alterna."),
|
|
126239
|
+
compas: external_exports.number().int().min(1).max(9999).optional().describe("Primer comp\xE1s del tramo, desde 1."),
|
|
126240
|
+
hasta: external_exports.number().int().min(1).max(9999).optional().describe("\xDAltimo comp\xE1s del tramo, incluido.")
|
|
126241
|
+
}
|
|
126242
|
+
},
|
|
126243
|
+
async (args2) => texto3(await pedirALaPesta\u00F1a("bucle", args2))
|
|
126244
|
+
);
|
|
126245
|
+
servidor2.registerTool(
|
|
126246
|
+
"practica",
|
|
126247
|
+
{
|
|
126248
|
+
title: "Ajustes de pr\xE1ctica",
|
|
126249
|
+
description: "C\xF3mo se practica con el bucle: `cuentaPrevia` toca un comp\xE1s de clicks antes de que entre la m\xFAsica (en cada play); `subirVelocidad` hace que, con el bucle puesto, la velocidad arranque en `desde` y suba `paso` cada `cadaVueltas` vueltas hasta `hasta`. De f\xE1brica todo apagado. Es de quien toca, no de la obra. Sin nada, contesta c\xF3mo est\xE1.",
|
|
126250
|
+
inputSchema: {
|
|
126251
|
+
cuentaPrevia: external_exports.boolean().optional(),
|
|
126252
|
+
subirVelocidad: external_exports.boolean().optional(),
|
|
126253
|
+
desde: external_exports.number().min(0.25).max(1.5).optional().describe("Velocidad de la primera vuelta; 1 es la normal."),
|
|
126254
|
+
hasta: external_exports.number().min(0.25).max(1.5).optional().describe("De ah\xED no pasa."),
|
|
126255
|
+
paso: external_exports.number().min(0.01).max(0.25).optional().describe("Cu\xE1nto sube cada vez: 0,05 es 5 %."),
|
|
126256
|
+
cadaVueltas: external_exports.number().int().min(1).max(16).optional()
|
|
126257
|
+
}
|
|
126258
|
+
},
|
|
126259
|
+
async (args2) => texto3(await pedirALaPesta\u00F1a("practica", args2))
|
|
126260
|
+
);
|
|
124072
126261
|
servidor2.registerTool(
|
|
124073
126262
|
"avanzar_al_escribir",
|
|
124074
126263
|
{
|
|
@@ -124544,7 +126733,7 @@ function registrarHerramientasDelPuente(servidor2) {
|
|
|
124544
126733
|
title: "Abrir una obra en la pantalla del m\xFAsico",
|
|
124545
126734
|
description: "Abre un `.mtabs` o un `.gp` del disco **en la pesta\xF1a que el m\xFAsico tiene delante**. \u26A0\uFE0F Esto NO es `abrir_obra`: aqu\xE9lla abre el archivo como un documento aparte, que el m\xFAsico no ve. \xC9sta se lo pone en pantalla. \u26A0\uFE0F Y no es `abrir_reciente`, que s\xF3lo alcanza los de su lista: ac\xE1 va cualquier ruta. \u2605 Funciona tambi\xE9n con la pantalla de inicio abierta y ninguna obra cargada, que es para lo que se hizo. \u26A0\uFE0F\u26A0\uFE0F **Falla si hay trabajo sin guardar**, y dice cu\xE1l: abrir otra cosa encima lo perder\xEDa, y \xE9sa no es una decisi\xF3n que se tome por el m\xFAsico.",
|
|
124546
126735
|
inputSchema: {
|
|
124547
|
-
ruta: external_exports.string().min(1).describe("La ruta completa en el disco: .mtabs, Guitar Pro (.gp, .gpx, .gp5\u2026)
|
|
126736
|
+
ruta: external_exports.string().min(1).describe("La ruta completa en el disco: .mtabs, Guitar Pro (.gp, .gpx, .gp5\u2026), MusicXML (.musicxml, .xml, .mxl) o MIDI (.mid)")
|
|
124548
126737
|
}
|
|
124549
126738
|
},
|
|
124550
126739
|
async ({ ruta }) => {
|
|
@@ -125010,6 +127199,22 @@ function registrarHerramientasDeEstructura(servidor2) {
|
|
|
125010
127199
|
});
|
|
125011
127200
|
}
|
|
125012
127201
|
);
|
|
127202
|
+
servidor2.registerTool(
|
|
127203
|
+
"diagramas_de_acordes",
|
|
127204
|
+
{
|
|
127205
|
+
title: "Diagramas de acordes",
|
|
127206
|
+
description: "Si los nombres de acorde llevan su cuadrito de trastes: `no` (s\xF3lo el nombre, de f\xE1brica), `partitura` (sobre cada acorde) o `arriba` (una lista al comienzo). Se guarda en la obra. \u26A0\uFE0F El diagrama sale de lo ESCRITO: las notas del golpe, o la forma con que ese acorde est\xE1 escrito en otro lugar de la pista. Un nombre sin notas en ning\xFAn lado queda sin diagrama: el programa no inventa digitaciones. Sin decir nada, contesta c\xF3mo est\xE1.",
|
|
127207
|
+
inputSchema: {
|
|
127208
|
+
donde: external_exports.enum(["no", "partitura", "arriba"]).optional()
|
|
127209
|
+
}
|
|
127210
|
+
},
|
|
127211
|
+
({ donde }) => {
|
|
127212
|
+
const { documento } = obraAbierta();
|
|
127213
|
+
if (donde !== void 0) documento.doc.transact(() => documento.cabecera.set("diagramasDeAcordes", donde));
|
|
127214
|
+
const actual = documento.cabecera.get("diagramasDeAcordes");
|
|
127215
|
+
return texto2({ diagramasDeAcordes: actual === "partitura" || actual === "arriba" ? actual : "no" });
|
|
127216
|
+
}
|
|
127217
|
+
);
|
|
125013
127218
|
servidor2.registerTool(
|
|
125014
127219
|
"estilo_de_la_obra",
|
|
125015
127220
|
{
|
|
@@ -126824,6 +129029,94 @@ function registrarHerramientasDeArchivo(servidor2) {
|
|
|
126824
129029
|
);
|
|
126825
129030
|
}
|
|
126826
129031
|
|
|
129032
|
+
// apps/mcp/src/herramientas/paletas.ts
|
|
129033
|
+
init_src2();
|
|
129034
|
+
init_src3();
|
|
129035
|
+
init_obra();
|
|
129036
|
+
var FAMILIAS = ["figura", "tecnica", "signo", "acorde", "kit", "matiz", "seccion"];
|
|
129037
|
+
function herramientaDeLaFicha(familia, ficha) {
|
|
129038
|
+
const id2 = ficha.id;
|
|
129039
|
+
switch (familia) {
|
|
129040
|
+
case "figura":
|
|
129041
|
+
if (id2 === "puntillo") return { herramienta: "alternar_puntillo", argumentos: {} };
|
|
129042
|
+
if (id2 === "silencio") return { herramienta: "escribir_silencio", argumentos: {} };
|
|
129043
|
+
return { herramienta: "cambiar_duracion", argumentos: { figura: Number(id2.slice("figura-".length)) } };
|
|
129044
|
+
case "tecnica":
|
|
129045
|
+
if (id2.startsWith("efecto-")) return { herramienta: "poner_efecto", argumentos: { clave: id2.slice("efecto-".length) } };
|
|
129046
|
+
if (id2.startsWith("bend-")) return { herramienta: "poner_bend", argumentos: { forma: id2.slice("bend-".length) } };
|
|
129047
|
+
if (id2.startsWith("sube-")) return { herramienta: "poner_bend", argumentos: { cuartos: Number(id2.slice("sube-".length)) } };
|
|
129048
|
+
return { herramienta: "escribir_curva_de_bend", argumentos: {} };
|
|
129049
|
+
case "signo":
|
|
129050
|
+
return { herramienta: "poner_signo", argumentos: { clave: id2.slice("signo-".length) } };
|
|
129051
|
+
case "matiz":
|
|
129052
|
+
return { herramienta: "poner_dinamica", argumentos: { matiz: id2.slice("matiz-".length) } };
|
|
129053
|
+
case "kit": {
|
|
129054
|
+
const pieza = KIT[Number(id2.slice("kit-".length))];
|
|
129055
|
+
return pieza ? { herramienta: "escribir_notas", argumentos: { notas: [{ pieza: pieza.nombre }] } } : null;
|
|
129056
|
+
}
|
|
129057
|
+
case "acorde":
|
|
129058
|
+
if (id2 === MIRA_DEDUCIR) return { herramienta: "acorde_en_el_cursor", argumentos: {} };
|
|
129059
|
+
{
|
|
129060
|
+
const [nombre, letra] = ficha.nombre.split(" ");
|
|
129061
|
+
return { herramienta: "poner_acorde", argumentos: { nombre, ...letra ? { forma: letra } : {} } };
|
|
129062
|
+
}
|
|
129063
|
+
case "seccion":
|
|
129064
|
+
if (id2 === SECCION_NUEVA) return null;
|
|
129065
|
+
return { herramienta: "poner_seccion", argumentos: { nombre: id2.slice("seccion:".length) } };
|
|
129066
|
+
}
|
|
129067
|
+
}
|
|
129068
|
+
function paletasParaBuscar() {
|
|
129069
|
+
let acordes = [];
|
|
129070
|
+
let secciones = [];
|
|
129071
|
+
try {
|
|
129072
|
+
const indice = indexar(obraAbierta().documento);
|
|
129073
|
+
acordes = fichasDeAcordes(acordesUsados(indice)).filter((f) => f.id !== MIRA_DEDUCIR);
|
|
129074
|
+
const nombres = [];
|
|
129075
|
+
for (let i2 = 0; i2 < indice.cantidadDeCompases; i2++) {
|
|
129076
|
+
nombres.push(String(indice.compasMaestro(i2)?.datos.seccion ?? ""));
|
|
129077
|
+
}
|
|
129078
|
+
secciones = fichasDeSecciones(nombres).filter((f) => f.id !== SECCION_NUEVA);
|
|
129079
|
+
} catch {
|
|
129080
|
+
}
|
|
129081
|
+
return FAMILIAS.map((familia) => ({
|
|
129082
|
+
familia,
|
|
129083
|
+
fichas: familia === "acorde" ? acordes : familia === "seccion" ? secciones : fichasFijas(familia)
|
|
129084
|
+
}));
|
|
129085
|
+
}
|
|
129086
|
+
function registrarHerramientasDePaletas(servidor2) {
|
|
129087
|
+
servidor2.registerTool(
|
|
129088
|
+
"buscar_en_las_paletas",
|
|
129089
|
+
{
|
|
129090
|
+
title: "Buscar en las paletas",
|
|
129091
|
+
description: "Busca por nombre en las siete paletas del programa a la vez \u2014figuras, t\xE9cnicas, signos, acordes, bater\xEDa, matices y secciones\u2014 y dice qu\xE9 es cada resultado, en qu\xE9 paleta est\xE1, su tecla de f\xE1brica y **qu\xE9 herramienta lo escribe, con qu\xE9 argumentos**. Acepta sin\xF3nimos en espa\xF1ol y los nombres en ingl\xE9s de los programas: \xABligado\xBB, \xABhammer\xBB, \xABfermata\xBB, \xABhi-hat\xBB. Es la misma b\xFAsqueda de \xABEditar \u25B8 Buscar en las paletas\u2026\xBB. Sirve cuando no sabes la clave de algo: b\xFAscalo ac\xE1 y usa la herramienta que te indica, agregando d\xF3nde (comp\xE1s, golpe, pista\u2026).",
|
|
129092
|
+
inputSchema: {
|
|
129093
|
+
texto: external_exports.string().min(1).max(60).describe("Lo que se busca: \xABacento\xBB, \xABmartillo\xBB, \xABcorchea\xBB, \xABff\xBB\u2026"),
|
|
129094
|
+
limite: external_exports.number().int().min(1).max(30).optional().describe("Cu\xE1ntos resultados, como mucho. Por omisi\xF3n 12.")
|
|
129095
|
+
}
|
|
129096
|
+
},
|
|
129097
|
+
({ texto: buscado, limite }) => {
|
|
129098
|
+
const paletas = paletasParaBuscar();
|
|
129099
|
+
const hayObra = paletas.some((p) => (p.familia === "acorde" || p.familia === "seccion") && p.fichas.length > 0);
|
|
129100
|
+
const resultados = buscarEnLasPaletas(paletas, buscado, limite ?? 12).map((r) => {
|
|
129101
|
+
const tecla = r.ficha.atajo ? ATAJOS.find((a) => a.id === r.ficha.atajo)?.teclas[0] : void 0;
|
|
129102
|
+
return {
|
|
129103
|
+
nombre: r.ficha.nombre,
|
|
129104
|
+
paleta: NOMBRE_DE_LA_FAMILIA[r.familia],
|
|
129105
|
+
...tecla ? { teclaDeFabrica: comoSeLee(tecla) } : {},
|
|
129106
|
+
...herramientaDeLaFicha(r.familia, r.ficha) ?? {}
|
|
129107
|
+
};
|
|
129108
|
+
});
|
|
129109
|
+
return texto2({
|
|
129110
|
+
resultados,
|
|
129111
|
+
// ⚠️ Un cero se tiene que poder leer como «no existe» y no como «no busqué».
|
|
129112
|
+
...resultados.length === 0 ? { nota: `nada se llama \xAB${buscado}\xBB en las paletas` } : {},
|
|
129113
|
+
...hayObra ? {} : { sinObra: "los acordes y las secciones salen de la obra: sin una abierta, no se buscan" },
|
|
129114
|
+
teclas: "las teclas son las de f\xE1brica: el m\xFAsico pudo haberlas reasignado en su navegador"
|
|
129115
|
+
});
|
|
129116
|
+
}
|
|
129117
|
+
);
|
|
129118
|
+
}
|
|
129119
|
+
|
|
126827
129120
|
// apps/mcp/src/servidor.ts
|
|
126828
129121
|
var NOMBRE = "mandioca-tabs";
|
|
126829
129122
|
var VERSION = VERSION_DEL_CONECTOR ?? "0.0.0";
|
|
@@ -126881,6 +129174,7 @@ function crearServidor() {
|
|
|
126881
129174
|
registrarHerramientasDeBend(servidor2);
|
|
126882
129175
|
registrarHerramientasDePistas(servidor2);
|
|
126883
129176
|
registrarHerramientasDeArchivo(servidor2);
|
|
129177
|
+
registrarHerramientasDePaletas(servidor2);
|
|
126884
129178
|
return servidor2;
|
|
126885
129179
|
}
|
|
126886
129180
|
|