@ugfoundation/swaralipi-js 0.14.2 → 0.15.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 +3 -1
- package/dist/{batch-QEIW6XAA.js → batch-SYLHDJJL.js} +4 -4
- package/dist/{batch-QEIW6XAA.js.map → batch-SYLHDJJL.js.map} +1 -1
- package/dist/{chunk-CJI7A6AM.js → chunk-J5JYJL5N.js} +3 -3
- package/dist/{chunk-CJI7A6AM.js.map → chunk-J5JYJL5N.js.map} +1 -1
- package/dist/{chunk-WEXTZRRB.js → chunk-SPZO4573.js} +35 -7
- package/dist/chunk-SPZO4573.js.map +1 -0
- package/dist/{chunk-6AKH2NLW.js → chunk-WBYJUYI6.js} +3 -3
- package/dist/{chunk-6AKH2NLW.js.map → chunk-WBYJUYI6.js.map} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/convert/index.cjs +1 -1
- 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 +2 -2
- package/dist/index.cjs +1 -1
- 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 +1 -1
- package/dist/{instruments-CfHu4bSQ.d.cts → instruments-C-KtHQiW.d.cts} +12 -9
- package/dist/{instruments-C3CbtYdm.d.ts → instruments-SoUQBZNd.d.ts} +12 -9
- package/dist/{lay-CFLy_wd_.d.ts → lay-CWlEhImP.d.ts} +1 -1
- package/dist/{lay-Bi87MnkT.d.cts → lay-CXhC-HRO.d.cts} +1 -1
- package/dist/player/index.cjs +93 -31
- package/dist/player/index.cjs.map +1 -1
- package/dist/player/index.d.cts +25 -5
- package/dist/player/index.d.ts +25 -5
- package/dist/player/index.js +62 -28
- package/dist/player/index.js.map +1 -1
- package/dist/spec/index.cjs +1 -1
- package/dist/spec/index.cjs.map +1 -1
- package/dist/spec/index.d.cts +12 -12
- package/dist/spec/index.d.ts +12 -12
- package/dist/spec/index.js +1 -1
- package/dist/viewer/index.cjs +43 -10
- package/dist/viewer/index.cjs.map +1 -1
- package/dist/viewer/index.d.cts +6 -4
- package/dist/viewer/index.d.ts +6 -4
- package/dist/viewer/index.js +10 -5
- package/dist/viewer/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-WEXTZRRB.js.map +0 -1
- package/dist/{schema-DyL0bMCf.d.ts → schema-DZag9qkF.d.cts} +36 -36
- package/dist/{schema-DyL0bMCf.d.cts → schema-DZag9qkF.d.ts} +36 -36
package/dist/spec/index.cjs
CHANGED
package/dist/spec/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/spec/schema.ts","../../src/spec/taals.ts","../../src/spec/grace.ts","../../src/spec/lay.ts","../../src/spec/svara.ts","../../src/spec/index.ts"],"names":["z"],"mappings":";;;;;AAOO,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,KAA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lay.js';\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 কণ / রেশ payload. Historically one `Svara` tuple; real notation puts\n * *several* svaras in a grace, and each may itself be a melisma, so the\n * richer form is a list of notes — reusing `Note` brings komal/tivra/\n * microtone/sustain along for free. The tuple form stays valid, so 0.7.x\n * documents parse unchanged; read either with `graceNotes()`.\n */\nexport type Grace = Svara | Note[];\nexport const graceSchema: z.ZodType<Grace> = z.lazy(() =>\n z.union([svaraSchema, z.array(noteSchema).min(1)]),\n);\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 /** কণ স্বর: one or more grace notes attached before this note. */\n kan?: Grace;\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?: Grace;\n /** মীড় (glide/slur) endpoint; `both` ends the arc coming in and starts the next (ণা‿পা‿ধা). */\n meend?: 'start' | 'end' | 'both';\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 * Curation only: why a converter (e.g. an image reader) doubts this cell —\n * `\"স্বর: পা? ধা?\"`. The creator outlines it until someone edits the cell or\n * accepts it, which deletes the field. Viewer and player ignore it.\n */\n review?: 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: graceSchema.optional(),\n resh: graceSchema.optional(),\n meend: z.enum(['start', 'end', 'both']).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 review: 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/** লয় tier. `Lay` (and the tempo factors) live in the zod-free ./lay.js,\n * which the viewer/player import directly; `satisfies` keeps the two in step. */\nexport const laySchema = z.enum(['drut', 'madhya', 'vilambit']) satisfies z.ZodType<Lay>;\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/** 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 /**\n * লয়: the tempo tier this row switches to, held until another row changes\n * it (absent on every row = the whole song at `meta.bpm`, i.e. দ্রুত).\n * Read it with `rowLay()`, which also picks up the mark NLTR *prints*\n * (\"বিলম্বিত লয়:\") in already-converted documents.\n */\n lay: laySchema.optional(),\n /**\n * তালফেরতা: the তাল this row switches to, held until another row changes it\n * (absent on every row = the whole song in `meta.taal`). `null` = মুক্তছন্দ\n * from here on: the accompaniment rests until a later row names a taal.\n * Independent of `lay` — either, both or neither may change on one row.\n */\n taal: taalSchema.nullable().optional(),\n /** That taal's name as printed (e.g. `ষষ্ঠী(২/৪)`) — `meta.taalName`'s twin. */\n taalName: 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/** 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 /** Per-document override of the লয় tempo factors (fractions of `bpm`).\n * Defaults live in `LAY_SPEEDS`; a player/export option overrides both. */\n laySpeeds: z\n .object({ drut: z.number().positive(), madhya: z.number().positive(), vilambit: z.number().positive() })\n .partial()\n .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, rupakra, khemta.\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 rupakra: { id: 'rupakra', numBeats: 8, bhaags: [3, 2, 3], sam: 0 }, // রূপকড়া\n khemta: { id: 'khemta', numBeats: 12, bhaags: [3, 3, 3, 3], sam: 0, khaali: [6] }, // খেমটা\n} as const satisfies Record<string, Taal>;\n\nexport type TaalId = keyof typeof TAALS;\n\n/**\n * The name a তালফেরতা song's header prints instead of one taal (Swarabitan /\n * Gitabitan's own word; gitabitan.io's taxonomy spells it তাল-ফেরতা). The\n * taals themselves live on the rows (`row.taal`).\n */\nexport const TAAL_FERTA = 'তালফেরতা';\n\n/** Whether a printed taal name is the তালফেরতা heading (either spelling). */\nexport function isTaalFerta(name: string | undefined): boolean {\n return name !== undefined && name.normalize('NFC').replace(/[\\s-]/g, '') === TAAL_FERTA;\n}\n\n/**\n * Whether two taal marks name the same accompaniment — the তালফেরতা test.\n * `null` (মুক্তছন্দ) and `undefined` (no taal) are only equal to themselves.\n * Compared by value: a row restating the taal in force is not a change.\n */\nexport function sameTaal(a: Taal | null | undefined, b: Taal | null | undefined): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n return a.id === b.id && a.numBeats === b.numBeats && a.variation === b.variation && String(a.bhaags) === String(b.bhaags);\n}\n","/**\n * কণ / রেশ readers. Zod-free on purpose: the viewer and the player import\n * this directly (the `spec/index.js` barrel would drag zod into their\n * browser bundles — see `taals.ts` for the same rule).\n */\nimport type { Grace, Note, Svara } from './schema.js';\n\n/** Normalise a grace payload to its note list; the legacy tuple is one note. */\nexport function graceNotes(grace: Grace | undefined): Note[] {\n if (grace === undefined) return [];\n return typeof grace[0] === 'string' ? [{ svara: grace as Svara }] : (grace as Note[]);\n}\n","/**\n * লয় (laya) — the tempo tier a passage is sung at.\n *\n * Hindustani names the three tiers বিলম্বিত / মধ্য / দ্রুত (vilambit = slow,\n * madhya = medium, drut = fast), and Rabindrasangeet swaralipi uses the same\n * words: NLTR prints \"বিলম্বিত লয়:\" / \"দ্রুত লয়:\" at the head of the line\n * where the tempo changes (see `printedLay`).\n *\n * `meta.bpm` is the **দ্রুত** tempo — the fast one — so the tiers are\n * multipliers ≤ 1 on it and a document with no লয় marks plays exactly as it\n * did before this field existed.\n *\n * Zod-free on purpose: the viewer, player and creator import this directly\n * (the `spec/index.js` barrel would drag zod into their browser bundles — the\n * same rule as `taals.ts` and `grace.ts`).\n */\nimport type { Note, Row } from './schema.js';\n\nexport type Lay = 'drut' | 'madhya' | 'vilambit';\n\nexport const LAYS: readonly Lay[] = ['drut', 'madhya', 'vilambit'];\n\n/**\n * ### The tempo factors — change them HERE.\n *\n * Fraction of `meta.bpm` each tier is played at. Consumers override per\n * document (`meta.laySpeeds`) or per player/export call (`laySpeeds`), so\n * these are only the fallback.\n */\nexport const LAY_SPEEDS: Record<Lay, number> = {\n drut: 1,\n madhya: 0.75,\n vilambit: 0.5,\n};\n\nexport type LaySpeeds = Partial<Record<Lay, number>>;\n\n/** Resolve the factors actually in force: call option → document → default. */\nexport function resolveLaySpeeds(doc?: LaySpeeds, opt?: LaySpeeds): Record<Lay, number> {\n return { ...LAY_SPEEDS, ...doc, ...opt };\n}\n\n/**\n * The printed লয় mark: the leading lyric-only cells NLTR writes a tempo\n * change as (\"বিলম্বিত\" \"লয়:\"). Reading it means the 1738 already-converted\n * songs change tempo without being reconverted or edited.\n *\n * ponytail: matches the first word only, and only in the leading annotation\n * position where real lyrics never sit — so 'মধ্যমান' (a taal) can't trip it.\n * If a source ever writes the mark elsewhere in the row, give it `row.lay`.\n */\nconst PRINTED: Record<string, Lay> = { দ্রুত: 'drut', মধ্য: 'madhya', বিলম্বিত: 'vilambit' };\n\nexport function printedLay(notes: Note[]): Lay | undefined {\n const first = notes[0];\n if (first === undefined || first.lyric === undefined) return undefined;\n for (const k of Object.keys(first)) if (k !== 'lyric') return undefined;\n return PRINTED[first.lyric.normalize('NFC')];\n}\n\n/** The লয় this row switches to, if any: the explicit field wins over the\n * source's printed mark. `undefined` = carry on at the previous tier. */\nexport function rowLay(row: Row): Lay | undefined {\n return row.lay ?? printedLay(row.notes);\n}\n","/**\n * Which svaras admit which alteration — স and প are অচল (immovable), ম has\n * only its তীব্র (কড়ি) form, and র গ ধ ন only their কোমল form. The notation\n * fonts encode exactly this (no glyph exists for a কোমল প), so a flag the\n * sheet cannot draw must not move the pitch either.\n *\n * Zod-free on purpose: the viewer and the player import this directly (the\n * `spec/index.js` barrel would drag zod into their browser bundles — see\n * `taals.ts` and `grace.ts` for the same rule).\n */\nimport type { SvaraLetter } from './schema.js';\n\nexport function hasKomal(letter: SvaraLetter): boolean {\n return letter === 'r' || letter === 'g' || letter === 'd' || letter === 'n';\n}\n\nexport function hasTivra(letter: SvaraLetter): boolean {\n return letter === 'm';\n}\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.14.2';\n\nexport {\n octaveSchema,\n svaraLetterSchema,\n svaraSchema,\n microtoneSchema,\n barSchema,\n bracketSchema,\n graceSchema,\n laySchema,\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 Grace,\n Note,\n Row,\n Part,\n Taal,\n Meta,\n Swaralipi,\n} from './schema.js';\n\nexport { TAALS, TAAL_FERTA, isTaalFerta, sameTaal, type TaalId } from './taals.js';\nexport { graceNotes } from './grace.js';\nexport {\n LAYS,\n LAY_SPEEDS,\n printedLay,\n resolveLaySpeeds,\n rowLay,\n type Lay,\n type LaySpeeds,\n} from './lay.js';\nexport { hasKomal, hasTivra } from './svara.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/grace.ts","../../src/spec/lay.ts","../../src/spec/svara.ts","../../src/spec/index.ts"],"names":["z"],"mappings":";;;;;AAOO,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,KAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,MAAA,EAAQ,KAAK,CAAC,CAAA;AAAA,EACtC,MAAMA,KAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,OAAO,CAAC;AAChC,CAAC;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Y,GAAG,GAAA,EAAK,GAAG,GAAA,EAAI;AACzC;AAWA,IAAM,UAA+B,EAAE,8BAAA,EAAO,QAAQ,wBAAA,EAAM,QAAA,EAAU,kDAAU,UAAA,EAAW;AAEpF,SAAS,WAAW,KAAA,EAAgC;AACzD,EAAA,MAAM,KAAA,GAAQ,MAAM,CAAC,CAAA;AACrB,EAAA,IAAI,KAAA,KAAU,MAAA,IAAa,KAAA,CAAM,KAAA,KAAU,QAAW,OAAO,MAAA;AAC7D,EAAA,KAAA,MAAW,CAAA,IAAK,OAAO,IAAA,CAAK,KAAK,GAAG,IAAI,CAAA,KAAM,SAAS,OAAO,MAAA;AAC9D,EAAA,OAAO,OAAA,CAAQ,KAAA,CAAM,KAAA,CAAM,SAAA,CAAU,KAAK,CAAC,CAAA;AAC7C;AAIO,SAAS,OAAO,GAAA,EAA2B;AAChD,EAAA,OAAO,GAAA,CAAI,GAAA,IAAO,UAAA,CAAW,GAAA,CAAI,KAAK,CAAA;AACxC;;;ACpDO,SAAS,SAAS,MAAA,EAA8B;AACrD,EAAA,OAAO,WAAW,GAAA,IAAO,MAAA,KAAW,GAAA,IAAO,MAAA,KAAW,OAAO,MAAA,KAAW,GAAA;AAC1E;AAEO,SAAS,SAAS,MAAA,EAA8B;AACrD,EAAA,OAAO,MAAA,KAAW,GAAA;AACpB;;;ACVO,IAAM,YAAA,GAAe;AAiDrB,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';\nimport type { Lay } from './lay.js';\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 কণ / রেশ payload. Historically one `Svara` tuple; real notation puts\n * *several* svaras in a grace, and each may itself be a melisma, so the\n * richer form is a list of notes — reusing `Note` brings komal/tivra/\n * microtone/sustain along for free. The tuple form stays valid, so 0.7.x\n * documents parse unchanged; read either with `graceNotes()`.\n */\nexport type Grace = Svara | Note[];\nexport const graceSchema: z.ZodType<Grace> = z.lazy(() =>\n z.union([svaraSchema, z.array(noteSchema).min(1)]),\n);\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 /** কণ স্বর: one or more grace notes attached before this note. */\n kan?: Grace;\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?: Grace;\n /** মীড় (glide/slur) endpoint; `both` ends the arc coming in and starts the next (ণা‿পা‿ধা). */\n meend?: 'start' | 'end' | 'both';\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 * Curation only: why a converter (e.g. an image reader) doubts this cell —\n * `\"স্বর: পা? ধা?\"`. The creator outlines it until someone edits the cell or\n * accepts it, which deletes the field. Viewer and player ignore it.\n */\n review?: 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: graceSchema.optional(),\n resh: graceSchema.optional(),\n meend: z.enum(['start', 'end', 'both']).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 review: 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/** লয় tier. `Lay` (and the tempo factors) live in the zod-free ./lay.js,\n * which the viewer/player import directly; `satisfies` keeps the two in step. */\nexport const laySchema = z.enum(['drut', 'madhya', 'vilambit']) satisfies z.ZodType<Lay>;\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/** 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 /**\n * লয়: the tempo tier this row switches to, held until another row changes\n * it (absent on every row = the whole song at `meta.bpm`, i.e. দ্রুত).\n * Read it with `rowLay()`, which also picks up the mark NLTR *prints*\n * (\"বিলম্বিত লয়:\") in already-converted documents.\n */\n lay: laySchema.optional(),\n /**\n * তালফেরতা: the তাল this row switches to, held until another row changes it\n * (absent on every row = the whole song in `meta.taal`). `null` = মুক্তছন্দ\n * from here on: the accompaniment rests until a later row names a taal.\n * Independent of `lay` — either, both or neither may change on one row.\n */\n taal: taalSchema.nullable().optional(),\n /** That taal's name as printed (e.g. `ষষ্ঠী(২/৪)`) — `meta.taalName`'s twin. */\n taalName: 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/** 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 /** Per-document override of the লয় tempo factors (fractions of `bpm`).\n * Defaults live in `LAY_SPEEDS`; a player/export option overrides both. */\n laySpeeds: z\n .object({ drut: z.number().positive(), madhya: z.number().positive(), vilambit: z.number().positive() })\n .partial()\n .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, rupakra, khemta.\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 rupakra: { id: 'rupakra', numBeats: 8, bhaags: [3, 2, 3], sam: 0 }, // রূপকড়া\n khemta: { id: 'khemta', numBeats: 12, bhaags: [3, 3, 3, 3], sam: 0, khaali: [6] }, // খেমটা\n} as const satisfies Record<string, Taal>;\n\nexport type TaalId = keyof typeof TAALS;\n\n/**\n * The name a তালফেরতা song's header prints instead of one taal (Swarabitan /\n * Gitabitan's own word; gitabitan.io's taxonomy spells it তাল-ফেরতা). The\n * taals themselves live on the rows (`row.taal`).\n */\nexport const TAAL_FERTA = 'তালফেরতা';\n\n/** Whether a printed taal name is the তালফেরতা heading (either spelling). */\nexport function isTaalFerta(name: string | undefined): boolean {\n return name !== undefined && name.normalize('NFC').replace(/[\\s-]/g, '') === TAAL_FERTA;\n}\n\n/**\n * Whether two taal marks name the same accompaniment — the তালফেরতা test.\n * `null` (মুক্তছন্দ) and `undefined` (no taal) are only equal to themselves.\n * Compared by value: a row restating the taal in force is not a change.\n */\nexport function sameTaal(a: Taal | null | undefined, b: Taal | null | undefined): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n return a.id === b.id && a.numBeats === b.numBeats && a.variation === b.variation && String(a.bhaags) === String(b.bhaags);\n}\n","/**\n * কণ / রেশ readers. Zod-free on purpose: the viewer and the player import\n * this directly (the `spec/index.js` barrel would drag zod into their\n * browser bundles — see `taals.ts` for the same rule).\n */\nimport type { Grace, Note, Svara } from './schema.js';\n\n/** Normalise a grace payload to its note list; the legacy tuple is one note. */\nexport function graceNotes(grace: Grace | undefined): Note[] {\n if (grace === undefined) return [];\n return typeof grace[0] === 'string' ? [{ svara: grace as Svara }] : (grace as Note[]);\n}\n","/**\n * লয় (laya) — the tempo tier a passage is sung at.\n *\n * Hindustani names the three tiers বিলম্বিত / মধ্য / দ্রুত (vilambit = slow,\n * madhya = medium, drut = fast), and Rabindrasangeet swaralipi uses the same\n * words: NLTR prints \"বিলম্বিত লয়:\" / \"দ্রুত লয়:\" at the head of the line\n * where the tempo changes (see `printedLay`).\n *\n * `meta.bpm` is the **দ্রুত** tempo — the fast one — so the tiers are\n * multipliers ≤ 1 on it and a document with no লয় marks plays exactly as it\n * did before this field existed.\n *\n * Zod-free on purpose: the viewer, player and creator import this directly\n * (the `spec/index.js` barrel would drag zod into their browser bundles — the\n * same rule as `taals.ts` and `grace.ts`).\n */\nimport type { Note, Row } from './schema.js';\n\nexport type Lay = 'drut' | 'madhya' | 'vilambit';\n\nexport const LAYS: readonly Lay[] = ['drut', 'madhya', 'vilambit'];\n\n/**\n * ### The tempo factors — change them HERE.\n *\n * Fraction of `meta.bpm` each tier is played at. Consumers override per\n * document (`meta.laySpeeds`) or per player/export call (`laySpeeds`), so\n * these are only the fallback.\n */\nexport const LAY_SPEEDS: Record<Lay, number> = {\n drut: 1,\n madhya: 0.75,\n vilambit: 0.5,\n};\n\nexport type LaySpeeds = Partial<Record<Lay, number>>;\n\n/** Resolve the factors actually in force: call option → document → default. */\nexport function resolveLaySpeeds(doc?: LaySpeeds, opt?: LaySpeeds): Record<Lay, number> {\n return { ...LAY_SPEEDS, ...doc, ...opt };\n}\n\n/**\n * The printed লয় mark: the leading lyric-only cells NLTR writes a tempo\n * change as (\"বিলম্বিত\" \"লয়:\"). Reading it means the 1738 already-converted\n * songs change tempo without being reconverted or edited.\n *\n * ponytail: matches the first word only, and only in the leading annotation\n * position where real lyrics never sit — so 'মধ্যমান' (a taal) can't trip it.\n * If a source ever writes the mark elsewhere in the row, give it `row.lay`.\n */\nconst PRINTED: Record<string, Lay> = { দ্রুত: 'drut', মধ্য: 'madhya', বিলম্বিত: 'vilambit' };\n\nexport function printedLay(notes: Note[]): Lay | undefined {\n const first = notes[0];\n if (first === undefined || first.lyric === undefined) return undefined;\n for (const k of Object.keys(first)) if (k !== 'lyric') return undefined;\n return PRINTED[first.lyric.normalize('NFC')];\n}\n\n/** The লয় this row switches to, if any: the explicit field wins over the\n * source's printed mark. `undefined` = carry on at the previous tier. */\nexport function rowLay(row: Row): Lay | undefined {\n return row.lay ?? printedLay(row.notes);\n}\n","/**\n * Which svaras admit which alteration — স and প are অচল (immovable), ম has\n * only its তীব্র (কড়ি) form, and র গ ধ ন only their কোমল form. The notation\n * fonts encode exactly this (no glyph exists for a কোমল প), so a flag the\n * sheet cannot draw must not move the pitch either.\n *\n * Zod-free on purpose: the viewer and the player import this directly (the\n * `spec/index.js` barrel would drag zod into their browser bundles — see\n * `taals.ts` and `grace.ts` for the same rule).\n */\nimport type { SvaraLetter } from './schema.js';\n\nexport function hasKomal(letter: SvaraLetter): boolean {\n return letter === 'r' || letter === 'g' || letter === 'd' || letter === 'n';\n}\n\nexport function hasTivra(letter: SvaraLetter): boolean {\n return letter === 'm';\n}\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.15.0';\n\nexport {\n octaveSchema,\n svaraLetterSchema,\n svaraSchema,\n microtoneSchema,\n barSchema,\n bracketSchema,\n graceSchema,\n laySchema,\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 Grace,\n Note,\n Row,\n Part,\n Taal,\n Meta,\n Swaralipi,\n} from './schema.js';\n\nexport { TAALS, TAAL_FERTA, isTaalFerta, sameTaal, type TaalId } from './taals.js';\nexport { graceNotes } from './grace.js';\nexport {\n LAYS,\n LAY_SPEEDS,\n printedLay,\n resolveLaySpeeds,\n rowLay,\n type Lay,\n type LaySpeeds,\n} from './lay.js';\nexport { hasKomal, hasTivra } from './svara.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,7 +1,7 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
|
-
import { G as Grace, N as Note, a as SvaraLetter, S as Swaralipi } 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, T as Taal, e as barSchema, f as bracketSchema, g as graceSchema, l as laySchema, m as metaSchema, h as microtoneSchema, n as noteSchema, o as octaveSchema, p as partSchema, r as rowSchema, s as svaraLetterSchema, i as svaraSchema, j as swaralipiSchema, t as taalSchema } from '../schema-
|
|
4
|
-
export { b as LAYS, c as LAY_SPEEDS, L as Lay, a as LaySpeeds, e as TAALS, f as TAAL_FERTA, T as TaalId, i as isTaalFerta, p as printedLay, r as resolveLaySpeeds, d as rowLay, s as sameTaal } from '../lay-
|
|
2
|
+
import { G as Grace, N as Note, a as SvaraLetter, S as Swaralipi } from '../schema-DZag9qkF.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, T as Taal, e as barSchema, f as bracketSchema, g as graceSchema, l as laySchema, m as metaSchema, h as microtoneSchema, n as noteSchema, o as octaveSchema, p as partSchema, r as rowSchema, s as svaraLetterSchema, i as svaraSchema, j as swaralipiSchema, t as taalSchema } from '../schema-DZag9qkF.cjs';
|
|
4
|
+
export { b as LAYS, c as LAY_SPEEDS, L as Lay, a as LaySpeeds, e as TAALS, f as TAAL_FERTA, T as TaalId, i as isTaalFerta, p as printedLay, r as resolveLaySpeeds, d as rowLay, s as sameTaal } from '../lay-CXhC-HRO.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* কণ / রেশ readers. Zod-free on purpose: the viewer and the player import
|
|
@@ -27,7 +27,7 @@ declare function hasKomal(letter: SvaraLetter): boolean;
|
|
|
27
27
|
declare function hasTivra(letter: SvaraLetter): boolean;
|
|
28
28
|
|
|
29
29
|
/** Current spec version. Documents declare the version they target. */
|
|
30
|
-
declare const SPEC_VERSION = "0.
|
|
30
|
+
declare const SPEC_VERSION = "0.15.0";
|
|
31
31
|
|
|
32
32
|
/** Parse + validate unknown data into a `Swaralipi`. Throws `ZodError` on failure. */
|
|
33
33
|
declare function parseSwaralipi(data: unknown): Swaralipi;
|
|
@@ -36,8 +36,6 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
36
36
|
version: string;
|
|
37
37
|
meta: {
|
|
38
38
|
title: string;
|
|
39
|
-
songId?: string | undefined;
|
|
40
|
-
nltrId?: number | undefined;
|
|
41
39
|
taal?: {
|
|
42
40
|
id: string;
|
|
43
41
|
numBeats: number;
|
|
@@ -47,6 +45,8 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
47
45
|
khaali?: number[] | undefined;
|
|
48
46
|
} | undefined;
|
|
49
47
|
taalName?: string | undefined;
|
|
48
|
+
songId?: string | undefined;
|
|
49
|
+
nltrId?: number | undefined;
|
|
50
50
|
tonic?: string | undefined;
|
|
51
51
|
bpm?: number | null | undefined;
|
|
52
52
|
laySpeeds?: {
|
|
@@ -62,6 +62,8 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
62
62
|
parts: {
|
|
63
63
|
rows: {
|
|
64
64
|
notes: Note[];
|
|
65
|
+
label?: string | undefined;
|
|
66
|
+
lay?: "drut" | "madhya" | "vilambit" | undefined;
|
|
65
67
|
taal?: {
|
|
66
68
|
id: string;
|
|
67
69
|
numBeats: number;
|
|
@@ -71,8 +73,6 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
71
73
|
khaali?: number[] | undefined;
|
|
72
74
|
} | null | undefined;
|
|
73
75
|
taalName?: string | undefined;
|
|
74
|
-
label?: string | undefined;
|
|
75
|
-
lay?: "drut" | "madhya" | "vilambit" | undefined;
|
|
76
76
|
}[];
|
|
77
77
|
name?: string | undefined;
|
|
78
78
|
}[];
|
|
@@ -80,8 +80,6 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
80
80
|
version: string;
|
|
81
81
|
meta: {
|
|
82
82
|
title: string;
|
|
83
|
-
songId?: string | undefined;
|
|
84
|
-
nltrId?: number | undefined;
|
|
85
83
|
taal?: {
|
|
86
84
|
id: string;
|
|
87
85
|
numBeats: number;
|
|
@@ -91,6 +89,8 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
91
89
|
khaali?: number[] | undefined;
|
|
92
90
|
} | undefined;
|
|
93
91
|
taalName?: string | undefined;
|
|
92
|
+
songId?: string | undefined;
|
|
93
|
+
nltrId?: number | undefined;
|
|
94
94
|
tonic?: string | undefined;
|
|
95
95
|
bpm?: number | null | undefined;
|
|
96
96
|
laySpeeds?: {
|
|
@@ -106,6 +106,8 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
106
106
|
parts: {
|
|
107
107
|
rows: {
|
|
108
108
|
notes: Note[];
|
|
109
|
+
label?: string | undefined;
|
|
110
|
+
lay?: "drut" | "madhya" | "vilambit" | undefined;
|
|
109
111
|
taal?: {
|
|
110
112
|
id: string;
|
|
111
113
|
numBeats: number;
|
|
@@ -115,8 +117,6 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
115
117
|
khaali?: number[] | undefined;
|
|
116
118
|
} | null | undefined;
|
|
117
119
|
taalName?: string | undefined;
|
|
118
|
-
label?: string | undefined;
|
|
119
|
-
lay?: "drut" | "madhya" | "vilambit" | undefined;
|
|
120
120
|
}[];
|
|
121
121
|
name?: string | undefined;
|
|
122
122
|
}[];
|
package/dist/spec/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
|
-
import { G as Grace, N as Note, a as SvaraLetter, S as Swaralipi } 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, T as Taal, e as barSchema, f as bracketSchema, g as graceSchema, l as laySchema, m as metaSchema, h as microtoneSchema, n as noteSchema, o as octaveSchema, p as partSchema, r as rowSchema, s as svaraLetterSchema, i as svaraSchema, j as swaralipiSchema, t as taalSchema } from '../schema-
|
|
4
|
-
export { b as LAYS, c as LAY_SPEEDS, L as Lay, a as LaySpeeds, e as TAALS, f as TAAL_FERTA, T as TaalId, i as isTaalFerta, p as printedLay, r as resolveLaySpeeds, d as rowLay, s as sameTaal } from '../lay-
|
|
2
|
+
import { G as Grace, N as Note, a as SvaraLetter, S as Swaralipi } from '../schema-DZag9qkF.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, T as Taal, e as barSchema, f as bracketSchema, g as graceSchema, l as laySchema, m as metaSchema, h as microtoneSchema, n as noteSchema, o as octaveSchema, p as partSchema, r as rowSchema, s as svaraLetterSchema, i as svaraSchema, j as swaralipiSchema, t as taalSchema } from '../schema-DZag9qkF.js';
|
|
4
|
+
export { b as LAYS, c as LAY_SPEEDS, L as Lay, a as LaySpeeds, e as TAALS, f as TAAL_FERTA, T as TaalId, i as isTaalFerta, p as printedLay, r as resolveLaySpeeds, d as rowLay, s as sameTaal } from '../lay-CWlEhImP.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* কণ / রেশ readers. Zod-free on purpose: the viewer and the player import
|
|
@@ -27,7 +27,7 @@ declare function hasKomal(letter: SvaraLetter): boolean;
|
|
|
27
27
|
declare function hasTivra(letter: SvaraLetter): boolean;
|
|
28
28
|
|
|
29
29
|
/** Current spec version. Documents declare the version they target. */
|
|
30
|
-
declare const SPEC_VERSION = "0.
|
|
30
|
+
declare const SPEC_VERSION = "0.15.0";
|
|
31
31
|
|
|
32
32
|
/** Parse + validate unknown data into a `Swaralipi`. Throws `ZodError` on failure. */
|
|
33
33
|
declare function parseSwaralipi(data: unknown): Swaralipi;
|
|
@@ -36,8 +36,6 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
36
36
|
version: string;
|
|
37
37
|
meta: {
|
|
38
38
|
title: string;
|
|
39
|
-
songId?: string | undefined;
|
|
40
|
-
nltrId?: number | undefined;
|
|
41
39
|
taal?: {
|
|
42
40
|
id: string;
|
|
43
41
|
numBeats: number;
|
|
@@ -47,6 +45,8 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
47
45
|
khaali?: number[] | undefined;
|
|
48
46
|
} | undefined;
|
|
49
47
|
taalName?: string | undefined;
|
|
48
|
+
songId?: string | undefined;
|
|
49
|
+
nltrId?: number | undefined;
|
|
50
50
|
tonic?: string | undefined;
|
|
51
51
|
bpm?: number | null | undefined;
|
|
52
52
|
laySpeeds?: {
|
|
@@ -62,6 +62,8 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
62
62
|
parts: {
|
|
63
63
|
rows: {
|
|
64
64
|
notes: Note[];
|
|
65
|
+
label?: string | undefined;
|
|
66
|
+
lay?: "drut" | "madhya" | "vilambit" | undefined;
|
|
65
67
|
taal?: {
|
|
66
68
|
id: string;
|
|
67
69
|
numBeats: number;
|
|
@@ -71,8 +73,6 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
71
73
|
khaali?: number[] | undefined;
|
|
72
74
|
} | null | undefined;
|
|
73
75
|
taalName?: string | undefined;
|
|
74
|
-
label?: string | undefined;
|
|
75
|
-
lay?: "drut" | "madhya" | "vilambit" | undefined;
|
|
76
76
|
}[];
|
|
77
77
|
name?: string | undefined;
|
|
78
78
|
}[];
|
|
@@ -80,8 +80,6 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
80
80
|
version: string;
|
|
81
81
|
meta: {
|
|
82
82
|
title: string;
|
|
83
|
-
songId?: string | undefined;
|
|
84
|
-
nltrId?: number | undefined;
|
|
85
83
|
taal?: {
|
|
86
84
|
id: string;
|
|
87
85
|
numBeats: number;
|
|
@@ -91,6 +89,8 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
91
89
|
khaali?: number[] | undefined;
|
|
92
90
|
} | undefined;
|
|
93
91
|
taalName?: string | undefined;
|
|
92
|
+
songId?: string | undefined;
|
|
93
|
+
nltrId?: number | undefined;
|
|
94
94
|
tonic?: string | undefined;
|
|
95
95
|
bpm?: number | null | undefined;
|
|
96
96
|
laySpeeds?: {
|
|
@@ -106,6 +106,8 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
106
106
|
parts: {
|
|
107
107
|
rows: {
|
|
108
108
|
notes: Note[];
|
|
109
|
+
label?: string | undefined;
|
|
110
|
+
lay?: "drut" | "madhya" | "vilambit" | undefined;
|
|
109
111
|
taal?: {
|
|
110
112
|
id: string;
|
|
111
113
|
numBeats: number;
|
|
@@ -115,8 +117,6 @@ declare function safeParseSwaralipi(data: unknown): zod.SafeParseReturnType<{
|
|
|
115
117
|
khaali?: number[] | undefined;
|
|
116
118
|
} | null | undefined;
|
|
117
119
|
taalName?: string | undefined;
|
|
118
|
-
label?: string | undefined;
|
|
119
|
-
lay?: "drut" | "madhya" | "vilambit" | undefined;
|
|
120
120
|
}[];
|
|
121
121
|
name?: string | undefined;
|
|
122
122
|
}[];
|
package/dist/spec/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SPEC_VERSION, barSchema, bracketSchema, graceSchema, laySchema, metaSchema, microtoneSchema, noteSchema, octaveSchema, parseSwaralipi, partSchema, rowSchema, safeParseSwaralipi, svaraLetterSchema, svaraSchema, swaralipiSchema, taalSchema } from '../chunk-
|
|
1
|
+
export { SPEC_VERSION, barSchema, bracketSchema, graceSchema, laySchema, metaSchema, microtoneSchema, noteSchema, octaveSchema, parseSwaralipi, partSchema, rowSchema, safeParseSwaralipi, svaraLetterSchema, svaraSchema, swaralipiSchema, taalSchema } from '../chunk-J5JYJL5N.js';
|
|
2
2
|
export { LAYS, LAY_SPEEDS, TAALS, TAAL_FERTA, graceNotes, hasKomal, hasTivra, isTaalFerta, printedLay, resolveLaySpeeds, rowLay, sameTaal } from '../chunk-K73Y46WU.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/viewer/index.cjs
CHANGED
|
@@ -286,7 +286,7 @@ var init_spec = __esm({
|
|
|
286
286
|
init_grace();
|
|
287
287
|
init_lay();
|
|
288
288
|
init_svara();
|
|
289
|
-
SPEC_VERSION = "0.
|
|
289
|
+
SPEC_VERSION = "0.15.0";
|
|
290
290
|
}
|
|
291
291
|
});
|
|
292
292
|
|
|
@@ -741,6 +741,19 @@ function glideTargets(events, i) {
|
|
|
741
741
|
return out;
|
|
742
742
|
}
|
|
743
743
|
var SAM_TICK = /^\d+[fF]$/;
|
|
744
|
+
function loosePickupSam(doc) {
|
|
745
|
+
const rows = doc.parts.flatMap((part, p) => part.rows.map((row, r) => ({ p, r, notes: row.notes })));
|
|
746
|
+
const opener = (notes) => notes.find((n) => n.bar !== void 0 || !isSilent(n));
|
|
747
|
+
const first = rows.findIndex((row) => opener(row.notes) !== void 0);
|
|
748
|
+
if (first < 0 || opener(rows[first].notes).bar !== void 0) return void 0;
|
|
749
|
+
const line = rows.slice(first + 1).find((row) => opener(row.notes)?.bar !== void 0);
|
|
750
|
+
if (line !== void 0) return [line.p, line.r, 0];
|
|
751
|
+
for (const { p, r, notes } of rows) {
|
|
752
|
+
const i = notes.findIndex((n) => n.bar === "single");
|
|
753
|
+
if (i >= 0) return [p, r, i];
|
|
754
|
+
}
|
|
755
|
+
return void 0;
|
|
756
|
+
}
|
|
744
757
|
function buildSchedule(doc, opts = {}) {
|
|
745
758
|
const tonicPc = parseTonic(opts.tonic ?? doc.meta.tonic);
|
|
746
759
|
const baseOctave = opts.baseOctave ?? 4;
|
|
@@ -767,12 +780,16 @@ function buildSchedule(doc, opts = {}) {
|
|
|
767
780
|
);
|
|
768
781
|
const order = opts.repeats === true ? playOrder(doc) : doc.parts.flatMap((part, p) => part.rows.flatMap((row, r) => row.notes.map((note, i) => ({ p, r, i, note }))));
|
|
769
782
|
const at = [0];
|
|
770
|
-
|
|
771
|
-
|
|
783
|
+
const loose = loosePickupSam(doc);
|
|
784
|
+
let tick;
|
|
785
|
+
let inferred;
|
|
786
|
+
for (const { p, r, i, note } of order) {
|
|
772
787
|
const m = at[at.length - 1];
|
|
773
|
-
if (
|
|
788
|
+
if (tick === void 0 && note.above?.some((a) => a.raw !== void 0 && SAM_TICK.test(a.raw))) tick = m;
|
|
789
|
+
if (inferred === void 0 && loose !== void 0 && p === loose[0] && r === loose[1] && i >= loose[2]) inferred = m;
|
|
774
790
|
at.push(note.bar === void 0 && !isSilent(note) ? m + (note.durationMatra ?? 1) : m);
|
|
775
791
|
}
|
|
792
|
+
const samMatra = tick ?? inferred;
|
|
776
793
|
const { visits, matra: matra2 } = opts.excerpt ? excerptVisits(order, at, opts.excerpt, (v) => rows.get(`${v.p}.${v.r}`).taal?.numBeats) : { visits: order, matra: 0 };
|
|
777
794
|
let rowNow = "";
|
|
778
795
|
for (const { p, r, i, note } of visits) {
|
|
@@ -816,9 +833,20 @@ function buildSchedule(doc, opts = {}) {
|
|
|
816
833
|
cursor += dur;
|
|
817
834
|
}
|
|
818
835
|
const numBeats = tempo[0].taal?.numBeats;
|
|
819
|
-
|
|
836
|
+
let pickupMatra = 0;
|
|
837
|
+
if (numBeats !== void 0 && numBeats > 0) {
|
|
838
|
+
pickupMatra = ((matra2 - (samMatra ?? 0)) % numBeats + numBeats) % numBeats;
|
|
839
|
+
if (pickupMatra < 1e-6 || pickupMatra > numBeats - 1e-6) pickupMatra = 0;
|
|
840
|
+
}
|
|
820
841
|
tempo[tempo.length - 1].endBeat = cursor;
|
|
821
|
-
|
|
842
|
+
const opening = tempo[0].scale;
|
|
843
|
+
return {
|
|
844
|
+
events,
|
|
845
|
+
totalBeats: cursor,
|
|
846
|
+
pickupBeats: pickupMatra / opening,
|
|
847
|
+
samBeat: pickupMatra > 0 ? (numBeats - pickupMatra) / opening : 0,
|
|
848
|
+
tempo
|
|
849
|
+
};
|
|
822
850
|
}
|
|
823
851
|
|
|
824
852
|
// src/viewer/render.ts
|
|
@@ -1945,8 +1973,8 @@ function buildAbc(schedule, lyricOf, opts) {
|
|
|
1945
1973
|
let beatsPerBar = barLen(meters[0]);
|
|
1946
1974
|
const tokens = [];
|
|
1947
1975
|
const words = [];
|
|
1948
|
-
let barPos = 0;
|
|
1949
1976
|
const EPS4 = 1e-6;
|
|
1977
|
+
let barPos = (beatsPerBar - schedule.samBeat % beatsPerBar) % beatsPerBar;
|
|
1950
1978
|
const advance = (dur) => {
|
|
1951
1979
|
barPos += dur;
|
|
1952
1980
|
while (barPos >= beatsPerBar - EPS4) {
|
|
@@ -1994,7 +2022,7 @@ function buildAbc(schedule, lyricOf, opts) {
|
|
|
1994
2022
|
if (withDrums) {
|
|
1995
2023
|
lines.push("V:1", melodyBody);
|
|
1996
2024
|
if (opts.lyrics && words.some((w) => w !== "*" && w !== "|")) lines.push(`w: ${words.join(" ")}`);
|
|
1997
|
-
lines.push("V:2 clef=perc stem=up", buildDrumVoice(schedule.totalBeats, meters));
|
|
2025
|
+
lines.push("V:2 clef=perc stem=up", buildDrumVoice(schedule.totalBeats, meters, schedule.samBeat));
|
|
1998
2026
|
} else {
|
|
1999
2027
|
lines.push(melodyBody);
|
|
2000
2028
|
if (opts.lyrics && words.some((w) => w !== "*" && w !== "|")) lines.push(`w: ${words.join(" ")}`);
|
|
@@ -2023,7 +2051,7 @@ function percMapLines(voices) {
|
|
|
2023
2051
|
}
|
|
2024
2052
|
return lines;
|
|
2025
2053
|
}
|
|
2026
|
-
function buildDrumVoice(totalBeats, meters) {
|
|
2054
|
+
function buildDrumVoice(totalBeats, meters, pickup = 0) {
|
|
2027
2055
|
const tokens = [];
|
|
2028
2056
|
meters.forEach((m, i) => {
|
|
2029
2057
|
const bpb = barLen(m);
|
|
@@ -2032,7 +2060,12 @@ function buildDrumVoice(totalBeats, meters) {
|
|
|
2032
2060
|
if (bpb !== barLen(meters[i - 1])) tokens.push(`[M:${ratioMeter(bpb)}]`);
|
|
2033
2061
|
}
|
|
2034
2062
|
const end = meters[i + 1]?.beat ?? Math.max(1, Math.ceil(totalBeats));
|
|
2035
|
-
|
|
2063
|
+
let from = m.beat;
|
|
2064
|
+
if (i === 0 && pickup > 0 && pickup < end) {
|
|
2065
|
+
tokens.push(`z${abcDuration(pickup)}`, "|");
|
|
2066
|
+
from += pickup;
|
|
2067
|
+
}
|
|
2068
|
+
const n = Math.ceil(end - from - 1e-6);
|
|
2036
2069
|
for (let beat = 0; beat < n; beat++) {
|
|
2037
2070
|
tokens.push(m.drums?.length ? DRUM_ABC[m.drums[beat % m.drums.length]].note : "z");
|
|
2038
2071
|
if ((beat + 1) % bpb === 0) tokens.push("|");
|