@ugfoundation/swaralipi-js 0.9.0 → 0.9.2

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.
Files changed (39) hide show
  1. package/README.md +1 -1
  2. package/dist/{batch-PYBXQ4OM.js → batch-IHEXFEGC.js} +4 -4
  3. package/dist/{batch-PYBXQ4OM.js.map → batch-IHEXFEGC.js.map} +1 -1
  4. package/dist/{chunk-3ZQPM2CE.js → chunk-F23LZMIU.js} +3 -3
  5. package/dist/{chunk-3ZQPM2CE.js.map → chunk-F23LZMIU.js.map} +1 -1
  6. package/dist/{chunk-7SMRG4IS.js → chunk-SEN266BY.js} +16 -6
  7. package/dist/chunk-SEN266BY.js.map +1 -0
  8. package/dist/{chunk-RT4SVJMK.js → chunk-TZBDIRIA.js} +3 -3
  9. package/dist/{chunk-RT4SVJMK.js.map → chunk-TZBDIRIA.js.map} +1 -1
  10. package/dist/cli.cjs +1 -1
  11. package/dist/cli.cjs.map +1 -1
  12. package/dist/cli.js +2 -2
  13. package/dist/convert/index.cjs +1 -1
  14. package/dist/convert/index.cjs.map +1 -1
  15. package/dist/convert/index.js +2 -2
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/player/index.cjs +36 -23
  20. package/dist/player/index.cjs.map +1 -1
  21. package/dist/player/index.d.cts +2 -2
  22. package/dist/player/index.d.ts +2 -2
  23. package/dist/player/index.js +23 -22
  24. package/dist/player/index.js.map +1 -1
  25. package/dist/{schedule-9uvjnCG_.d.ts → schedule-BaovCtmf.d.ts} +17 -3
  26. package/dist/{schedule-TxSfHL-T.d.cts → schedule-CU-VECDH.d.cts} +17 -3
  27. package/dist/spec/index.cjs +1 -1
  28. package/dist/spec/index.cjs.map +1 -1
  29. package/dist/spec/index.d.cts +1 -1
  30. package/dist/spec/index.d.ts +1 -1
  31. package/dist/spec/index.js +1 -1
  32. package/dist/viewer/index.cjs +11 -5
  33. package/dist/viewer/index.cjs.map +1 -1
  34. package/dist/viewer/index.d.cts +1 -1
  35. package/dist/viewer/index.d.ts +1 -1
  36. package/dist/viewer/index.js +5 -2
  37. package/dist/viewer/index.js.map +1 -1
  38. package/package.json +1 -1
  39. package/dist/chunk-7SMRG4IS.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { S as Swaralipi, T as Taal, O as Octave, a as SvaraLetter, N as Note } from '../schema-Cf_epUIC.cjs';
2
2
  import { a as LaySpeeds, T as TaalId } from '../lay-CfDlPhH2.cjs';
3
3
  export { b as LAYS, c as LAY_SPEEDS, L as Lay, p as printedLay, r as resolveLaySpeeds, d as rowLay } from '../lay-CfDlPhH2.cjs';
