@ugfoundation/swaralipi-js 0.7.2 → 0.7.3
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/dist/{batch-W56YUPJC.js → batch-CYQH6Q33.js} +5 -5
- package/dist/{batch-W56YUPJC.js.map → batch-CYQH6Q33.js.map} +1 -1
- package/dist/{chunk-GHWURC4U.js → chunk-2SAZWTTK.js} +8 -10
- package/dist/chunk-2SAZWTTK.js.map +1 -0
- package/dist/{chunk-AAQIY4VS.js → chunk-56NFRQOW.js} +9 -6
- package/dist/chunk-56NFRQOW.js.map +1 -0
- package/dist/{chunk-RLJQ5UIN.js → chunk-PEOVWTJB.js} +4 -4
- package/dist/{chunk-RLJQ5UIN.js.map → chunk-PEOVWTJB.js.map} +1 -1
- package/dist/{chunk-6ETPFHZ6.js → chunk-UF5OSJRP.js} +9 -3
- package/dist/chunk-UF5OSJRP.js.map +1 -0
- package/dist/cli.cjs +7 -4
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +3 -3
- package/dist/convert/index.cjs +6 -3
- package/dist/convert/index.cjs.map +1 -1
- package/dist/convert/index.d.cts +1 -1
- package/dist/convert/index.d.ts +1 -1
- package/dist/convert/index.js +3 -3
- package/dist/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/player/index.cjs +29 -22
- package/dist/player/index.cjs.map +1 -1
- package/dist/player/index.d.cts +3 -12
- package/dist/player/index.d.ts +3 -12
- package/dist/player/index.js +21 -18
- package/dist/player/index.js.map +1 -1
- package/dist/{schedule-CjPcD-Hf.d.cts → schedule-BpBYGXPL.d.cts} +3 -2
- package/dist/{schedule-8WFUBJqB.d.ts → schedule-Tzk01FKj.d.ts} +3 -2
- package/dist/{schema-D_86x4oV.d.ts → schema-DqBXPGkL.d.cts} +13 -4
- package/dist/{schema-D_86x4oV.d.cts → schema-DqBXPGkL.d.ts} +13 -4
- package/dist/spec/index.cjs +14 -3
- package/dist/spec/index.cjs.map +1 -1
- package/dist/spec/index.d.cts +13 -4
- package/dist/spec/index.d.ts +13 -4
- package/dist/spec/index.js +2 -2
- package/dist/viewer/index.cjs +45 -17
- package/dist/viewer/index.cjs.map +1 -1
- package/dist/viewer/index.d.cts +2 -2
- package/dist/viewer/index.d.ts +2 -2
- package/dist/viewer/index.js +18 -8
- package/dist/viewer/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-6ETPFHZ6.js.map +0 -1
- package/dist/chunk-AAQIY4VS.js.map +0 -1
- package/dist/chunk-GHWURC4U.js.map +0 -1
package/dist/player/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as Swaralipi, T as Taal, O as Octave, a as SvaraLetter, N as Note } from '../schema-
|
|
1
|
+
import { S as Swaralipi, T as Taal, O as Octave, a as SvaraLetter, N as Note } from '../schema-DqBXPGkL.cjs';
|
|
2
2
|
import { T as TaalId } from '../taals-CjzBuZ35.cjs';
|
|
3
|
-
import { I as InstrumentId, a as InstrumentDef, S as Schedule, D as DrumVoice } from '../schedule-
|
|
4
|
-
export { A as ARC_RAW_RE, b as DEFAULT_SOUNDS_BASE, c as DRUM_KIT_BASE, G as GlideLeg, d as INSTRUMENTS, M as MEEND_HOLD, P as PlayEvent, e as SALAMANDER_BASE, f as SAMPLED_TAALS, g as ScheduleOptions, T as TABLA_BPMS, h as TABLA_VARIATIONS, i as TONEJS_INSTRUMENTS_BASE, j as ToneModule, k as buildSchedule, l as createBuffers, m as drumPattern, n as glideTargets, o as instrumentSampleUrl, p as isArcRaw, q as meendContinuations, r as nearestSampleKey, s as nearestTablaBpm, t as normalizeBase, u as probeUrl, v as quantizeLoopEnd, w as santoorUrls, x as subsetUrls, y as tablaBpms, z as tablaUrl, B as triggerGlide } from '../schedule-
|
|
3
|
+
import { I as InstrumentId, a as InstrumentDef, S as Schedule, D as DrumVoice } from '../schedule-BpBYGXPL.cjs';
|
|
4
|
+
export { A as ARC_RAW_RE, b as DEFAULT_SOUNDS_BASE, c as DRUM_KIT_BASE, G as GlideLeg, d as INSTRUMENTS, M as MEEND_HOLD, P as PlayEvent, e as SALAMANDER_BASE, f as SAMPLED_TAALS, g as ScheduleOptions, T as TABLA_BPMS, h as TABLA_VARIATIONS, i as TONEJS_INSTRUMENTS_BASE, j as ToneModule, k as buildSchedule, l as createBuffers, m as drumPattern, n as glideTargets, o as instrumentSampleUrl, p as isArcRaw, q as meendContinuations, r as nearestSampleKey, s as nearestTablaBpm, t as normalizeBase, u as probeUrl, v as quantizeLoopEnd, w as santoorUrls, x as subsetUrls, y as tablaBpms, z as tablaUrl, B as triggerGlide } from '../schedule-BpBYGXPL.cjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'tone';
|
|
7
7
|
|
|
@@ -259,15 +259,6 @@ declare function encodeMidi(schedule: Schedule, opts: {
|
|
|
259
259
|
*/
|
|
260
260
|
declare function exportMidi(doc: Swaralipi, options?: MidiExportOptions): MidiExportResult;
|
|
261
261
|
|
|
262
|
-
/**
|
|
263
|
-
* Pure svara → pitch math for the player. No Tone, no audio — unit-testable
|
|
264
|
-
* in plain Node and shared by the scheduler.
|
|
265
|
-
*
|
|
266
|
-
* The model: a tonic (Sa) pitch-class + a per-note scale degree + octave
|
|
267
|
-
* register + komal/tivra/microtone accidentals → an absolute MIDI number,
|
|
268
|
-
* which the Tone.Sampler pitch-shifts from the nearest santoor sample.
|
|
269
|
-
*/
|
|
270
|
-
|
|
271
262
|
/** Octave register offset in octaves, relative to madhyam (middle). */
|
|
272
263
|
declare const OCTAVE_OFFSET: Record<Octave, number>;
|
|
273
264
|
/**
|
package/dist/player/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as Swaralipi, T as Taal, O as Octave, a as SvaraLetter, N as Note } from '../schema-
|
|
1
|
+
import { S as Swaralipi, T as Taal, O as Octave, a as SvaraLetter, N as Note } from '../schema-DqBXPGkL.js';
|
|
2
2
|
import { T as TaalId } from '../taals-CjzBuZ35.js';
|
|
3
|
-
import { I as InstrumentId, a as InstrumentDef, S as Schedule, D as DrumVoice } from '../schedule-
|
|
4
|
-
export { A as ARC_RAW_RE, b as DEFAULT_SOUNDS_BASE, c as DRUM_KIT_BASE, G as GlideLeg, d as INSTRUMENTS, M as MEEND_HOLD, P as PlayEvent, e as SALAMANDER_BASE, f as SAMPLED_TAALS, g as ScheduleOptions, T as TABLA_BPMS, h as TABLA_VARIATIONS, i as TONEJS_INSTRUMENTS_BASE, j as ToneModule, k as buildSchedule, l as createBuffers, m as drumPattern, n as glideTargets, o as instrumentSampleUrl, p as isArcRaw, q as meendContinuations, r as nearestSampleKey, s as nearestTablaBpm, t as normalizeBase, u as probeUrl, v as quantizeLoopEnd, w as santoorUrls, x as subsetUrls, y as tablaBpms, z as tablaUrl, B as triggerGlide } from '../schedule-
|
|
3
|
+
import { I as InstrumentId, a as InstrumentDef, S as Schedule, D as DrumVoice } from '../schedule-Tzk01FKj.js';
|
|
4
|
+
export { A as ARC_RAW_RE, b as DEFAULT_SOUNDS_BASE, c as DRUM_KIT_BASE, G as GlideLeg, d as INSTRUMENTS, M as MEEND_HOLD, P as PlayEvent, e as SALAMANDER_BASE, f as SAMPLED_TAALS, g as ScheduleOptions, T as TABLA_BPMS, h as TABLA_VARIATIONS, i as TONEJS_INSTRUMENTS_BASE, j as ToneModule, k as buildSchedule, l as createBuffers, m as drumPattern, n as glideTargets, o as instrumentSampleUrl, p as isArcRaw, q as meendContinuations, r as nearestSampleKey, s as nearestTablaBpm, t as normalizeBase, u as probeUrl, v as quantizeLoopEnd, w as santoorUrls, x as subsetUrls, y as tablaBpms, z as tablaUrl, B as triggerGlide } from '../schedule-Tzk01FKj.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'tone';
|
|
7
7
|
|
|
@@ -259,15 +259,6 @@ declare function encodeMidi(schedule: Schedule, opts: {
|
|
|
259
259
|
*/
|
|
260
260
|
declare function exportMidi(doc: Swaralipi, options?: MidiExportOptions): MidiExportResult;
|
|
261
261
|
|
|
262
|
-
/**
|
|
263
|
-
* Pure svara → pitch math for the player. No Tone, no audio — unit-testable
|
|
264
|
-
* in plain Node and shared by the scheduler.
|
|
265
|
-
*
|
|
266
|
-
* The model: a tonic (Sa) pitch-class + a per-note scale degree + octave
|
|
267
|
-
* register + komal/tivra/microtone accidentals → an absolute MIDI number,
|
|
268
|
-
* which the Tone.Sampler pitch-shifts from the nearest santoor sample.
|
|
269
|
-
*/
|
|
270
|
-
|
|
271
262
|
/** Octave register offset in octaves, relative to madhyam (middle). */
|
|
272
263
|
declare const OCTAVE_OFFSET: Record<Octave, number>;
|
|
273
264
|
/**
|
package/dist/player/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DEFAULT_SOUNDS_BASE, INSTRUMENTS, SAMPLED_TAALS, instrumentSampleUrl, probeUrl, normalizeBase, nearestTablaBpm, tablaBpms, buildSchedule, quantizeLoopEnd, midiToSampleName, glideTargets, triggerGlide, createSampler, createBuffers, tablaUrl, tablaShiftSemitones, TABLA_GRAIN_OVERLAP_SEC, TABLA_GRAIN_SEC, createDrumKit, drumPattern, createMetronome, TANPURA_PCS, createTanpura, parseTonic, MEEND_HOLD, sCurve } from '../chunk-
|
|
2
|
-
export { ARC_RAW_RE, DEFAULT_SOUNDS_BASE, DRUM_KIT_BASE, INSTRUMENTS, MEEND_HOLD, OCTAVE_OFFSET, SALAMANDER_BASE, SAMPLED_TAALS, SHUDDHA, TABLA_BPMS, TABLA_VARIATIONS, TONEJS_INSTRUMENTS_BASE, buildSchedule, createBuffers, drumPattern, glideTargets, instrumentSampleUrl, isArcRaw, meendContinuations, midiToSampleName, nearestSampleKey, nearestTablaBpm, normalizeBase, parseTonic, probeUrl, quantizeLoopEnd, sCurve, sampleFileName, santoorUrls, subsetUrls, svaraSemitone, svaraToMidi, tablaBpms, tablaUrl, triggerGlide } from '../chunk-
|
|
3
|
-
import { TAALS } from '../chunk-
|
|
1
|
+
import { DEFAULT_SOUNDS_BASE, INSTRUMENTS, SAMPLED_TAALS, instrumentSampleUrl, probeUrl, normalizeBase, nearestTablaBpm, tablaBpms, buildSchedule, quantizeLoopEnd, midiToSampleName, glideTargets, triggerGlide, createSampler, createBuffers, tablaUrl, tablaShiftSemitones, TABLA_GRAIN_OVERLAP_SEC, TABLA_GRAIN_SEC, createDrumKit, drumPattern, createMetronome, TANPURA_PCS, createTanpura, parseTonic, MEEND_HOLD, sCurve } from '../chunk-2SAZWTTK.js';
|
|
2
|
+
export { ARC_RAW_RE, DEFAULT_SOUNDS_BASE, DRUM_KIT_BASE, INSTRUMENTS, MEEND_HOLD, OCTAVE_OFFSET, SALAMANDER_BASE, SAMPLED_TAALS, SHUDDHA, TABLA_BPMS, TABLA_VARIATIONS, TONEJS_INSTRUMENTS_BASE, buildSchedule, createBuffers, drumPattern, glideTargets, instrumentSampleUrl, isArcRaw, meendContinuations, midiToSampleName, nearestSampleKey, nearestTablaBpm, normalizeBase, parseTonic, probeUrl, quantizeLoopEnd, sCurve, sampleFileName, santoorUrls, subsetUrls, svaraSemitone, svaraToMidi, tablaBpms, tablaUrl, triggerGlide } from '../chunk-2SAZWTTK.js';
|
|
3
|
+
import { TAALS } from '../chunk-UF5OSJRP.js';
|
|
4
4
|
|
|
5
5
|
// src/player/player.ts
|
|
6
6
|
var STOP_FADE_SEC = 0.5;
|
|
@@ -8,7 +8,7 @@ function midiRange(schedule) {
|
|
|
8
8
|
let lo = Infinity;
|
|
9
9
|
let hi = -Infinity;
|
|
10
10
|
for (const ev of schedule.events) {
|
|
11
|
-
for (const m of [ev.midi, ev.kan]) {
|
|
11
|
+
for (const m of [ev.midi, ...ev.kan]) {
|
|
12
12
|
if (m !== null) {
|
|
13
13
|
if (m < lo) lo = m;
|
|
14
14
|
if (m > hi) hi = m;
|
|
@@ -413,10 +413,11 @@ var SwaralipiPlayer = class {
|
|
|
413
413
|
if (ev.midi !== null && ev.glide !== true) {
|
|
414
414
|
const name = midiToSampleName(ev.midi);
|
|
415
415
|
const dur = Math.max(ev.durationBeats * spb, 0.05);
|
|
416
|
-
|
|
417
|
-
const kanName = midiToSampleName(
|
|
418
|
-
|
|
419
|
-
|
|
416
|
+
ev.kan.forEach((k, gi) => {
|
|
417
|
+
const kanName = midiToSampleName(k);
|
|
418
|
+
const lead = spb * 0.12 * (ev.kan.length - gi);
|
|
419
|
+
transport.scheduleOnce((time) => melody.triggerAttackRelease(kanName, spb * 0.4, time), Math.max(at - lead, 0));
|
|
420
|
+
});
|
|
420
421
|
const targets = glide !== void 0 ? glideTargets(schedule.events, i) : [];
|
|
421
422
|
if (targets.length > 0 && glide !== void 0) {
|
|
422
423
|
const last = targets[targets.length - 1];
|
|
@@ -589,7 +590,7 @@ function midiRange2(schedule) {
|
|
|
589
590
|
let lo = Infinity;
|
|
590
591
|
let hi = -Infinity;
|
|
591
592
|
for (const ev of schedule.events) {
|
|
592
|
-
for (const m of [ev.midi, ev.kan]) {
|
|
593
|
+
for (const m of [ev.midi, ...ev.kan]) {
|
|
593
594
|
if (m !== null) {
|
|
594
595
|
if (m < lo) lo = m;
|
|
595
596
|
if (m > hi) hi = m;
|
|
@@ -645,10 +646,11 @@ async function exportAudio(doc, options = {}) {
|
|
|
645
646
|
if (ev.midi === null || ev.glide === true) return;
|
|
646
647
|
const at = ev.beat * spb + shift;
|
|
647
648
|
const dur = Math.max(ev.durationBeats * spb, 0.05);
|
|
648
|
-
|
|
649
|
-
const name = midiToSampleName(
|
|
650
|
-
|
|
651
|
-
|
|
649
|
+
ev.kan.forEach((k, gi) => {
|
|
650
|
+
const name = midiToSampleName(k);
|
|
651
|
+
const lead = spb * 0.12 * (ev.kan.length - gi);
|
|
652
|
+
transport.scheduleOnce((t) => sampler.triggerAttackRelease(name, spb * 0.4, t), Math.max(at - lead, 0));
|
|
653
|
+
});
|
|
652
654
|
const targets = glide !== void 0 ? glideTargets(schedule.events, i) : [];
|
|
653
655
|
if (targets.length > 0 && glide !== void 0) {
|
|
654
656
|
const last = targets[targets.length - 1];
|
|
@@ -887,11 +889,12 @@ function encodeMidi(schedule, opts) {
|
|
|
887
889
|
const targets = glideTargets(schedule.events, i);
|
|
888
890
|
const last = targets[targets.length - 1] ?? ev;
|
|
889
891
|
const end = Math.max(Math.round((last.beat + last.durationBeats) * PPQ), start + 1);
|
|
890
|
-
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
melody.push({ tick:
|
|
894
|
-
|
|
892
|
+
ev.kan.forEach((k, gi) => {
|
|
893
|
+
const gap = Math.round(0.12 * PPQ);
|
|
894
|
+
const kOn = Math.max(start - gap * (ev.kan.length - gi), 0);
|
|
895
|
+
melody.push({ tick: kOn, on: true, note: k, vel: 70, ch: 0 });
|
|
896
|
+
melody.push({ tick: Math.max(kOn + 1, start - gap * (ev.kan.length - gi - 1)), on: false, note: k, vel: 0, ch: 0 });
|
|
897
|
+
});
|
|
895
898
|
melody.push({ tick: start, on: true, note: ev.midi, vel: 100, ch: 0 });
|
|
896
899
|
melody.push({ tick: end, on: false, note: ev.midi, vel: 0, ch: 0 });
|
|
897
900
|
let from = ev;
|