@ugfoundation/swaralipi-js 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/{batch-V4X3GN4N.js → batch-RUZGM2NR.js} +4 -4
- package/dist/{batch-V4X3GN4N.js.map → batch-RUZGM2NR.js.map} +1 -1
- package/dist/{chunk-6QW7MSJO.js → chunk-GHWURC4U.js} +98 -6
- package/dist/chunk-GHWURC4U.js.map +1 -0
- package/dist/{chunk-RTKWFJFI.js → chunk-ULK7NVKH.js} +8 -6
- package/dist/chunk-ULK7NVKH.js.map +1 -0
- package/dist/{chunk-ZS43BDP7.js → chunk-ZNVTOY7J.js} +7 -6
- package/dist/chunk-ZNVTOY7J.js.map +1 -0
- package/dist/cli.cjs +11 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/convert/index.cjs +10 -7
- package/dist/convert/index.cjs.map +1 -1
- package/dist/convert/index.d.cts +4 -3
- package/dist/convert/index.d.ts +4 -3
- package/dist/convert/index.js +2 -2
- package/dist/index.cjs +6 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/player/index.cjs +222 -23
- package/dist/player/index.cjs.map +1 -1
- package/dist/player/index.d.cts +16 -4
- package/dist/player/index.d.ts +16 -4
- package/dist/player/index.js +120 -22
- package/dist/player/index.js.map +1 -1
- package/dist/{schedule-CAns78TD.d.ts → schedule-8WFUBJqB.d.ts} +82 -7
- package/dist/{schedule-D3JyEhuO.d.cts → schedule-CjPcD-Hf.d.cts} +82 -7
- package/dist/{schema-D3wyNRqM.d.ts → schema-D_86x4oV.d.cts} +21 -6
- package/dist/{schema-D3wyNRqM.d.cts → schema-D_86x4oV.d.ts} +21 -6
- package/dist/spec/index.cjs +6 -4
- package/dist/spec/index.cjs.map +1 -1
- package/dist/spec/index.d.cts +3 -3
- package/dist/spec/index.d.ts +3 -3
- package/dist/spec/index.js +1 -1
- package/dist/viewer/index.cjs +253 -172
- package/dist/viewer/index.cjs.map +1 -1
- package/dist/viewer/index.d.cts +16 -23
- package/dist/viewer/index.d.ts +16 -23
- package/dist/viewer/index.js +88 -47
- package/dist/viewer/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-6QW7MSJO.js.map +0 -1
- package/dist/chunk-RTKWFJFI.js.map +0 -1
- package/dist/chunk-ZS43BDP7.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as tone from 'tone';
|
|
2
|
-
import { T as Taal, S as Swaralipi } from './schema-
|
|
2
|
+
import { T as Taal, S as Swaralipi, N as Note } from './schema-D_86x4oV.cjs';
|
|
3
3
|
import { T as TaalId } from './taals-CjzBuZ35.cjs';
|
|
4
4
|
|
|
5
5
|
/** The dynamically-imported Tone module, typed without importing it. */
|
|
@@ -23,11 +23,11 @@ interface InstrumentDef {
|
|
|
23
23
|
type InstrumentId = string;
|
|
24
24
|
/**
|
|
25
25
|
* Default host for the project's samples (santoor / tabla / tanpura /
|
|
26
|
-
* metronome) —
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* metronome) — CORS-enabled, so the player works with zero config. Override via
|
|
27
|
+
* the player's `soundsBaseUrl` to self-host. (Melody defaults to the CDN-hosted
|
|
28
|
+
* piano, so it needs no host.) Licences: see THIRD-PARTY.md.
|
|
29
29
|
*/
|
|
30
|
-
declare const DEFAULT_SOUNDS_BASE = "https://
|
|
30
|
+
declare const DEFAULT_SOUNDS_BASE = "https://bitoron.pages.dev/audio/instruments/";
|
|
31
31
|
/** CC-BY Salamander Grand Piano (Tone's de-facto piano), CDN-hosted. */
|
|
32
32
|
declare const SALAMANDER_BASE = "https://tonejs.github.io/audio/salamander/";
|
|
33
33
|
/** CC-BY tonejs-instruments sample CDN (harmonium/violin/flute). */
|
|
@@ -110,6 +110,34 @@ type DrumVoice = 'kick' | 'snare' | 'hihat' | 'tom1' | 'tom2' | 'tom3';
|
|
|
110
110
|
* kit's groove going the way a tabla's filler strokes do).
|
|
111
111
|
*/
|
|
112
112
|
declare function drumPattern(taal: Pick<Taal, 'numBeats' | 'sam' | 'bhaags' | 'khaali'>): DrumVoice[];
|
|
113
|
+
/**
|
|
114
|
+
* Fraction of the gap between two মীড় notes spent holding the source pitch
|
|
115
|
+
* before the slide begins. 0 = slide the whole way (an alaap-slow meend);
|
|
116
|
+
* 0.5 = hold half the note, then roll into the target.
|
|
117
|
+
*/
|
|
118
|
+
declare const MEEND_HOLD = 0.5;
|
|
119
|
+
/** Sampler `urls` key whose pitch is nearest `midi` (the sample to slide). */
|
|
120
|
+
declare function nearestSampleKey(urls: Record<string, string>, midi: number): string;
|
|
121
|
+
/** The same samples `createSampler` loads, as raw buffers for the glide voice. */
|
|
122
|
+
declare function createBuffers(Tone: ToneModule, def: InstrumentDef, soundsBaseUrl: string | undefined, range?: {
|
|
123
|
+
lo: number;
|
|
124
|
+
hi: number;
|
|
125
|
+
}): {
|
|
126
|
+
buffers: tone.ToneAudioBuffers;
|
|
127
|
+
urls: Record<string, string>;
|
|
128
|
+
};
|
|
129
|
+
/** One মীড় leg: the pitch to reach and the absolute time to reach it by. */
|
|
130
|
+
interface GlideLeg {
|
|
131
|
+
midi: number;
|
|
132
|
+
/** Seconds on the transport; `legs[0]` is the attack itself. */
|
|
133
|
+
at: number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Sound one মীড় phrase: a single attack on `legs[0]` whose pitch then slides
|
|
137
|
+
* through every following leg, ending at `endSec`. Used by both the live
|
|
138
|
+
* player and the offline export.
|
|
139
|
+
*/
|
|
140
|
+
declare function triggerGlide(Tone: ToneModule, buffers: InstanceType<ToneModule['ToneAudioBuffers']>, urls: Record<string, string>, dest: InstanceType<ToneModule['Gain']>, legs: readonly GlideLeg[], endSec: number, release?: number, hold?: number): void;
|
|
113
141
|
|
|
114
142
|
/**
|
|
115
143
|
* Pure spec-doc → playback timeline. No Tone, no audio — the player turns
|
|
@@ -138,6 +166,13 @@ interface PlayEvent {
|
|
|
138
166
|
/** `part.row.note` highlight path. */
|
|
139
167
|
path: string;
|
|
140
168
|
kind: 'note' | 'rest' | 'sustain';
|
|
169
|
+
/**
|
|
170
|
+
* মীড়: this pitch is reached by **gliding** from the previous pitched event,
|
|
171
|
+
* not by a new attack. The two (or more) notes are one continuous sound whose
|
|
172
|
+
* pitch travels — see `meendContinuations`. Consumers pair an attack with its
|
|
173
|
+
* targets via `glideTargets`.
|
|
174
|
+
*/
|
|
175
|
+
glide?: true;
|
|
141
176
|
}
|
|
142
177
|
interface Schedule {
|
|
143
178
|
events: PlayEvent[];
|
|
@@ -160,6 +195,41 @@ interface ScheduleOptions {
|
|
|
160
195
|
/** Octave of madhyam Sa (C4 = MIDI 60). Default 4. */
|
|
161
196
|
baseOctave?: number;
|
|
162
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Below-annotation raws that are মীড় arc drawing segments (codec known-raw):
|
|
200
|
+
* `w`/`x` are the left/right curled ends, the rest are straight fill pieces.
|
|
201
|
+
* Lives here rather than in the viewer because **both** need it and the viewer
|
|
202
|
+
* may import the player (never the reverse — that would pull Tone into it).
|
|
203
|
+
*/
|
|
204
|
+
declare const ARC_RAW_RE: RegExp;
|
|
205
|
+
declare const isArcRaw: (raw: string | undefined) => raw is string;
|
|
206
|
+
/**
|
|
207
|
+
* Note indices in one row that lie under a মীড় arc **without opening it** —
|
|
208
|
+
* i.e. every note the pitch glides *to*, as opposed to the one it glides
|
|
209
|
+
* *from*.
|
|
210
|
+
*
|
|
211
|
+
* Swarabitan's legend defines the under-arc as "কোনো এক স্বর যখন আর এক স্বরে
|
|
212
|
+
* বিশেষরূপে গড়াইয়া যায়" — when one svara *rolls into* another (example:
|
|
213
|
+
* ণা‿পা). It is one continuous phonation, which is why 90 % of the corpus's
|
|
214
|
+
* 7 419 arcs end on a melisma (a note under the *same* held syllable, lyric ৹).
|
|
215
|
+
* So the notes under an arc must not be re-articulated: only the first sounds.
|
|
216
|
+
*
|
|
217
|
+
* Two encodings feed the same scan — the converter's below-row `w`/`x` raws
|
|
218
|
+
* (every meend in the 1738-song corpus) and the spec's own `meend: start|end`
|
|
219
|
+
* (what the creator writes). A cell may carry both ends (`xw` =
|
|
220
|
+
* close then re-open, `wx` = an arc drawn inside the one cell), so marks are
|
|
221
|
+
* read **in order** — reading them as an unordered set left a `wx` arc open and
|
|
222
|
+
* slurred the next eighteen notes into a single slide. Arcs are resolved per row — exactly one arc in the
|
|
223
|
+
* whole corpus wraps across a row, so cross-row state would not pay for itself.
|
|
224
|
+
*/
|
|
225
|
+
declare function meendContinuations(notes: Note[]): Set<number>;
|
|
226
|
+
/**
|
|
227
|
+
* The glide targets belonging to the attack at `events[i]`: the pitched events
|
|
228
|
+
* that follow it flagged `glide`. Silent columns (আ-কার holds) are transparent
|
|
229
|
+
* — the note is still ringing through them — but a rest ends the phrase.
|
|
230
|
+
* Consumers skip events that are themselves `glide` (already consumed here).
|
|
231
|
+
*/
|
|
232
|
+
declare function glideTargets(events: PlayEvent[], i: number): PlayEvent[];
|
|
163
233
|
/**
|
|
164
234
|
* Walk a document into a flat, time-ordered list of play events.
|
|
165
235
|
*
|
|
@@ -170,8 +240,13 @@ interface ScheduleOptions {
|
|
|
170
240
|
* - sustain **without** svara (আ-কার hold) → no attack, but the previous
|
|
171
241
|
* audible note's ring is extended; still emitted (midi null) so the lyric
|
|
172
242
|
* column highlights; advances.
|
|
173
|
-
* -
|
|
243
|
+
* - a svara under a মীড় arc (but not the note the arc opened on) → still its
|
|
244
|
+
* own event, flagged `glide`: the pitch is reached by sliding from the
|
|
245
|
+
* previous attack rather than by striking again (see meendContinuations).
|
|
246
|
+
* - bar / bracket-only / carrier / structural raw → ignored (no event, no
|
|
247
|
+
* advance); an *undecoded* notation cell (see UNDECODED_CELL) instead
|
|
248
|
+
* plays as a rest, so it keeps its matra and the তাল stays aligned.
|
|
174
249
|
*/
|
|
175
250
|
declare function buildSchedule(doc: Swaralipi, opts?: ScheduleOptions): Schedule;
|
|
176
251
|
|
|
177
|
-
export { type DrumVoice as D, type InstrumentId as I, type PlayEvent as P, type Schedule as S, TABLA_BPMS as T, type InstrumentDef as a, DEFAULT_SOUNDS_BASE as b, DRUM_KIT_BASE as c, INSTRUMENTS as d, SALAMANDER_BASE as e, SAMPLED_TAALS as f, type ScheduleOptions as g, TABLA_VARIATIONS as h, TONEJS_INSTRUMENTS_BASE as i, type ToneModule as j, buildSchedule as k,
|
|
252
|
+
export { ARC_RAW_RE as A, triggerGlide as B, type DrumVoice as D, type GlideLeg as G, type InstrumentId as I, MEEND_HOLD as M, type PlayEvent as P, type Schedule as S, TABLA_BPMS as T, type InstrumentDef as a, DEFAULT_SOUNDS_BASE as b, DRUM_KIT_BASE as c, INSTRUMENTS as d, SALAMANDER_BASE as e, SAMPLED_TAALS as f, type ScheduleOptions as g, TABLA_VARIATIONS as h, TONEJS_INSTRUMENTS_BASE as i, type ToneModule as j, buildSchedule as k, createBuffers as l, drumPattern as m, glideTargets as n, instrumentSampleUrl as o, isArcRaw as p, meendContinuations as q, nearestSampleKey as r, nearestTablaBpm as s, normalizeBase as t, probeUrl as u, quantizeLoopEnd as v, santoorUrls as w, subsetUrls as x, tablaBpms as y, tablaUrl as z };
|
|
@@ -79,8 +79,23 @@ interface Note {
|
|
|
79
79
|
rest?: boolean;
|
|
80
80
|
/** কণ স্বর: a grace note attached before this note. */
|
|
81
81
|
kan?: Svara;
|
|
82
|
+
/**
|
|
83
|
+
* রেশ: an after-touch grace — the legend's mirror of কণ, written small to
|
|
84
|
+
* the *right* of the note ("আসল স্বরের পরে … অন্য স্বরের ঈষৎ রেশ লাগে;
|
|
85
|
+
* তখন সেই স্বর ক্ষুদ্র অক্ষরে দক্ষিণ পার্শ্বে লিখিত হয়, যথা— রা˰স").
|
|
86
|
+
* Swarabitan writes it as a trailing uppercase letter (`mpaM`, `raS`).
|
|
87
|
+
*/
|
|
88
|
+
resh?: Svara;
|
|
82
89
|
/** মীড় (glide/slur) endpoint. */
|
|
83
90
|
meend?: 'start' | 'end';
|
|
91
|
+
/**
|
|
92
|
+
* অর্ধমাত্রা (ঃ): this note closes a cell whose matra unit is a *half* —
|
|
93
|
+
* `সঃ` = ½ matra, `সরঃ` = two ¼s, `রাঃ` = 1½ (legend p. ১৩৫).
|
|
94
|
+
* Explicit rather than derived, because durations alone cannot distinguish
|
|
95
|
+
* two half-matra cells (`সঃ গঃ`) from one matra split in two (`সরা`); this
|
|
96
|
+
* flag is what closes the cell and prints the ঃ.
|
|
97
|
+
*/
|
|
98
|
+
halfMatra?: boolean;
|
|
84
99
|
/** Barline. A bar token usually has no `svara`. */
|
|
85
100
|
bar?: Bar;
|
|
86
101
|
/** Repeat-bracket edges opening/closing on this token. */
|
|
@@ -244,9 +259,9 @@ declare const metaSchema: z.ZodObject<{
|
|
|
244
259
|
khaali?: number[] | undefined;
|
|
245
260
|
}>>;
|
|
246
261
|
/**
|
|
247
|
-
* The taal name
|
|
248
|
-
*
|
|
249
|
-
* when the name resolves to a
|
|
262
|
+
* The taal name as printed in the source (e.g. `ষষ্ঠী(২/৪)`), except
|
|
263
|
+
* free rhythm which is normalised to `মুক্তছন্দ`. Always set by the NLTR
|
|
264
|
+
* converter; `taal` is set only when the name resolves to a definition.
|
|
250
265
|
*/
|
|
251
266
|
taalName: z.ZodOptional<z.ZodString>;
|
|
252
267
|
/** Base pitch for playback, e.g. `C`, `C#`, or the player's `cs` form. */
|
|
@@ -359,9 +374,9 @@ declare const swaralipiSchema: z.ZodObject<{
|
|
|
359
374
|
khaali?: number[] | undefined;
|
|
360
375
|
}>>;
|
|
361
376
|
/**
|
|
362
|
-
* The taal name
|
|
363
|
-
*
|
|
364
|
-
* when the name resolves to a
|
|
377
|
+
* The taal name as printed in the source (e.g. `ষষ্ঠী(২/৪)`), except
|
|
378
|
+
* free rhythm which is normalised to `মুক্তছন্দ`. Always set by the NLTR
|
|
379
|
+
* converter; `taal` is set only when the name resolves to a definition.
|
|
365
380
|
*/
|
|
366
381
|
taalName: z.ZodOptional<z.ZodString>;
|
|
367
382
|
/** Base pitch for playback, e.g. `C`, `C#`, or the player's `cs` form. */
|
|
@@ -79,8 +79,23 @@ interface Note {
|
|
|
79
79
|
rest?: boolean;
|
|
80
80
|
/** কণ স্বর: a grace note attached before this note. */
|
|
81
81
|
kan?: Svara;
|
|
82
|
+
/**
|
|
83
|
+
* রেশ: an after-touch grace — the legend's mirror of কণ, written small to
|
|
84
|
+
* the *right* of the note ("আসল স্বরের পরে … অন্য স্বরের ঈষৎ রেশ লাগে;
|
|
85
|
+
* তখন সেই স্বর ক্ষুদ্র অক্ষরে দক্ষিণ পার্শ্বে লিখিত হয়, যথা— রা˰স").
|
|
86
|
+
* Swarabitan writes it as a trailing uppercase letter (`mpaM`, `raS`).
|
|
87
|
+
*/
|
|
88
|
+
resh?: Svara;
|
|
82
89
|
/** মীড় (glide/slur) endpoint. */
|
|
83
90
|
meend?: 'start' | 'end';
|
|
91
|
+
/**
|
|
92
|
+
* অর্ধমাত্রা (ঃ): this note closes a cell whose matra unit is a *half* —
|
|
93
|
+
* `সঃ` = ½ matra, `সরঃ` = two ¼s, `রাঃ` = 1½ (legend p. ১৩৫).
|
|
94
|
+
* Explicit rather than derived, because durations alone cannot distinguish
|
|
95
|
+
* two half-matra cells (`সঃ গঃ`) from one matra split in two (`সরা`); this
|
|
96
|
+
* flag is what closes the cell and prints the ঃ.
|
|
97
|
+
*/
|
|
98
|
+
halfMatra?: boolean;
|
|
84
99
|
/** Barline. A bar token usually has no `svara`. */
|
|
85
100
|
bar?: Bar;
|
|
86
101
|
/** Repeat-bracket edges opening/closing on this token. */
|
|
@@ -244,9 +259,9 @@ declare const metaSchema: z.ZodObject<{
|
|
|
244
259
|
khaali?: number[] | undefined;
|
|
245
260
|
}>>;
|
|
246
261
|
/**
|
|
247
|
-
* The taal name
|
|
248
|
-
*
|
|
249
|
-
* when the name resolves to a
|
|
262
|
+
* The taal name as printed in the source (e.g. `ষষ্ঠী(২/৪)`), except
|
|
263
|
+
* free rhythm which is normalised to `মুক্তছন্দ`. Always set by the NLTR
|
|
264
|
+
* converter; `taal` is set only when the name resolves to a definition.
|
|
250
265
|
*/
|
|
251
266
|
taalName: z.ZodOptional<z.ZodString>;
|
|
252
267
|
/** Base pitch for playback, e.g. `C`, `C#`, or the player's `cs` form. */
|
|
@@ -359,9 +374,9 @@ declare const swaralipiSchema: z.ZodObject<{
|
|
|
359
374
|
khaali?: number[] | undefined;
|
|
360
375
|
}>>;
|
|
361
376
|
/**
|
|
362
|
-
* The taal name
|
|
363
|
-
*
|
|
364
|
-
* when the name resolves to a
|
|
377
|
+
* The taal name as printed in the source (e.g. `ষষ্ঠী(২/৪)`), except
|
|
378
|
+
* free rhythm which is normalised to `মুক্তছন্দ`. Always set by the NLTR
|
|
379
|
+
* converter; `taal` is set only when the name resolves to a definition.
|
|
365
380
|
*/
|
|
366
381
|
taalName: z.ZodOptional<z.ZodString>;
|
|
367
382
|
/** Base pitch for playback, e.g. `C`, `C#`, or the player's `cs` form. */
|
package/dist/spec/index.cjs
CHANGED
|
@@ -33,7 +33,9 @@ var noteSchema = zod.z.lazy(
|
|
|
33
33
|
sustain: zod.z.boolean().optional(),
|
|
34
34
|
rest: zod.z.boolean().optional(),
|
|
35
35
|
kan: svaraSchema.optional(),
|
|
36
|
+
resh: svaraSchema.optional(),
|
|
36
37
|
meend: zod.z.enum(["start", "end"]).optional(),
|
|
38
|
+
halfMatra: zod.z.boolean().optional(),
|
|
37
39
|
bar: barSchema.optional(),
|
|
38
40
|
brackets: zod.z.array(bracketSchema).optional(),
|
|
39
41
|
lyric: zod.z.string().optional(),
|
|
@@ -84,9 +86,9 @@ var metaSchema = zod.z.object({
|
|
|
84
86
|
nltrId: zod.z.number().int().optional(),
|
|
85
87
|
taal: taalSchema.optional(),
|
|
86
88
|
/**
|
|
87
|
-
* The taal name
|
|
88
|
-
*
|
|
89
|
-
* when the name resolves to a
|
|
89
|
+
* The taal name as printed in the source (e.g. `ষষ্ঠী(২/৪)`), except
|
|
90
|
+
* free rhythm which is normalised to `মুক্তছন্দ`. Always set by the NLTR
|
|
91
|
+
* converter; `taal` is set only when the name resolves to a definition.
|
|
90
92
|
*/
|
|
91
93
|
taalName: zod.z.string().optional(),
|
|
92
94
|
/** Base pitch for playback, e.g. `C`, `C#`, or the player's `cs` form. */
|
|
@@ -134,7 +136,7 @@ var TAALS = {
|
|
|
134
136
|
};
|
|
135
137
|
|
|
136
138
|
// src/spec/index.ts
|
|
137
|
-
var SPEC_VERSION = "0.
|
|
139
|
+
var SPEC_VERSION = "0.6.0";
|
|
138
140
|
function parseSwaralipi(data) {
|
|
139
141
|
return swaralipiSchema.parse(data);
|
|
140
142
|
}
|
package/dist/spec/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/spec/schema.ts","../../src/spec/taals.ts","../../src/spec/index.ts"],"names":["z"],"mappings":";;;;;AAMO,IAAM,YAAA,GAAeA,MAAE,IAAA,CAAK;AAAA,EACjC,YAAA;AAAA;AAAA,EACA,QAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,MAAA;AAAA;AAAA,EACA;AAAA;AACF,CAAC;AAOM,IAAM,iBAAA,GAAoBA,KAAA,CAAE,IAAA,CAAK,CAAC,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,GAAG,CAAC;AAIpE,IAAM,cAAcA,KAAA,CAAE,KAAA,CAAM,CAAC,YAAA,EAAc,iBAAiB,CAAC;AAI7D,IAAM,kBAAkBA,KAAA,CAAE,IAAA,CAAK,CAAC,WAAA,EAAa,UAAU,CAAC;AAWxD,IAAM,SAAA,GAAYA,MAAE,IAAA,CAAK,CAAC,QAAQ,QAAA,EAAU,QAAA,EAAU,MAAM,CAAC;AAS7D,IAAM,aAAA,GAAgBA,MAAE,MAAA,CAAO;AAAA,EACpC,MAAMA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E;AAAA;AAAA,EAC9D,SAAS,EAAE,EAAA,EAAI,WAAW,QAAA,EAAU,EAAA,EAAI,QAAQ,CAAC,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAC,CAAA,EAAG,GAAA,EAAK,GAAG,MAAA,EAAQ,CAAC,CAAC,CAAA;AAAE;AACpF;;;ACrBO,IAAM,YAAA,GAAe;AAmCrB,SAAS,eAAe,IAAA,EAA0B;AACvD,EAAA,OAAO,eAAA,CAAgB,MAAM,IAAI,CAAA;AACnC;AAGO,SAAS,mBAAmB,IAAA,EAAe;AAChD,EAAA,OAAO,eAAA,CAAgB,UAAU,IAAI,CAAA;AACvC","file":"index.cjs","sourcesContent":["import { z } from 'zod';\n\n/**\n * swaralipi-js JSON spec — Zod schema + inferred types.\n\n/** Octave registers */\nexport const octaveSchema = z.enum([\n 'ati-mandra', // very low\n 'mandra', // low (dot below)\n 'madhyam', // middle\n 'taar', // high (ref/dot above)\n 'ati-taar', // very high\n]);\nexport type Octave = z.infer<typeof octaveSchema>;\n\n/**\n * The seven shuddha svara letters:\n * `d` = ধৈবত (dha), `n` = নিষাদ (ni). Komal/tivra are flags, not letters.\n */\nexport const svaraLetterSchema = z.enum(['s', 'r', 'g', 'm', 'p', 'd', 'n']);\nexport type SvaraLetter = z.infer<typeof svaraLetterSchema>;\n\n/** A pitch as `[octave, letter]` */\nexport const svaraSchema = z.tuple([octaveSchema, svaraLetterSchema]);\nexport type Svara = z.infer<typeof svaraSchema>;\n\n/** Microtone variants below komal (legend: অল্পকোমল / অতিকোমল). */\nexport const microtoneSchema = z.enum(['alpakomal', 'atikomal']);\nexport type Microtone = z.infer<typeof microtoneSchema>;\n\n/**\n * Barline weights. Swarabitan distinguishes the light দাঁড়ি (।) that\n * separates vibhags *within* a taal cycle from the দণ্ড (danda, I) strokes:\n * - `dari` — । vibhag separator inside the cycle\n * - `single` — I end of one taal cycle (ফেরা)\n * - `double` — II section (kali) boundary / return-to-asthayi marker\n * - `quad` — IIII end of the song\n */\nexport const barSchema = z.enum(['dari', 'single', 'double', 'quad']);\nexport type Bar = z.infer<typeof barSchema>;\n\n/**\n * A repeat-bracket edge. Brackets span a range of notes; the opening note\n * carries `{ ..., edge: 'open' }` and the closing note `{ ..., edge: 'close' }`.\n * kind: `repeat` = {} গুন্ডবন্ধনী, `skip` = () বক্রবন্ধনী (omit on repeat),\n * `alt` = [] সরল বন্ধনী (changed notes on repeat).\n */\nexport const bracketSchema = z.object({\n kind: z.enum(['repeat', 'skip', 'alt']),\n edge: z.enum(['open', 'close']),\n});\nexport type Bracket = z.infer<typeof bracketSchema>;\n\n/**\n * A single token in a row. A token is one of: a pitched note (`svara`),\n * a rest (`rest`), an আ-কার sustain (`sustain`), a barline (`bar`), or a\n * purely raw/undecoded cell (`raw`) — possibly carrying annotations\n * (`above`/`below`) or a lyric syllable on an otherwise empty column.\n * The `.refine` enforces that a note carries at least one of these so\n * truly empty tokens can't slip through.\n *\n * `above`/`below` make `Note` recursive, so the type is hand-written and\n * the schema is typed `z.ZodType<Note>` via `z.lazy` (all fields are\n * optional, hence input ≡ output and the annotation is sound).\n */\nexport interface Note {\n /** Pitch. Omitted for rests, sustains, and barlines. */\n svara?: Svara;\n /** কোমল (flat). */\n komal?: boolean;\n /** তীব্র / কড়ি (sharp — applies to ma). */\n tivra?: boolean;\n /** Sub-komal microtone (legend: অল্পকোমল / অতিকোমল). */\n microtone?: Microtone;\n /** Duration in মাত্রা (beats): 1 (default), 0.5, 0.25, 2, … */\n durationMatra?: number;\n /**\n * আ-কার: no new syllable attack. Alone (no `svara`) it holds the previous\n * note's pitch and vowel; combined with `svara` it is a melisma — the\n * pitch moves while the previous syllable's vowel continues (Swarabitan\n * writes these with a leading hyphen, e.g. `-sfa`).\n */\n sustain?: boolean;\n /** বিরাম: a rest of `durationMatra` beats. */\n rest?: boolean;\n /** কণ স্বর: a grace note attached before this note. */\n kan?: Svara;\n /** মীড় (glide/slur) endpoint. */\n meend?: 'start' | 'end';\n /** Barline. A bar token usually has no `svara`. */\n bar?: Bar;\n /** Repeat-bracket edges opening/closing on this token. */\n brackets?: Bracket[];\n /** Lyric syllable aligned under this note */\n lyric?: string;\n /** Lossless passthrough of the source cell (e.g. raw Swarabitan code). */\n raw?: string;\n /**\n * Annotation notes rendered above this column: alt-on-repeat passages\n * (legend: পরিবর্তিত স্বর in [ ] শিরোদেশে), stop marks, beat numbers.\n */\n above?: Note[];\n /** Annotation notes rendered below this column. */\n below?: Note[];\n}\n\nexport const noteSchema: z.ZodType<Note> = z.lazy(() =>\n z\n .object({\n svara: svaraSchema.optional(),\n komal: z.boolean().optional(),\n tivra: z.boolean().optional(),\n microtone: microtoneSchema.optional(),\n durationMatra: z.number().positive().optional(),\n sustain: z.boolean().optional(),\n rest: z.boolean().optional(),\n kan: svaraSchema.optional(),\n meend: z.enum(['start', 'end']).optional(),\n bar: barSchema.optional(),\n brackets: z.array(bracketSchema).optional(),\n lyric: z.string().optional(),\n raw: z.string().optional(),\n above: z.array(noteSchema).optional(),\n below: z.array(noteSchema).optional(),\n })\n .refine(\n (n) =>\n n.svara !== undefined ||\n n.rest === true ||\n n.sustain === true ||\n n.bar !== undefined ||\n n.raw !== undefined ||\n (n.brackets !== undefined && n.brackets.length > 0) ||\n (n.above !== undefined && n.above.length > 0) ||\n (n.below !== undefined && n.below.length > 0) ||\n n.lyric !== undefined,\n {\n message:\n 'note must carry one of: svara, rest, sustain, bar, raw, lyric, brackets, or a non-empty above/below',\n },\n ),\n);\n\n/** A written line of the song: a sequence of note tokens. */\nexport const rowSchema = z.object({\n /** Optional line label (e.g. a tuk/section marker). */\n label: z.string().optional(),\n notes: z.array(noteSchema),\n});\nexport type Row = z.infer<typeof rowSchema>;\n\n/** A structural section: আস্থায়ী / অন্তরা / সঞ্চারী / আভোগ, or free text. */\nexport const partSchema = z.object({\n name: z.string().optional(),\n rows: z.array(rowSchema),\n});\nexport type Part = z.infer<typeof partSchema>;\n\n/**\n * Taal definition. `numBeats` is the cycle length in মাত্রা; `bhaags` (if\n * present) must sum to `numBeats`; `sam`/`khaali` are 0-based beat indices.\n */\nexport const taalSchema = z\n .object({\n /** Player sample key, e.g. `dadra`, `teentaal`. */\n id: z.string(),\n /**\n * Which tabla loop variation to play, e.g. `pro` (CDN dir suffix). Optional\n * and additive — omitted means the taal's default variation, so existing\n * docs are unaffected. The player honors it but never exposes a variation\n * picker; selecting a non-default variation is the consumer's premium policy.\n */\n variation: z.string().optional(),\n numBeats: z.number().int().positive(),\n /** Vibhag groupings; if given, they sum to numBeats. */\n bhaags: z.array(z.number().int().positive()).optional(),\n /** Sam (cycle start) beat index, 0-based. */\n sam: z.number().int().nonnegative().optional(),\n /** Khaali (wave) beat indices, 0-based. */\n khaali: z.array(z.number().int().nonnegative()).optional(),\n })\n .refine((t) => t.bhaags === undefined || t.bhaags.reduce((a, b) => a + b, 0) === t.numBeats, {\n message: 'bhaags must sum to numBeats',\n });\nexport type Taal = z.infer<typeof taalSchema>;\n\n/** Document-level metadata. */\nexport const metaSchema = z.object({\n title: z.string(),\n /** Cross-reference to a gitabitan.io song content id (filename, immutable). */\n songId: z.string().optional(),\n /** Source NLTR node/song id. */\n nltrId: z.number().int().optional(),\n taal: taalSchema.optional(),\n /**\n * The taal name exactly as printed in the source (e.g. `তালমুক্ত`,\n * `ষষ্ঠী(২/৪)`). Always set by the NLTR converter; `taal` is set only\n * when the name resolves to a known definition.\n */\n taalName: z.string().optional(),\n /** Base pitch for playback, e.g. `C`, `C#`, or the player's `cs` form. */\n tonic: z.string().optional(),\n /** Default playback tempo in matra/min. Player-only — the viewer ignores it.\n * The player adopts it on `load()` (precedence: constructor `bpm` → `setBpm`\n * tweak → this → 90). `null` is the converter's blank placeholder = unset. */\n bpm: z.number().positive().nullable().optional(),\n raag: z.string().optional(),\n /** আবর্তন: number of taal cycles, when the source states it. */\n avartan: z.number().int().positive().optional(),\n /** স্বরলিপিকার (notation author). */\n notationBy: z.string().optional(),\n /** Provenance note or URL. */\n source: z.string().optional(),\n});\nexport type Meta = z.infer<typeof metaSchema>;\n\n/** A complete swaralipi document. */\nexport const swaralipiSchema = z.object({\n /** Spec version this document targets (see SPEC_VERSION in ./index). */\n version: z.string(),\n meta: metaSchema,\n parts: z.array(partSchema),\n});\nexport type Swaralipi = z.infer<typeof swaralipiSchema>;\n","import type { Taal } from './schema.js';\n\n/**\n * Reference definitions for the taals the player will sample:\n * adachautaal, dadra, ektaal, jhaptaal, kehrwa, rupak, shashthi, teentaal,\n * jhampak, dhamaar.\n *\n * `numBeats` and the `bhaags` given below are standard Hindustani taal theory.\n * `bhaags` is omitted where a single canonical division isn't well-agreed\n * (adachautaal) — we assert only what's uncontested. `sam` is beat 0 for all.\n *\n * Tabla loops live under `tabla/<id>/` by default; per-taal variation and\n * skip-bpm overrides (e.g. shashthi → `tabla/shashthi-pro/`) are in\n * instruments.ts's `TABLA_VARIATIONS`.\n */\nexport const TAALS = {\n dadra: { id: 'dadra', numBeats: 6, bhaags: [3, 3], sam: 0, khaali: [3] },\n kehrwa: { id: 'kehrwa', numBeats: 8, bhaags: [4, 4], sam: 0, khaali: [4] },\n rupak: { id: 'rupak', numBeats: 7, bhaags: [3, 2, 2], sam: 0, khaali: [0] },\n jhaptaal: { id: 'jhaptaal', numBeats: 10, bhaags: [2, 3, 2, 3], sam: 0, khaali: [5] },\n ektaal: { id: 'ektaal', numBeats: 12, bhaags: [2, 2, 2, 2, 2, 2], sam: 0, khaali: [2, 6] },\n adachautaal: { id: 'adachautaal', numBeats: 14, sam: 0 },\n choutaal: { id: 'choutaal', numBeats: 12, bhaags: [2, 2, 2, 2, 2, 2], sam: 0, khaali: [2, 6] }, // চৌতাল\n shashthi: { id: 'shashthi', numBeats: 6, bhaags: [2, 4], sam: 0 }, // ষষ্ঠী\n teora: { id: 'teora', numBeats: 7, bhaags: [3, 2, 2], sam: 0 }, // টেওরা\n teentaal: { id: 'teentaal', numBeats: 16, bhaags: [4, 4, 4, 4], sam: 0, khaali: [8] },\n aratheka: { id: 'aratheka', numBeats: 16, bhaags: [4, 4, 4, 4], sam: 0, khaali: [8] }, // আড়াঠেকা\n jhampak: { id: 'jhampak', numBeats: 5, bhaags: [3, 2], sam: 0 }, // ঝম্পক\n dhamaar: { id: 'dhamaar', numBeats: 14, bhaags: [5, 2, 3, 4], sam: 0, khaali: [7] }, // ধামার\n} as const satisfies Record<string, Taal>;\n\nexport type TaalId = keyof typeof TAALS;\n","/**\n * @ugfoundation/swaralipi-js/spec\n *\n * The swaralipi JSON spec: Zod schemas, inferred TS types, and parse helpers.\n */\nimport { swaralipiSchema, type Swaralipi } from './schema.js';\n\n/** Current spec version. Documents declare the version they target. */\nexport const SPEC_VERSION = '0.4.0';\n\nexport {\n octaveSchema,\n svaraLetterSchema,\n svaraSchema,\n microtoneSchema,\n barSchema,\n bracketSchema,\n noteSchema,\n rowSchema,\n partSchema,\n taalSchema,\n metaSchema,\n swaralipiSchema,\n} from './schema.js';\n\nexport type {\n Octave,\n SvaraLetter,\n Svara,\n Microtone,\n Bar,\n Bracket,\n Note,\n Row,\n Part,\n Taal,\n Meta,\n Swaralipi,\n} from './schema.js';\n\nexport { TAALS, type TaalId } from './taals.js';\n\n/** Parse + validate unknown data into a `Swaralipi`. Throws `ZodError` on failure. */\nexport function parseSwaralipi(data: unknown): Swaralipi {\n return swaralipiSchema.parse(data);\n}\n\n/** Non-throwing variant: returns Zod's `{ success, data | error }` result. */\nexport function safeParseSwaralipi(data: unknown) {\n return swaralipiSchema.safeParse(data);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/spec/schema.ts","../../src/spec/taals.ts","../../src/spec/index.ts"],"names":["z"],"mappings":";;;;;AAMO,IAAM,YAAA,GAAeA,MAAE,IAAA,CAAK;AAAA,EACjC,YAAA;AAAA;AAAA,EACA,QAAA;AAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,MAAA;AAAA;AAAA,EACA;AAAA;AACF,CAAC;AAOM,IAAM,iBAAA,GAAoBA,KAAA,CAAE,IAAA,CAAK,CAAC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AAA,EAAI,YAAY,QAAA,EAAU,EAAA,EAAI,QAAQ,CAAC,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAC,CAAA,EAAG,GAAA,EAAK,GAAG,MAAA,EAAQ,CAAC,CAAC,CAAA,EAAE;AAAA,EACpF,UAAU,EAAE,EAAA,EAAI,YAAY,QAAA,EAAU,EAAA,EAAI,QAAQ,CAAC,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAC,CAAA,EAAG,GAAA,EAAK,GAAG,MAAA,EAAQ,CAAC,CAAC,CAAA,EAAE;AAAA;AAAA,EACpF,OAAA,EAAS,EAAE,EAAA,EAAI,SAAA,EAAW,QAAA,EAAU,CAAA,EAAG,MAAA,EAAQ,CAAC,CAAA,EAAG,CAAC,CAAA,EAAG,GAAA,EAAK,CAAA,EAAE;AAAA;AAAA,EAC9D,SAAS,EAAE,EAAA,EAAI,WAAW,QAAA,EAAU,EAAA,EAAI,QAAQ,CAAC,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAC,CAAA,EAAG,GAAA,EAAK,GAAG,MAAA,EAAQ,CAAC,CAAC,CAAA;AAAE;AACpF;;;ACrBO,IAAM,YAAA,GAAe;AAmCrB,SAAS,eAAe,IAAA,EAA0B;AACvD,EAAA,OAAO,eAAA,CAAgB,MAAM,IAAI,CAAA;AACnC;AAGO,SAAS,mBAAmB,IAAA,EAAe;AAChD,EAAA,OAAO,eAAA,CAAgB,UAAU,IAAI,CAAA;AACvC","file":"index.cjs","sourcesContent":["import { z } from 'zod';\n\n/**\n * swaralipi-js JSON spec — Zod schema + inferred types.\n\n/** Octave registers */\nexport const octaveSchema = z.enum([\n 'ati-mandra', // very low\n 'mandra', // low (dot below)\n 'madhyam', // middle\n 'taar', // high (ref/dot above)\n 'ati-taar', // very high\n]);\nexport type Octave = z.infer<typeof octaveSchema>;\n\n/**\n * The seven shuddha svara letters:\n * `d` = ধৈবত (dha), `n` = নিষাদ (ni). Komal/tivra are flags, not letters.\n */\nexport const svaraLetterSchema = z.enum(['s', 'r', 'g', 'm', 'p', 'd', 'n']);\nexport type SvaraLetter = z.infer<typeof svaraLetterSchema>;\n\n/** A pitch as `[octave, letter]` */\nexport const svaraSchema = z.tuple([octaveSchema, svaraLetterSchema]);\nexport type Svara = z.infer<typeof svaraSchema>;\n\n/** Microtone variants below komal (legend: অল্পকোমল / অতিকোমল). */\nexport const microtoneSchema = z.enum(['alpakomal', 'atikomal']);\nexport type Microtone = z.infer<typeof microtoneSchema>;\n\n/**\n * Barline weights. Swarabitan distinguishes the light দাঁড়ি (।) that\n * separates vibhags *within* a taal cycle from the দণ্ড (danda, I) strokes:\n * - `dari` — । vibhag separator inside the cycle\n * - `single` — I end of one taal cycle (ফেরা)\n * - `double` — II section (kali) boundary / return-to-asthayi marker\n * - `quad` — IIII end of the song\n */\nexport const barSchema = z.enum(['dari', 'single', 'double', 'quad']);\nexport type Bar = z.infer<typeof barSchema>;\n\n/**\n * A repeat-bracket edge. Brackets span a range of notes; the opening note\n * carries `{ ..., edge: 'open' }` and the closing note `{ ..., edge: 'close' }`.\n * kind: `repeat` = {} গুন্ডবন্ধনী, `skip` = () বক্রবন্ধনী (omit on repeat),\n * `alt` = [] সরল বন্ধনী (changed notes on repeat).\n */\nexport const bracketSchema = z.object({\n kind: z.enum(['repeat', 'skip', 'alt']),\n edge: z.enum(['open', 'close']),\n});\nexport type Bracket = z.infer<typeof bracketSchema>;\n\n/**\n * A single token in a row. A token is one of: a pitched note (`svara`),\n * a rest (`rest`), an আ-কার sustain (`sustain`), a barline (`bar`), or a\n * purely raw/undecoded cell (`raw`) — possibly carrying annotations\n * (`above`/`below`) or a lyric syllable on an otherwise empty column.\n * The `.refine` enforces that a note carries at least one of these so\n * truly empty tokens can't slip through.\n *\n * `above`/`below` make `Note` recursive, so the type is hand-written and\n * the schema is typed `z.ZodType<Note>` via `z.lazy` (all fields are\n * optional, hence input ≡ output and the annotation is sound).\n */\nexport interface Note {\n /** Pitch. Omitted for rests, sustains, and barlines. */\n svara?: Svara;\n /** কোমল (flat). */\n komal?: boolean;\n /** তীব্র / কড়ি (sharp — applies to ma). */\n tivra?: boolean;\n /** Sub-komal microtone (legend: অল্পকোমল / অতিকোমল). */\n microtone?: Microtone;\n /** Duration in মাত্রা (beats): 1 (default), 0.5, 0.25, 2, … */\n durationMatra?: number;\n /**\n * আ-কার: no new syllable attack. Alone (no `svara`) it holds the previous\n * note's pitch and vowel; combined with `svara` it is a melisma — the\n * pitch moves while the previous syllable's vowel continues (Swarabitan\n * writes these with a leading hyphen, e.g. `-sfa`).\n */\n sustain?: boolean;\n /** বিরাম: a rest of `durationMatra` beats. */\n rest?: boolean;\n /** কণ স্বর: a grace note attached before this note. */\n kan?: Svara;\n /**\n * রেশ: an after-touch grace — the legend's mirror of কণ, written small to\n * the *right* of the note (\"আসল স্বরের পরে … অন্য স্বরের ঈষৎ রেশ লাগে;\n * তখন সেই স্বর ক্ষুদ্র অক্ষরে দক্ষিণ পার্শ্বে লিখিত হয়, যথা— রা˰স\").\n * Swarabitan writes it as a trailing uppercase letter (`mpaM`, `raS`).\n */\n resh?: Svara;\n /** মীড় (glide/slur) endpoint. */\n meend?: 'start' | 'end';\n /**\n * অর্ধমাত্রা (ঃ): this note closes a cell whose matra unit is a *half* —\n * `সঃ` = ½ matra, `সরঃ` = two ¼s, `রাঃ` = 1½ (legend p. ১৩৫).\n * Explicit rather than derived, because durations alone cannot distinguish\n * two half-matra cells (`সঃ গঃ`) from one matra split in two (`সরা`); this\n * flag is what closes the cell and prints the ঃ.\n */\n halfMatra?: boolean;\n /** Barline. A bar token usually has no `svara`. */\n bar?: Bar;\n /** Repeat-bracket edges opening/closing on this token. */\n brackets?: Bracket[];\n /** Lyric syllable aligned under this note */\n lyric?: string;\n /** Lossless passthrough of the source cell (e.g. raw Swarabitan code). */\n raw?: string;\n /**\n * Annotation notes rendered above this column: alt-on-repeat passages\n * (legend: পরিবর্তিত স্বর in [ ] শিরোদেশে), stop marks, beat numbers.\n */\n above?: Note[];\n /** Annotation notes rendered below this column. */\n below?: Note[];\n}\n\nexport const noteSchema: z.ZodType<Note> = z.lazy(() =>\n z\n .object({\n svara: svaraSchema.optional(),\n komal: z.boolean().optional(),\n tivra: z.boolean().optional(),\n microtone: microtoneSchema.optional(),\n durationMatra: z.number().positive().optional(),\n sustain: z.boolean().optional(),\n rest: z.boolean().optional(),\n kan: svaraSchema.optional(),\n resh: svaraSchema.optional(),\n meend: z.enum(['start', 'end']).optional(),\n halfMatra: z.boolean().optional(),\n bar: barSchema.optional(),\n brackets: z.array(bracketSchema).optional(),\n lyric: z.string().optional(),\n raw: z.string().optional(),\n above: z.array(noteSchema).optional(),\n below: z.array(noteSchema).optional(),\n })\n .refine(\n (n) =>\n n.svara !== undefined ||\n n.rest === true ||\n n.sustain === true ||\n n.bar !== undefined ||\n n.raw !== undefined ||\n (n.brackets !== undefined && n.brackets.length > 0) ||\n (n.above !== undefined && n.above.length > 0) ||\n (n.below !== undefined && n.below.length > 0) ||\n n.lyric !== undefined,\n {\n message:\n 'note must carry one of: svara, rest, sustain, bar, raw, lyric, brackets, or a non-empty above/below',\n },\n ),\n);\n\n/** A written line of the song: a sequence of note tokens. */\nexport const rowSchema = z.object({\n /** Optional line label (e.g. a tuk/section marker). */\n label: z.string().optional(),\n notes: z.array(noteSchema),\n});\nexport type Row = z.infer<typeof rowSchema>;\n\n/** A structural section: আস্থায়ী / অন্তরা / সঞ্চারী / আভোগ, or free text. */\nexport const partSchema = z.object({\n name: z.string().optional(),\n rows: z.array(rowSchema),\n});\nexport type Part = z.infer<typeof partSchema>;\n\n/**\n * Taal definition. `numBeats` is the cycle length in মাত্রা; `bhaags` (if\n * present) must sum to `numBeats`; `sam`/`khaali` are 0-based beat indices.\n */\nexport const taalSchema = z\n .object({\n /** Player sample key, e.g. `dadra`, `teentaal`. */\n id: z.string(),\n /**\n * Which tabla loop variation to play, e.g. `pro` (CDN dir suffix). Optional\n * and additive — omitted means the taal's default variation, so existing\n * docs are unaffected. The player honors it but never exposes a variation\n * picker; selecting a non-default variation is the consumer's premium policy.\n */\n variation: z.string().optional(),\n numBeats: z.number().int().positive(),\n /** Vibhag groupings; if given, they sum to numBeats. */\n bhaags: z.array(z.number().int().positive()).optional(),\n /** Sam (cycle start) beat index, 0-based. */\n sam: z.number().int().nonnegative().optional(),\n /** Khaali (wave) beat indices, 0-based. */\n khaali: z.array(z.number().int().nonnegative()).optional(),\n })\n .refine((t) => t.bhaags === undefined || t.bhaags.reduce((a, b) => a + b, 0) === t.numBeats, {\n message: 'bhaags must sum to numBeats',\n });\nexport type Taal = z.infer<typeof taalSchema>;\n\n/** Document-level metadata. */\nexport const metaSchema = z.object({\n title: z.string(),\n /** Cross-reference to a gitabitan.io song content id (filename, immutable). */\n songId: z.string().optional(),\n /** Source NLTR node/song id. */\n nltrId: z.number().int().optional(),\n taal: taalSchema.optional(),\n /**\n * The taal name as printed in the source (e.g. `ষষ্ঠী(২/৪)`), except\n * free rhythm which is normalised to `মুক্তছন্দ`. Always set by the NLTR\n * converter; `taal` is set only when the name resolves to a definition.\n */\n taalName: z.string().optional(),\n /** Base pitch for playback, e.g. `C`, `C#`, or the player's `cs` form. */\n tonic: z.string().optional(),\n /** Default playback tempo in matra/min. Player-only — the viewer ignores it.\n * The player adopts it on `load()` (precedence: constructor `bpm` → `setBpm`\n * tweak → this → 90). `null` is the converter's blank placeholder = unset. */\n bpm: z.number().positive().nullable().optional(),\n raag: z.string().optional(),\n /** আবর্তন: number of taal cycles, when the source states it. */\n avartan: z.number().int().positive().optional(),\n /** স্বরলিপিকার (notation author). */\n notationBy: z.string().optional(),\n /** Provenance note or URL. */\n source: z.string().optional(),\n});\nexport type Meta = z.infer<typeof metaSchema>;\n\n/** A complete swaralipi document. */\nexport const swaralipiSchema = z.object({\n /** Spec version this document targets (see SPEC_VERSION in ./index). */\n version: z.string(),\n meta: metaSchema,\n parts: z.array(partSchema),\n});\nexport type Swaralipi = z.infer<typeof swaralipiSchema>;\n","import type { Taal } from './schema.js';\n\n/**\n * Reference definitions for the taals the player will sample:\n * adachautaal, dadra, ektaal, jhaptaal, kehrwa, rupak, shashthi, teentaal,\n * jhampak, dhamaar.\n *\n * `numBeats` and the `bhaags` given below are standard Hindustani taal theory.\n * `bhaags` is omitted where a single canonical division isn't well-agreed\n * (adachautaal) — we assert only what's uncontested. `sam` is beat 0 for all.\n *\n * Tabla loops live under `tabla/<id>/` by default; per-taal variation and\n * skip-bpm overrides (e.g. shashthi → `tabla/shashthi-pro/`) are in\n * instruments.ts's `TABLA_VARIATIONS`.\n */\nexport const TAALS = {\n dadra: { id: 'dadra', numBeats: 6, bhaags: [3, 3], sam: 0, khaali: [3] },\n kehrwa: { id: 'kehrwa', numBeats: 8, bhaags: [4, 4], sam: 0, khaali: [4] },\n rupak: { id: 'rupak', numBeats: 7, bhaags: [3, 2, 2], sam: 0, khaali: [0] },\n jhaptaal: { id: 'jhaptaal', numBeats: 10, bhaags: [2, 3, 2, 3], sam: 0, khaali: [5] },\n ektaal: { id: 'ektaal', numBeats: 12, bhaags: [2, 2, 2, 2, 2, 2], sam: 0, khaali: [2, 6] },\n adachautaal: { id: 'adachautaal', numBeats: 14, sam: 0 },\n choutaal: { id: 'choutaal', numBeats: 12, bhaags: [2, 2, 2, 2, 2, 2], sam: 0, khaali: [2, 6] }, // চৌতাল\n shashthi: { id: 'shashthi', numBeats: 6, bhaags: [2, 4], sam: 0 }, // ষষ্ঠী\n teora: { id: 'teora', numBeats: 7, bhaags: [3, 2, 2], sam: 0 }, // টেওরা\n teentaal: { id: 'teentaal', numBeats: 16, bhaags: [4, 4, 4, 4], sam: 0, khaali: [8] },\n aratheka: { id: 'aratheka', numBeats: 16, bhaags: [4, 4, 4, 4], sam: 0, khaali: [8] }, // আড়াঠেকা\n jhampak: { id: 'jhampak', numBeats: 5, bhaags: [3, 2], sam: 0 }, // ঝম্পক\n dhamaar: { id: 'dhamaar', numBeats: 14, bhaags: [5, 2, 3, 4], sam: 0, khaali: [7] }, // ধামার\n} as const satisfies Record<string, Taal>;\n\nexport type TaalId = keyof typeof TAALS;\n","/**\n * @ugfoundation/swaralipi-js/spec\n *\n * The swaralipi JSON spec: Zod schemas, inferred TS types, and parse helpers.\n */\nimport { swaralipiSchema, type Swaralipi } from './schema.js';\n\n/** Current spec version. Documents declare the version they target. */\nexport const SPEC_VERSION = '0.6.0';\n\nexport {\n octaveSchema,\n svaraLetterSchema,\n svaraSchema,\n microtoneSchema,\n barSchema,\n bracketSchema,\n noteSchema,\n rowSchema,\n partSchema,\n taalSchema,\n metaSchema,\n swaralipiSchema,\n} from './schema.js';\n\nexport type {\n Octave,\n SvaraLetter,\n Svara,\n Microtone,\n Bar,\n Bracket,\n Note,\n Row,\n Part,\n Taal,\n Meta,\n Swaralipi,\n} from './schema.js';\n\nexport { TAALS, type TaalId } from './taals.js';\n\n/** Parse + validate unknown data into a `Swaralipi`. Throws `ZodError` on failure. */\nexport function parseSwaralipi(data: unknown): Swaralipi {\n return swaralipiSchema.parse(data);\n}\n\n/** Non-throwing variant: returns Zod's `{ success, data | error }` result. */\nexport function safeParseSwaralipi(data: unknown) {\n return swaralipiSchema.safeParse(data);\n}\n"]}
|
package/dist/spec/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
|
-
import { S as Swaralipi, N as Note } from '../schema-
|
|
3
|
-
export { B as Bar, b as Bracket, M as Meta, c as Microtone, O as Octave, P as Part, R as Row, d as Svara, a as SvaraLetter, T as Taal, e as barSchema, f as bracketSchema, m as metaSchema, g as microtoneSchema, n as noteSchema, o as octaveSchema, p as partSchema, r as rowSchema, s as svaraLetterSchema, h as svaraSchema, i as swaralipiSchema, t as taalSchema } from '../schema-
|
|
2
|
+
import { S as Swaralipi, N as Note } from '../schema-D_86x4oV.cjs';
|
|
3
|
+
export { B as Bar, b as Bracket, M as Meta, c as Microtone, O as Octave, P as Part, R as Row, d as Svara, a as SvaraLetter, T as Taal, e as barSchema, f as bracketSchema, m as metaSchema, g as microtoneSchema, n as noteSchema, o as octaveSchema, p as partSchema, r as rowSchema, s as svaraLetterSchema, h as svaraSchema, i as swaralipiSchema, t as taalSchema } from '../schema-D_86x4oV.cjs';
|
|
4
4
|
export { a as TAALS, T as TaalId } from '../taals-CjzBuZ35.cjs';
|
|
5
5
|
|
|
6
6
|
/** Current spec version. Documents declare the version they target. */
|
|
7
|
-
declare const SPEC_VERSION = "0.
|
|
7
|
+
declare const SPEC_VERSION = "0.6.0";
|
|
8
8
|
|
|
9
9
|
/** Parse + validate unknown data into a `Swaralipi`. Throws `ZodError` on failure. */
|
|
10
10
|
declare function parseSwaralipi(data: unknown): Swaralipi;
|
package/dist/spec/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
|
-
import { S as Swaralipi, N as Note } from '../schema-
|
|
3
|
-
export { B as Bar, b as Bracket, M as Meta, c as Microtone, O as Octave, P as Part, R as Row, d as Svara, a as SvaraLetter, T as Taal, e as barSchema, f as bracketSchema, m as metaSchema, g as microtoneSchema, n as noteSchema, o as octaveSchema, p as partSchema, r as rowSchema, s as svaraLetterSchema, h as svaraSchema, i as swaralipiSchema, t as taalSchema } from '../schema-
|
|
2
|
+
import { S as Swaralipi, N as Note } from '../schema-D_86x4oV.js';
|
|
3
|
+
export { B as Bar, b as Bracket, M as Meta, c as Microtone, O as Octave, P as Part, R as Row, d as Svara, a as SvaraLetter, T as Taal, e as barSchema, f as bracketSchema, m as metaSchema, g as microtoneSchema, n as noteSchema, o as octaveSchema, p as partSchema, r as rowSchema, s as svaraLetterSchema, h as svaraSchema, i as swaralipiSchema, t as taalSchema } from '../schema-D_86x4oV.js';
|
|
4
4
|
export { a as TAALS, T as TaalId } from '../taals-CjzBuZ35.js';
|
|
5
5
|
|
|
6
6
|
/** Current spec version. Documents declare the version they target. */
|
|
7
|
-
declare const SPEC_VERSION = "0.
|
|
7
|
+
declare const SPEC_VERSION = "0.6.0";
|
|
8
8
|
|
|
9
9
|
/** Parse + validate unknown data into a `Swaralipi`. Throws `ZodError` on failure. */
|
|
10
10
|
declare function parseSwaralipi(data: unknown): Swaralipi;
|
package/dist/spec/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SPEC_VERSION, barSchema, bracketSchema, metaSchema, microtoneSchema, noteSchema, octaveSchema, parseSwaralipi, partSchema, rowSchema, safeParseSwaralipi, svaraLetterSchema, svaraSchema, swaralipiSchema, taalSchema } from '../chunk-
|
|
1
|
+
export { SPEC_VERSION, barSchema, bracketSchema, metaSchema, microtoneSchema, noteSchema, octaveSchema, parseSwaralipi, partSchema, rowSchema, safeParseSwaralipi, svaraLetterSchema, svaraSchema, swaralipiSchema, taalSchema } from '../chunk-ULK7NVKH.js';
|
|
2
2
|
export { TAALS } from '../chunk-6ETPFHZ6.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|