4
- import { I as InstrumentId, a as InstrumentDef, S as Schedule, D as DrumVoice, T as TempoSegment } from '../schedule-TxSfHL-T.cjs';
5
- 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, h as TABLA_BPMS, i as TABLA_VARIATIONS, j as TONEJS_INSTRUMENTS_BASE, k as ToneModule, l as buildSchedule, m as createBuffers, n as drumPattern, o as glideTargets, p as instrumentSampleUrl, q as isArcRaw, r as meendContinuations, s as nearestSampleKey, t as nearestTablaBpm, u as normalizeBase, v as probeUrl, w as quantizeLoopEnd, x as santoorUrls, y as subsetUrls, z as tablaBpms, B as tablaUrl, C as triggerGlide } from '../schedule-TxSfHL-T.cjs';
4
+ import { I as InstrumentId, a as InstrumentDef, S as Schedule, D as DrumVoice, T as TempoSegment } from '../schedule-CU-VECDH.cjs';
5
+ export { A as ARC_RAW_RE, b as DEFAULT_SOUNDS_BASE, c as DRUM_KIT_BASE, G as GRACE_STEP, d as GlideLeg, e as INSTRUMENTS, M as MEEND_HOLD, P as PlayEvent, f as SALAMANDER_BASE, g as SAMPLED_TAALS, h as ScheduleOptions, i as TABLA_BPMS, j as TABLA_VARIATIONS, k as TONEJS_INSTRUMENTS_BASE, l as ToneModule, m as buildSchedule, n as createBuffers, o as drumPattern, p as glideTargets, q as graceTouches, r as instrumentSampleUrl, s as isArcRaw, t as meendContinuations, u as nearestSampleKey, v as nearestTablaBpm, w as normalizeBase, x as probeUrl, y as quantizeLoopEnd, z as santoorUrls, B as subsetUrls, C as tablaBpms, E as tablaUrl, F as triggerGlide } from '../schedule-CU-VECDH.cjs';
6
6
  import 'zod';
7
7
  import 'tone';
8
8
 
@@ -1,8 +1,8 @@
1
1
  import { S as Swaralipi, T as Taal, O as Octave, a as SvaraLetter, N as Note } from '../schema-Cf_epUIC.js';
2
2
  import { a as LaySpeeds, T as TaalId } from '../lay-CZIzR9cM.js';
3
3
  export { b as LAYS, c as LAY_SPEEDS, L as Lay, p as printedLay, r as resolveLaySpeeds, d as rowLay } from '../lay-CZIzR9cM.js';
4
- import { I as InstrumentId, a as InstrumentDef, S as Schedule, D as DrumVoice, T as TempoSegment } from '../schedule-9uvjnCG_.js';
5
- 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, h as TABLA_BPMS, i as TABLA_VARIATIONS, j as TONEJS_INSTRUMENTS_BASE, k as ToneModule, l as buildSchedule, m as createBuffers, n as drumPattern, o as glideTargets, p as instrumentSampleUrl, q as isArcRaw, r as meendContinuations, s as nearestSampleKey, t as nearestTablaBpm, u as normalizeBase, v as probeUrl, w as quantizeLoopEnd, x as santoorUrls, y as subsetUrls, z as tablaBpms, B as tablaUrl, C as triggerGlide } from '../schedule-9uvjnCG_.js';
4
+ import { I as InstrumentId, a as InstrumentDef, S as Schedule, D as DrumVoice, T as TempoSegment } from '../schedule-BaovCtmf.js';
5
+ export { A as ARC_RAW_RE, b as DEFAULT_SOUNDS_BASE, c as DRUM_KIT_BASE, G as GRACE_STEP, d as GlideLeg, e as INSTRUMENTS, M as MEEND_HOLD, P as PlayEvent, f as SALAMANDER_BASE, g as SAMPLED_TAALS, h as ScheduleOptions, i as TABLA_BPMS, j as TABLA_VARIATIONS, k as TONEJS_INSTRUMENTS_BASE, l as ToneModule, m as buildSchedule, n as createBuffers, o as drumPattern, p as glideTargets, q as graceTouches, r as instrumentSampleUrl, s as isArcRaw, t as meendContinuations, u as nearestSampleKey, v as nearestTablaBpm, w as normalizeBase, x as probeUrl, y as quantizeLoopEnd, z as santoorUrls, B as subsetUrls, C as tablaBpms, E as tablaUrl, F as triggerGlide } from '../schedule-BaovCtmf.js';
6
6
  import 'zod';
7
7
  import 'tone';
8
8
 
@@ -1,5 +1,5 @@
1
- import { DEFAULT_SOUNDS_BASE, INSTRUMENTS, SAMPLED_TAALS, buildSchedule, quantizeLoopEnd, instrumentSampleUrl, probeUrl, normalizeBase, nearestTablaBpm, tablaBpms, midiToSampleName, glideTargets, triggerGlide, createSampler, createBuffers, tablaShiftSemitones, tablaUrl, TABLA_GRAIN_OVERLAP_SEC, TABLA_GRAIN_SEC, createDrumKit, drumPattern, createMetronome, TANPURA_PCS, createTanpura, parseTonic, MEEND_HOLD, sCurve } from '../chunk-7SMRG4IS.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-7SMRG4IS.js';
1
+ import { DEFAULT_SOUNDS_BASE, INSTRUMENTS, SAMPLED_TAALS, buildSchedule, quantizeLoopEnd, instrumentSampleUrl, probeUrl, normalizeBase, nearestTablaBpm, tablaBpms, graceTouches, midiToSampleName, glideTargets, triggerGlide, createSampler, createBuffers, tablaShiftSemitones, tablaUrl, TABLA_GRAIN_OVERLAP_SEC, TABLA_GRAIN_SEC, createDrumKit, drumPattern, createMetronome, TANPURA_PCS, createTanpura, parseTonic, GRACE_STEP, MEEND_HOLD, sCurve } from '../chunk-SEN266BY.js';
2
+ export { ARC_RAW_RE, DEFAULT_SOUNDS_BASE, DRUM_KIT_BASE, GRACE_STEP, INSTRUMENTS, MEEND_HOLD, OCTAVE_OFFSET, SALAMANDER_BASE, SAMPLED_TAALS, SHUDDHA, TABLA_BPMS, TABLA_VARIATIONS, TONEJS_INSTRUMENTS_BASE, buildSchedule, createBuffers, drumPattern, glideTargets, graceTouches, instrumentSampleUrl, isArcRaw, meendContinuations, midiToSampleName, nearestSampleKey, nearestTablaBpm, normalizeBase, parseTonic, probeUrl, quantizeLoopEnd, sCurve, sampleFileName, santoorUrls, subsetUrls, svaraSemitone, svaraToMidi, tablaBpms, tablaUrl, triggerGlide } from '../chunk-SEN266BY.js';
3
3
  import { TAALS } from '../chunk-MYVIQU4O.js';
4
4
  export { LAYS, LAY_SPEEDS, printedLay, resolveLaySpeeds, rowLay } from '../chunk-MYVIQU4O.js';
5
5
 
@@ -14,7 +14,7 @@ function midiRange(schedule) {
14
14
  let lo = Infinity;
15
15
  let hi = -Infinity;
16
16
  for (const ev of schedule.events) {
17
- for (const m of [ev.midi, ...ev.kan]) {
17
+ for (const m of [ev.midi, ...ev.kan, ...ev.resh]) {
18
18
  if (m !== null) {
19
19
  if (m < lo) lo = m;
20
20
  if (m > hi) hi = m;
@@ -467,14 +467,15 @@ var SwaralipiPlayer = class {
467
467
  const mediaLead = Math.min(MEDIA_LEAD_SEC, spb);
468
468
  schedule.events.forEach((ev, i) => {
469
469
  const at = ev.beat * spb + shift;
470
+ if (ev.glide !== true) {
471
+ for (const g of graceTouches(ev)) {
472
+ const graceName = midiToSampleName(g.midi);
473
+ transport.scheduleOnce((time) => melody.triggerAttackRelease(graceName, spb * 0.4, time), Math.max(g.beat * spb + shift, 0));
474
+ }
475
+ }
470
476
  if (ev.midi !== null && ev.glide !== true) {
471
477
  const name = midiToSampleName(ev.midi);
472
478
  const dur = Math.max(ev.durationBeats * spb, 0.05);
473
- ev.kan.forEach((k, gi) => {
474
- const kanName = midiToSampleName(k);
475
- const lead = spb * 0.12 * (ev.kan.length - gi);
476
- transport.scheduleOnce((time) => melody.triggerAttackRelease(kanName, spb * 0.4, time), Math.max(at - lead, 0));
477
- });
478
479
  const targets = glide !== void 0 ? glideTargets(schedule.events, i) : [];
479
480
  if (targets.length > 0 && glide !== void 0) {
480
481
  const last = targets[targets.length - 1];
@@ -701,7 +702,7 @@ function midiRange2(schedule) {
701
702
  let lo = Infinity;
702
703
  let hi = -Infinity;
703
704
  for (const ev of schedule.events) {
704
- for (const m of [ev.midi, ...ev.kan]) {
705
+ for (const m of [ev.midi, ...ev.kan, ...ev.resh]) {
705
706
  if (m !== null) {
706
707
  if (m < lo) lo = m;
707
708
  if (m > hi) hi = m;
@@ -758,14 +759,14 @@ async function exportAudio(doc, options = {}) {
758
759
  const sampler = createSampler(Tone, def, base, range).connect(master);
759
760
  const glide = schedule.events.some((ev) => ev.glide === true) ? createBuffers(Tone, def, base, range) : void 0;
760
761
  schedule.events.forEach((ev, i) => {
761
- if (ev.midi === null || ev.glide === true) return;
762
+ if (ev.glide === true) return;
763
+ for (const g of graceTouches(ev)) {
764
+ const name = midiToSampleName(g.midi);
765
+ transport.scheduleOnce((t) => sampler.triggerAttackRelease(name, spb * 0.4, t), Math.max(g.beat * spb + shift, 0));
766
+ }
767
+ if (ev.midi === null) return;
762
768
  const at = ev.beat * spb + shift;
763
769
  const dur = Math.max(ev.durationBeats * spb, 0.05);
764
- ev.kan.forEach((k, gi) => {
765
- const name = midiToSampleName(k);
766
- const lead = spb * 0.12 * (ev.kan.length - gi);
767
- transport.scheduleOnce((t) => sampler.triggerAttackRelease(name, spb * 0.4, t), Math.max(at - lead, 0));
768
- });
769
770
  const targets = glide !== void 0 ? glideTargets(schedule.events, i) : [];
770
771
  if (targets.length > 0 && glide !== void 0) {
771
772
  const last = targets[targets.length - 1];
@@ -1041,17 +1042,17 @@ function encodeMidi(schedule, opts) {
1041
1042
  const hasGlide = schedule.events.some((ev) => ev.glide === true);
1042
1043
  if (hasGlide) melody.push(...bendRangeSetup());
1043
1044
  schedule.events.forEach((ev, i) => {
1044
- if (ev.midi === null || ev.glide === true) return;
1045
+ if (ev.glide === true) return;
1046
+ for (const g of graceTouches(ev)) {
1047
+ const on = Math.max(Math.round(g.beat * PPQ), 0);
1048
+ melody.push({ tick: on, on: true, note: g.midi, vel: 70, ch: 0 });
1049
+ melody.push({ tick: Math.max(on + 1, Math.round((g.beat + GRACE_STEP) * PPQ)), on: false, note: g.midi, vel: 0, ch: 0 });
1050
+ }
1051
+ if (ev.midi === null) return;
1045
1052
  const start = Math.round(ev.beat * PPQ);
1046
1053
  const targets = glideTargets(schedule.events, i);
1047
1054
  const last = targets[targets.length - 1] ?? ev;
1048
1055
  const end = Math.max(Math.round((last.beat + last.durationBeats) * PPQ), start + 1);
1049
- ev.kan.forEach((k, gi) => {
1050
- const gap = Math.round(0.12 * PPQ);
1051
- const kOn = Math.max(start - gap * (ev.kan.length - gi), 0);
1052
- melody.push({ tick: kOn, on: true, note: k, vel: 70, ch: 0 });
1053
- melody.push({ tick: Math.max(kOn + 1, start - gap * (ev.kan.length - gi - 1)), on: false, note: k, vel: 0, ch: 0 });
1054
- });
1055
1056
  melody.push({ tick: start, on: true, note: ev.midi, vel: 100, ch: 0 });
1056
1057
  melody.push({ tick: end, on: false, note: ev.midi, vel: 0, ch: 0 });
1057
1058
  let from = ev;