@sudobility/music_types 0.11.19 → 0.11.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/domain/commands/edit-commands.d.ts +66 -0
  2. package/dist/domain/commands/edit-commands.d.ts.map +1 -0
  3. package/dist/domain/commands/edit-commands.js +185 -0
  4. package/dist/domain/commands/edit-commands.js.map +1 -0
  5. package/dist/domain/commands/note-commands.d.ts +73 -0
  6. package/dist/domain/commands/note-commands.d.ts.map +1 -0
  7. package/dist/domain/commands/note-commands.js +292 -0
  8. package/dist/domain/commands/note-commands.js.map +1 -0
  9. package/dist/domain/commands/reflow.d.ts +69 -0
  10. package/dist/domain/commands/reflow.d.ts.map +1 -0
  11. package/dist/domain/commands/reflow.js +395 -0
  12. package/dist/domain/commands/reflow.js.map +1 -0
  13. package/dist/domain/commands/region-commands.d.ts +21 -0
  14. package/dist/domain/commands/region-commands.d.ts.map +1 -0
  15. package/dist/domain/commands/region-commands.js +47 -0
  16. package/dist/domain/commands/region-commands.js.map +1 -0
  17. package/dist/domain/commands/relocate-commands.d.ts +18 -0
  18. package/dist/domain/commands/relocate-commands.d.ts.map +1 -0
  19. package/dist/domain/commands/relocate-commands.js +108 -0
  20. package/dist/domain/commands/relocate-commands.js.map +1 -0
  21. package/dist/domain/commands/ripple-commands.d.ts +44 -0
  22. package/dist/domain/commands/ripple-commands.d.ts.map +1 -0
  23. package/dist/domain/commands/ripple-commands.js +104 -0
  24. package/dist/domain/commands/ripple-commands.js.map +1 -0
  25. package/dist/domain/commands/snapshot.d.ts +38 -0
  26. package/dist/domain/commands/snapshot.d.ts.map +1 -0
  27. package/dist/domain/commands/snapshot.js +44 -0
  28. package/dist/domain/commands/snapshot.js.map +1 -0
  29. package/dist/domain/commands/structure-commands.d.ts +38 -0
  30. package/dist/domain/commands/structure-commands.d.ts.map +1 -0
  31. package/dist/domain/commands/structure-commands.js +220 -0
  32. package/dist/domain/commands/structure-commands.js.map +1 -0
  33. package/dist/domain/commands/track-commands.d.ts +15 -0
  34. package/dist/domain/commands/track-commands.d.ts.map +1 -0
  35. package/dist/domain/commands/track-commands.js +56 -0
  36. package/dist/domain/commands/track-commands.js.map +1 -0
  37. package/dist/domain/commands/types.d.ts +31 -0
  38. package/dist/domain/commands/types.d.ts.map +1 -0
  39. package/dist/domain/commands/types.js +2 -0
  40. package/dist/domain/commands/types.js.map +1 -0
  41. package/dist/domain/instruments/gm-kit.d.ts +45 -0
  42. package/dist/domain/instruments/gm-kit.d.ts.map +1 -0
  43. package/dist/domain/instruments/gm-kit.js +59 -0
  44. package/dist/domain/instruments/gm-kit.js.map +1 -0
  45. package/dist/domain/instruments/gm-percussion.d.ts +42 -0
  46. package/dist/domain/instruments/gm-percussion.d.ts.map +1 -0
  47. package/dist/domain/instruments/gm-percussion.js +85 -0
  48. package/dist/domain/instruments/gm-percussion.js.map +1 -0
  49. package/dist/domain/instruments/gm-polyphony.d.ts +13 -0
  50. package/dist/domain/instruments/gm-polyphony.d.ts.map +1 -0
  51. package/dist/domain/instruments/gm-polyphony.js +76 -0
  52. package/dist/domain/instruments/gm-polyphony.js.map +1 -0
  53. package/dist/domain/instruments/gm-range.d.ts +15 -0
  54. package/dist/domain/instruments/gm-range.d.ts.map +1 -0
  55. package/dist/domain/instruments/gm-range.js +97 -0
  56. package/dist/domain/instruments/gm-range.js.map +1 -0
  57. package/dist/domain/instruments/gm-transposition.d.ts +11 -0
  58. package/dist/domain/instruments/gm-transposition.d.ts.map +1 -0
  59. package/dist/domain/instruments/gm-transposition.js +69 -0
  60. package/dist/domain/instruments/gm-transposition.js.map +1 -0
  61. package/dist/domain/instruments/gm.d.ts +28 -0
  62. package/dist/domain/instruments/gm.d.ts.map +1 -0
  63. package/dist/domain/instruments/gm.js +217 -0
  64. package/dist/domain/instruments/gm.js.map +1 -0
  65. package/dist/domain/pitch/pitch.d.ts +15 -0
  66. package/dist/domain/pitch/pitch.d.ts.map +1 -0
  67. package/dist/domain/pitch/pitch.js +81 -0
  68. package/dist/domain/pitch/pitch.js.map +1 -0
  69. package/dist/domain/pitch/transpose.d.ts +37 -0
  70. package/dist/domain/pitch/transpose.d.ts.map +1 -0
  71. package/dist/domain/pitch/transpose.js +65 -0
  72. package/dist/domain/pitch/transpose.js.map +1 -0
  73. package/dist/domain/quantization/options.d.ts +55 -0
  74. package/dist/domain/quantization/options.d.ts.map +1 -0
  75. package/dist/domain/quantization/options.js +2 -0
  76. package/dist/domain/quantization/options.js.map +1 -0
  77. package/dist/domain/quantization/quantize.d.ts +13 -0
  78. package/dist/domain/quantization/quantize.d.ts.map +1 -0
  79. package/dist/domain/quantization/quantize.js +199 -0
  80. package/dist/domain/quantization/quantize.js.map +1 -0
  81. package/dist/domain/score/factory.d.ts +39 -0
  82. package/dist/domain/score/factory.d.ts.map +1 -0
  83. package/dist/domain/score/factory.js +148 -0
  84. package/dist/domain/score/factory.js.map +1 -0
  85. package/dist/domain/score/fragment.d.ts +28 -0
  86. package/dist/domain/score/fragment.d.ts.map +1 -0
  87. package/dist/domain/score/fragment.js +68 -0
  88. package/dist/domain/score/fragment.js.map +1 -0
  89. package/dist/domain/score/ids.d.ts +8 -0
  90. package/dist/domain/score/ids.d.ts.map +1 -0
  91. package/dist/domain/score/ids.js +38 -0
  92. package/dist/domain/score/ids.js.map +1 -0
  93. package/dist/domain/score/queries.d.ts +34 -0
  94. package/dist/domain/score/queries.d.ts.map +1 -0
  95. package/dist/domain/score/queries.js +132 -0
  96. package/dist/domain/score/queries.js.map +1 -0
  97. package/dist/domain/score/ties.d.ts +73 -0
  98. package/dist/domain/score/ties.d.ts.map +1 -0
  99. package/dist/domain/score/ties.js +200 -0
  100. package/dist/domain/score/ties.js.map +1 -0
  101. package/dist/domain/selection/selection.d.ts +63 -0
  102. package/dist/domain/selection/selection.d.ts.map +1 -0
  103. package/dist/domain/selection/selection.js +129 -0
  104. package/dist/domain/selection/selection.js.map +1 -0
  105. package/dist/domain/selection/types.d.ts +10 -0
  106. package/dist/domain/selection/types.d.ts.map +1 -0
  107. package/dist/domain/selection/types.js +5 -0
  108. package/dist/domain/selection/types.js.map +1 -0
  109. package/dist/domain/time/durations.d.ts +21 -0
  110. package/dist/domain/time/durations.d.ts.map +1 -0
  111. package/dist/domain/time/durations.js +53 -0
  112. package/dist/domain/time/durations.js.map +1 -0
  113. package/dist/domain/time/fraction.d.ts +19 -0
  114. package/dist/domain/time/fraction.d.ts.map +1 -0
  115. package/dist/domain/time/fraction.js +60 -0
  116. package/dist/domain/time/fraction.js.map +1 -0
  117. package/dist/domain/time/tempo-map.d.ts +24 -0
  118. package/dist/domain/time/tempo-map.d.ts.map +1 -0
  119. package/dist/domain/time/tempo-map.js +85 -0
  120. package/dist/domain/time/tempo-map.js.map +1 -0
  121. package/dist/domain/time/ticks.d.ts +34 -0
  122. package/dist/domain/time/ticks.d.ts.map +1 -0
  123. package/dist/domain/time/ticks.js +93 -0
  124. package/dist/domain/time/ticks.js.map +1 -0
  125. package/dist/domain/validation/issues.d.ts +44 -0
  126. package/dist/domain/validation/issues.d.ts.map +1 -0
  127. package/dist/domain/validation/issues.js +34 -0
  128. package/dist/domain/validation/issues.js.map +1 -0
  129. package/dist/domain/validation/validator.d.ts +11 -0
  130. package/dist/domain/validation/validator.d.ts.map +1 -0
  131. package/dist/domain/validation/validator.js +375 -0
  132. package/dist/domain/validation/validator.js.map +1 -0
  133. package/dist/domain/voicing/allocate.d.ts +19 -0
  134. package/dist/domain/voicing/allocate.d.ts.map +1 -0
  135. package/dist/domain/voicing/allocate.js +100 -0
  136. package/dist/domain/voicing/allocate.js.map +1 -0
  137. package/dist/index.d.ts +46 -4
  138. package/dist/index.d.ts.map +1 -1
  139. package/dist/index.js +50 -2
  140. package/dist/index.js.map +1 -1
  141. package/dist/platform/audio.d.ts +12 -0
  142. package/dist/platform/audio.d.ts.map +1 -1
  143. package/dist/platform/playback.d.ts +85 -15
  144. package/dist/platform/playback.d.ts.map +1 -1
  145. package/dist/services/regeneration/controller.d.ts +60 -0
  146. package/dist/services/regeneration/controller.d.ts.map +1 -0
  147. package/dist/services/regeneration/controller.js +202 -0
  148. package/dist/services/regeneration/controller.js.map +1 -0
  149. package/dist/test/fixtures.d.ts +45 -0
  150. package/dist/test/fixtures.d.ts.map +1 -0
  151. package/dist/test/fixtures.js +420 -0
  152. package/dist/test/fixtures.js.map +1 -0
  153. package/package.json +2 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structure-commands.js","sourceRoot":"","sources":["../../../src/domain/commands/structure-commands.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,aAAa,EACb,WAAW,EACX,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAaxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAErE,mFAAmF;AAEnF,yFAAyF;AACzF,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,aAAa,CAAC,KAAY,EAAE,YAAoB;IACvD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACtC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,YAAY,CAAC,CAAC;QACtE,OAAO,QAAQ,CAAC,MAA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CAAC,CAAC,CAAC;AAEtE,wGAAwG;AACxG,SAAS,cAAc,CAAC,KAAsB;IAC5C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACxD,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,2HAA2H;AAC3H,MAAM,UAAU,uBAAuB,CACrC,OAAa,EACb,KAAsB,EACtB,KAAa;IAEb,OAAO,gBAAgB,CACrB,KAAK,EACL,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAChD,cAAc,CAAC,KAAK,CAAC,CACtB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { Track } from '../../index.js';
2
+ import type { ScoreCommand } from './types.js';
3
+ /**
4
+ * Appends `track` to the score, re-homed onto the score's own measure grid.
5
+ *
6
+ * For a generated track: the AI returns a whole `Score`, and only its single
7
+ * track is wanted. Its measures are matched to the existing grid by index
8
+ * rather than trusted, because a generated score can come back with a
9
+ * different bar count than was asked for, and a track whose measures do not
10
+ * line up with its neighbours is not editable.
11
+ *
12
+ * Ids are regenerated so a track appended twice cannot collide with itself.
13
+ */
14
+ export declare function appendTrackCommand(track: Track, label: string): ScoreCommand;
15
+ //# sourceMappingURL=track-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"track-commands.d.ts","sourceRoot":"","sources":["../../../src/domain/commands/track-commands.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAgC5E"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Appending a whole track to a score.
3
+ *
4
+ * What remains of a file that also wrote transcriptions in: audio transcription
5
+ * moved to `midi_transcriber_api` and arrives as MIDI, so the score is built by
6
+ * the MIDI importer rather than a note at a time. Generation still appends a
7
+ * single produced track, which is this.
8
+ */
9
+ import { touchMetadata, withTracks } from './reflow.js';
10
+ import { transformCommand } from './snapshot.js';
11
+ import { restMeasureLike } from './structure-commands.js';
12
+ import { createId } from '../score/ids.js';
13
+ /**
14
+ * Appends `track` to the score, re-homed onto the score's own measure grid.
15
+ *
16
+ * For a generated track: the AI returns a whole `Score`, and only its single
17
+ * track is wanted. Its measures are matched to the existing grid by index
18
+ * rather than trusted, because a generated score can come back with a
19
+ * different bar count than was asked for, and a track whose measures do not
20
+ * line up with its neighbours is not editable.
21
+ *
22
+ * Ids are regenerated so a track appended twice cannot collide with itself.
23
+ */
24
+ export function appendTrackCommand(track, label) {
25
+ return transformCommand(label, score => {
26
+ const reference = score.tracks[0];
27
+ if (!reference)
28
+ return score;
29
+ const id = createId();
30
+ const measures = reference.measures.map((template, index) => {
31
+ const source = track.measures[index];
32
+ const voices = (source?.voices ?? []).map(voice => {
33
+ const voiceId = createId();
34
+ return {
35
+ id: voiceId,
36
+ name: voice.name,
37
+ events: voice.events.map(event => ({
38
+ ...event,
39
+ id: createId(),
40
+ voiceId,
41
+ trackId: id,
42
+ })),
43
+ };
44
+ });
45
+ // An empty bar still needs a rest, which `restMeasureLike` supplies.
46
+ return voices.length > 0
47
+ ? { ...restMeasureLike(template, id), voices }
48
+ : restMeasureLike(template, id);
49
+ });
50
+ return {
51
+ ...withTracks(score, [...score.tracks, { ...track, id, measures }]),
52
+ metadata: touchMetadata(score.metadata),
53
+ };
54
+ });
55
+ }
56
+ //# sourceMappingURL=track-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"track-commands.js","sourceRoot":"","sources":["../../../src/domain/commands/track-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;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,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE;gBAC9C,CAAC,CAAC,eAAe,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;YACnE,QAAQ,EAAE,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC;SACxC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Command-based undo/redo (spec §14). A `ScoreCommand` is pure: `execute`
3
+ * and `undo` each take a `Score` and return a new `Score`, never mutating
4
+ * their input, holding a store reference, or performing I/O.
5
+ */
6
+ import type { Score } from '../../index.js';
7
+ /**
8
+ * Whether a command changes the music or only how it is mixed.
9
+ *
10
+ * The distinction exists for one reason: content is immutable while the
11
+ * transport is playing (see `store/slices/score-slice.ts`), and mixing is not
12
+ * editing — muting a part while listening is how an arrangement gets listened
13
+ * to. `services/playback/controller.ts` relies on it too: while playing, the
14
+ * only score change that can reach it is a mix change, which is what lets it
15
+ * push levels to the engine instead of reloading and resuming.
16
+ */
17
+ export type CommandKind = 'content' | 'mix';
18
+ export type ScoreCommand = {
19
+ id: string;
20
+ label: string;
21
+ timestamp: number;
22
+ /**
23
+ * Required rather than optional on purpose: a command written later without
24
+ * thinking about the playback lock should be refused while playing, not
25
+ * admitted by a convenient default.
26
+ */
27
+ kind: CommandKind;
28
+ execute(score: Score): Score;
29
+ undo(score: Score): Score;
30
+ };
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/domain/commands/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,KAAK,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC;IAC7B,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC;CAC3B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/domain/commands/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The General MIDI drum kits — what `Track.midiProgram` means on a percussion
3
+ * track.
4
+ *
5
+ * A drum track's program is not an instrument. General MIDI selects the kit
6
+ * with a program change on the drum channel, so on a percussion-clef track the
7
+ * same field that names a violin elsewhere names Room, TR-808 or Brush. Reading
8
+ * it through `gm.ts` gives an answer that is wrong in a way nothing catches:
9
+ * the picker offered "Acoustic Guitar (nylon)" for what the synth played as the
10
+ * Electronic kit, and every derived lookup — range, polyphony, transposition —
11
+ * answered for a guitar.
12
+ *
13
+ * The eight addresses below are the ones General MIDI defines. All eight are
14
+ * present and audibly distinct in the shipped soundfont, which is not an
15
+ * assumption: `general-midi.spec.ts` selects each one on a real synth and
16
+ * compares what comes out.
17
+ */
18
+ export type GmKit = {
19
+ /** The program number that selects this kit, matching `Track.midiProgram`. */
20
+ program: number;
21
+ /** The conventional name, e.g. "TR-808". */
22
+ name: string;
23
+ };
24
+ /**
25
+ * In address order.
26
+ *
27
+ * Note that Electronic and TR-808 are adjacent: 24 and 25, not 24 and 32. That
28
+ * irregularity is General MIDI's, and it is why kit regions cannot be derived
29
+ * arithmetically the way instrument families can.
30
+ */
31
+ export declare const GM_KITS: readonly GmKit[];
32
+ /** The kit at exactly `program`, or `null` where no kit is defined there. */
33
+ export declare function gmKit(program: number): GmKit | null;
34
+ /**
35
+ * The kit whose region contains `program` — always an answer.
36
+ *
37
+ * A kit occupies its address up to the next kit's, so program 45 is inside
38
+ * Brush's region and program 3 inside Standard's. That is how General MIDI
39
+ * hardware resolves an address it has no kit at, and it is what lets a MIDI
40
+ * file that sets an undefined program on channel 10 be read as something rather
41
+ * than refused. Anything below the first kit, or not a number at all, is
42
+ * Standard: the kit every font has.
43
+ */
44
+ export declare function gmKitAt(program: number): GmKit;
45
+ //# sourceMappingURL=gm-kit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gm-kit.d.ts","sourceRoot":"","sources":["../../../src/domain/instruments/gm-kit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,KAAK,GAAG;IAClB,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,SAAS,KAAK,EASnC,CAAC;AAEF,6EAA6E;AAC7E,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAEnD;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAO9C"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The General MIDI drum kits — what `Track.midiProgram` means on a percussion
3
+ * track.
4
+ *
5
+ * A drum track's program is not an instrument. General MIDI selects the kit
6
+ * with a program change on the drum channel, so on a percussion-clef track the
7
+ * same field that names a violin elsewhere names Room, TR-808 or Brush. Reading
8
+ * it through `gm.ts` gives an answer that is wrong in a way nothing catches:
9
+ * the picker offered "Acoustic Guitar (nylon)" for what the synth played as the
10
+ * Electronic kit, and every derived lookup — range, polyphony, transposition —
11
+ * answered for a guitar.
12
+ *
13
+ * The eight addresses below are the ones General MIDI defines. All eight are
14
+ * present and audibly distinct in the shipped soundfont, which is not an
15
+ * assumption: `general-midi.spec.ts` selects each one on a real synth and
16
+ * compares what comes out.
17
+ */
18
+ /**
19
+ * In address order.
20
+ *
21
+ * Note that Electronic and TR-808 are adjacent: 24 and 25, not 24 and 32. That
22
+ * irregularity is General MIDI's, and it is why kit regions cannot be derived
23
+ * arithmetically the way instrument families can.
24
+ */
25
+ export const GM_KITS = [
26
+ { program: 0, name: 'Standard Kit' },
27
+ { program: 8, name: 'Room Kit' },
28
+ { program: 16, name: 'Power Kit' },
29
+ { program: 24, name: 'Electronic Kit' },
30
+ { program: 25, name: 'TR-808 Kit' },
31
+ { program: 32, name: 'Jazz Kit' },
32
+ { program: 40, name: 'Brush Kit' },
33
+ { program: 48, name: 'Orchestra Kit' },
34
+ ];
35
+ /** The kit at exactly `program`, or `null` where no kit is defined there. */
36
+ export function gmKit(program) {
37
+ return GM_KITS.find(kit => kit.program === program) ?? null;
38
+ }
39
+ /**
40
+ * The kit whose region contains `program` — always an answer.
41
+ *
42
+ * A kit occupies its address up to the next kit's, so program 45 is inside
43
+ * Brush's region and program 3 inside Standard's. That is how General MIDI
44
+ * hardware resolves an address it has no kit at, and it is what lets a MIDI
45
+ * file that sets an undefined program on channel 10 be read as something rather
46
+ * than refused. Anything below the first kit, or not a number at all, is
47
+ * Standard: the kit every font has.
48
+ */
49
+ export function gmKitAt(program) {
50
+ if (!Number.isFinite(program))
51
+ return GM_KITS[0];
52
+ let found = GM_KITS[0];
53
+ for (const kit of GM_KITS) {
54
+ if (kit.program <= program)
55
+ found = kit;
56
+ }
57
+ return found;
58
+ }
59
+ //# sourceMappingURL=gm-kit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gm-kit.js","sourceRoot":"","sources":["../../../src/domain/instruments/gm-kit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAqB;IACvC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE;IACpC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE;IAChC,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAClC,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;IACvC,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;IACnC,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;IACjC,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAClC,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;CACvC,CAAC;AAEF,6EAA6E;AAC7E,MAAM,UAAU,KAAK,CAAC,OAAe;IACnC,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,KAAK,OAAO,CAAC,IAAI,IAAI,CAAC;AAC9D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO,CAAC,OAAe;IACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;IACjD,IAAI,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,IAAI,GAAG,CAAC,OAAO,IAAI,OAAO;YAAE,KAAK,GAAG,GAAG,CAAC;IAC1C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * What each General MIDI drum note is, by name.
3
+ *
4
+ * On a percussion track a note's pitch is not a pitch — it says which drum was
5
+ * struck. The staff already draws that (`adapters/vexflow/percussion.ts` maps
6
+ * the same 35-81 to noteheads and positions), but nothing could put it into
7
+ * words, so a drum key on the keyboard was labelled "C" and read aloud as "C3".
8
+ *
9
+ * Two names per drum, because two places need different lengths: `name` is the
10
+ * General MIDI name, which is what a screen reader and an inspector should say,
11
+ * and `short` is what fits on a key cap. The short form is not a truncation —
12
+ * "Closed Hi-Hat" shortens to "Cl HH", not to "Closed H" — so it is authored
13
+ * rather than derived.
14
+ *
15
+ * The note numbers are exactly the ones the notation mapping covers; a test
16
+ * pins the two to the same set, since a drum this table forgets would be drawn
17
+ * on the staff and then labelled with nothing.
18
+ */
19
+ export type GmPercussion = {
20
+ /** The MIDI note number that sounds this drum, 35-81. */
21
+ midi: number;
22
+ /** The General MIDI name, e.g. "Acoustic Snare". */
23
+ name: string;
24
+ /** A short form for a key cap, e.g. "Snare". */
25
+ short: string;
26
+ };
27
+ /** The range General MIDI assigns drums to. Every number in it sounds something. */
28
+ export declare const GM_PERCUSSION_RANGE: {
29
+ readonly min: 35;
30
+ readonly max: 81;
31
+ };
32
+ export declare const GM_PERCUSSION: readonly GmPercussion[];
33
+ /** The drum `midi` sounds, or `null` outside the General MIDI percussion range. */
34
+ export declare function gmPercussion(midi: number): GmPercussion | null;
35
+ /**
36
+ * What to call `midi` on a drum track.
37
+ *
38
+ * Falls back to the note number rather than to a pitch name: outside 35-81
39
+ * nothing is going to sound, and "C8" would suggest otherwise.
40
+ */
41
+ export declare function gmPercussionName(midi: number): string;
42
+ //# sourceMappingURL=gm-percussion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gm-percussion.d.ts","sourceRoot":"","sources":["../../../src/domain/instruments/gm-percussion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,MAAM,YAAY,GAAG;IACzB,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,mBAAmB;;;CAAgC,CAAC;AAsDjE,eAAO,MAAM,aAAa,EAAE,SAAS,YAAY,EAAU,CAAC;AAE5D,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * What each General MIDI drum note is, by name.
3
+ *
4
+ * On a percussion track a note's pitch is not a pitch — it says which drum was
5
+ * struck. The staff already draws that (`adapters/vexflow/percussion.ts` maps
6
+ * the same 35-81 to noteheads and positions), but nothing could put it into
7
+ * words, so a drum key on the keyboard was labelled "C" and read aloud as "C3".
8
+ *
9
+ * Two names per drum, because two places need different lengths: `name` is the
10
+ * General MIDI name, which is what a screen reader and an inspector should say,
11
+ * and `short` is what fits on a key cap. The short form is not a truncation —
12
+ * "Closed Hi-Hat" shortens to "Cl HH", not to "Closed H" — so it is authored
13
+ * rather than derived.
14
+ *
15
+ * The note numbers are exactly the ones the notation mapping covers; a test
16
+ * pins the two to the same set, since a drum this table forgets would be drawn
17
+ * on the staff and then labelled with nothing.
18
+ */
19
+ /** The range General MIDI assigns drums to. Every number in it sounds something. */
20
+ export const GM_PERCUSSION_RANGE = { min: 35, max: 81 };
21
+ const TABLE = [
22
+ { midi: 35, name: 'Acoustic Bass Drum', short: 'Kick' },
23
+ { midi: 36, name: 'Bass Drum 1', short: 'Kick 1' },
24
+ { midi: 37, name: 'Side Stick', short: 'Stick' },
25
+ { midi: 38, name: 'Acoustic Snare', short: 'Snare' },
26
+ { midi: 39, name: 'Hand Clap', short: 'Clap' },
27
+ { midi: 40, name: 'Electric Snare', short: 'El Snr' },
28
+ { midi: 41, name: 'Low Floor Tom', short: 'Flr Lo' },
29
+ { midi: 42, name: 'Closed Hi-Hat', short: 'Cl HH' },
30
+ { midi: 43, name: 'High Floor Tom', short: 'Flr Hi' },
31
+ { midi: 44, name: 'Pedal Hi-Hat', short: 'Pd HH' },
32
+ { midi: 45, name: 'Low Tom', short: 'Tom Lo' },
33
+ { midi: 46, name: 'Open Hi-Hat', short: 'Op HH' },
34
+ { midi: 47, name: 'Low-Mid Tom', short: 'Tom Md' },
35
+ { midi: 48, name: 'Hi-Mid Tom', short: 'Tom MHi' },
36
+ { midi: 49, name: 'Crash Cymbal 1', short: 'Crash' },
37
+ { midi: 50, name: 'High Tom', short: 'Tom Hi' },
38
+ { midi: 51, name: 'Ride Cymbal 1', short: 'Ride' },
39
+ { midi: 52, name: 'Chinese Cymbal', short: 'China' },
40
+ { midi: 53, name: 'Ride Bell', short: 'Bell' },
41
+ { midi: 54, name: 'Tambourine', short: 'Tamb' },
42
+ { midi: 55, name: 'Splash Cymbal', short: 'Splash' },
43
+ { midi: 56, name: 'Cowbell', short: 'Cowbell' },
44
+ { midi: 57, name: 'Crash Cymbal 2', short: 'Crash 2' },
45
+ { midi: 58, name: 'Vibraslap', short: 'Vibslap' },
46
+ { midi: 59, name: 'Ride Cymbal 2', short: 'Ride 2' },
47
+ { midi: 60, name: 'Hi Bongo', short: 'Bong Hi' },
48
+ { midi: 61, name: 'Low Bongo', short: 'Bong Lo' },
49
+ { midi: 62, name: 'Mute Hi Conga', short: 'Cong Mt' },
50
+ { midi: 63, name: 'Open Hi Conga', short: 'Cong Hi' },
51
+ { midi: 64, name: 'Low Conga', short: 'Cong Lo' },
52
+ { midi: 65, name: 'High Timbale', short: 'Timb Hi' },
53
+ { midi: 66, name: 'Low Timbale', short: 'Timb Lo' },
54
+ { midi: 67, name: 'High Agogo', short: 'Agog Hi' },
55
+ { midi: 68, name: 'Low Agogo', short: 'Agog Lo' },
56
+ { midi: 69, name: 'Cabasa', short: 'Cabasa' },
57
+ { midi: 70, name: 'Maracas', short: 'Maracas' },
58
+ { midi: 71, name: 'Short Whistle', short: 'Whis' },
59
+ { midi: 72, name: 'Long Whistle', short: 'Whis Lg' },
60
+ { midi: 73, name: 'Short Guiro', short: 'Guiro' },
61
+ { midi: 74, name: 'Long Guiro', short: 'Guiro L' },
62
+ { midi: 75, name: 'Claves', short: 'Claves' },
63
+ { midi: 76, name: 'Hi Wood Block', short: 'Wood Hi' },
64
+ { midi: 77, name: 'Low Wood Block', short: 'Wood Lo' },
65
+ { midi: 78, name: 'Mute Cuica', short: 'Cuic Mt' },
66
+ { midi: 79, name: 'Open Cuica', short: 'Cuica' },
67
+ { midi: 80, name: 'Mute Triangle', short: 'Tri Mt' },
68
+ { midi: 81, name: 'Open Triangle', short: 'Tri' },
69
+ ];
70
+ const BY_MIDI = new Map(TABLE.map(drum => [drum.midi, drum]));
71
+ export const GM_PERCUSSION = TABLE;
72
+ /** The drum `midi` sounds, or `null` outside the General MIDI percussion range. */
73
+ export function gmPercussion(midi) {
74
+ return BY_MIDI.get(midi) ?? null;
75
+ }
76
+ /**
77
+ * What to call `midi` on a drum track.
78
+ *
79
+ * Falls back to the note number rather than to a pitch name: outside 35-81
80
+ * nothing is going to sound, and "C8" would suggest otherwise.
81
+ */
82
+ export function gmPercussionName(midi) {
83
+ return gmPercussion(midi)?.name ?? `Note ${midi}`;
84
+ }
85
+ //# sourceMappingURL=gm-percussion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gm-percussion.js","sourceRoot":"","sources":["../../../src/domain/instruments/gm-percussion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAWH,oFAAoF;AACpF,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAW,CAAC;AAEjE,MAAM,KAAK,GAA4B;IACrC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,EAAE;IACvD,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,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AAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,EAAE;IACpD,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE;CAClD,CAAC;AAEF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAE9D,MAAM,CAAC,MAAM,aAAa,GAA4B,KAAK,CAAC;AAE5D,mFAAmF;AACnF,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AACnC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,QAAQ,IAAI,EAAE,CAAC;AACpD,CAAC"}
@@ -0,0 +1,13 @@
1
+ /** No physical limit: keyboards, plucked strings, sections, synths, drums. */
2
+ export declare const UNLIMITED_POLYPHONY: number;
3
+ /**
4
+ * The most notes `program` can sound simultaneously.
5
+ *
6
+ * Returns `UNLIMITED_POLYPHONY` for anything chordal, and for any program
7
+ * outside 0-127 — an unknown instrument gets the benefit of the doubt rather
8
+ * than having edits blocked against a guess.
9
+ */
10
+ export declare function gmMaxPolyphony(program: number): number;
11
+ /** Whether `program` can sound `count` notes at once. */
12
+ export declare function gmSupportsChord(program: number, count: number): boolean;
13
+ //# sourceMappingURL=gm-polyphony.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gm-polyphony.d.ts","sourceRoot":"","sources":["../../../src/domain/instruments/gm-polyphony.ts"],"names":[],"mappings":"AAgBA,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,QAA2B,CAAC;AA4C5D;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMtD;AAED,yDAAyD;AACzD,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAEvE"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * How many notes a General MIDI program can sound at once.
3
+ *
4
+ * General MIDI says nothing about this, so — like `gm-range.ts` — it is a
5
+ * curated table: a default per family, with overrides where the family default
6
+ * would be wrong. The numbers are physical facts about the instruments, not
7
+ * preferences: a trumpet player has one airstream, a guitar has six strings, a
8
+ * violinist can bow two strings at once (and briefly break three).
9
+ *
10
+ * This exists so the editor can refuse to write a chord nobody could play. It
11
+ * deliberately does NOT describe what a synthesizer patch can do — polyphony
12
+ * there is a setting, not a limit — so every synth family is unlimited.
13
+ */
14
+ import { gmFamilyOf, gmInstrument } from './gm.js';
15
+ /** No physical limit: keyboards, plucked strings, sections, synths, drums. */
16
+ export const UNLIMITED_POLYPHONY = Number.POSITIVE_INFINITY;
17
+ /**
18
+ * Family defaults.
19
+ *
20
+ * Wind and brass are 1 because one player has one airstream. Bowed strings are
21
+ * 2 for double stops. Everything else is unlimited — including the synth
22
+ * families, where polyphony is a patch setting rather than a property of the
23
+ * instrument, and blocking a chord there would be an invented restriction.
24
+ */
25
+ const FAMILY_POLYPHONY = {
26
+ piano: UNLIMITED_POLYPHONY,
27
+ 'chromatic-percussion': UNLIMITED_POLYPHONY,
28
+ organ: UNLIMITED_POLYPHONY,
29
+ guitar: 6,
30
+ bass: 4,
31
+ strings: 2,
32
+ ensemble: UNLIMITED_POLYPHONY,
33
+ brass: 1,
34
+ reed: 1,
35
+ pipe: 1,
36
+ 'synth-lead': UNLIMITED_POLYPHONY,
37
+ 'synth-pad': UNLIMITED_POLYPHONY,
38
+ 'synth-effects': UNLIMITED_POLYPHONY,
39
+ ethnic: UNLIMITED_POLYPHONY,
40
+ percussive: UNLIMITED_POLYPHONY,
41
+ 'sound-effects': UNLIMITED_POLYPHONY,
42
+ };
43
+ /** Programs whose own limit differs from their family's. */
44
+ const PROGRAM_POLYPHONY = {
45
+ // In the strings family but not bowed: both are chordal instruments.
46
+ 46: UNLIMITED_POLYPHONY, // Orchestral Harp
47
+ 47: UNLIMITED_POLYPHONY, // Timpani — a set of drums, not one
48
+ // Sections, not soloists, despite sitting in the brass family.
49
+ 61: UNLIMITED_POLYPHONY, // Brass Section
50
+ 62: UNLIMITED_POLYPHONY, // Synth Brass 1
51
+ 63: UNLIMITED_POLYPHONY, // Synth Brass 2
52
+ // Single-line players inside the otherwise-chordal ethnic family.
53
+ 109: 1, // Bagpipe
54
+ 110: 2, // Fiddle — bowed, so double stops
55
+ 111: 1, // Shanai
56
+ };
57
+ /**
58
+ * The most notes `program` can sound simultaneously.
59
+ *
60
+ * Returns `UNLIMITED_POLYPHONY` for anything chordal, and for any program
61
+ * outside 0-127 — an unknown instrument gets the benefit of the doubt rather
62
+ * than having edits blocked against a guess.
63
+ */
64
+ export function gmMaxPolyphony(program) {
65
+ const override = PROGRAM_POLYPHONY[program];
66
+ if (override !== undefined)
67
+ return override;
68
+ return gmInstrument(program)
69
+ ? FAMILY_POLYPHONY[gmFamilyOf(program)]
70
+ : UNLIMITED_POLYPHONY;
71
+ }
72
+ /** Whether `program` can sound `count` notes at once. */
73
+ export function gmSupportsChord(program, count) {
74
+ return count <= gmMaxPolyphony(program);
75
+ }
76
+ //# sourceMappingURL=gm-polyphony.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gm-polyphony.js","sourceRoot":"","sources":["../../../src/domain/instruments/gm-polyphony.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGnD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAE5D;;;;;;;GAOG;AACH,MAAM,gBAAgB,GAA6B;IACjD,KAAK,EAAE,mBAAmB;IA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AO,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,15 @@
1
+ /** Inclusive MIDI note numbers. */
2
+ export type MidiRange = {
3
+ min: number;
4
+ max: number;
5
+ };
6
+ /** A0 to C8 — the 88-key piano, and the widest range anything here returns. */
7
+ export declare const FULL_KEYBOARD: MidiRange;
8
+ /**
9
+ * The practical range for `program`: its own if it has one, else its family's.
10
+ *
11
+ * An out-of-range program has no family, so it falls back to the full keyboard
12
+ * rather than guessing.
13
+ */
14
+ export declare function gmInstrumentRange(program: number): MidiRange;
15
+ //# sourceMappingURL=gm-range.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gm-range.d.ts","sourceRoot":"","sources":["../../../src/domain/instruments/gm-range.ts"],"names":[],"mappings":"AAmBA,mCAAmC;AACnC,MAAM,MAAM,SAAS,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,+EAA+E;AAC/E,eAAO,MAAM,aAAa,EAAE,SAAiC,CAAC;AAmE9D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAM5D"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * A playable pitch range per General MIDI program.
3
+ *
4
+ * General MIDI defines names and programs but says nothing about compass, so
5
+ * this is a curated table: a default per family, with overrides for the
6
+ * instruments where the family default would be badly wrong. A piccolo and a
7
+ * tuba are both "wind", and showing either one an 88-key piano tells the player
8
+ * nothing about what will actually sound.
9
+ *
10
+ * The values are the conventional written-to-sounding ranges of the real
11
+ * instruments, expressed as MIDI note numbers (60 = middle C). They are
12
+ * intentionally the *practical* range rather than the extreme one — the point
13
+ * is to show a keyboard whose keys are worth pressing, not to police input.
14
+ * Nothing here restricts what can be written; it only decides which keys are
15
+ * worth showing.
16
+ */
17
+ import { gmFamilyOf, gmInstrument } from './gm.js';
18
+ /** A0 to C8 — the 88-key piano, and the widest range anything here returns. */
19
+ export const FULL_KEYBOARD = { min: 21, max: 108 };
20
+ /**
21
+ * Family defaults. Synth and effects families get a wide range on purpose:
22
+ * they have no acoustic compass to respect, so narrowing them would be a
23
+ * fiction.
24
+ */
25
+ const FAMILY_RANGE = {
26
+ piano: { min: 21, max: 108 },
27
+ 'chromatic-percussion': { min: 48, max: 96 },
28
+ organ: { min: 36, max: 96 },
29
+ guitar: { min: 40, max: 88 },
30
+ bass: { min: 28, max: 67 },
31
+ strings: { min: 36, max: 96 },
32
+ ensemble: { min: 36, max: 96 },
33
+ brass: { min: 34, max: 82 },
34
+ reed: { min: 44, max: 88 },
35
+ pipe: { min: 60, max: 98 },
36
+ 'synth-lead': { min: 24, max: 96 },
37
+ 'synth-pad': { min: 24, max: 96 },
38
+ 'synth-effects': { min: 24, max: 96 },
39
+ ethnic: { min: 40, max: 84 },
40
+ percussive: { min: 48, max: 84 },
41
+ 'sound-effects': { min: 21, max: 108 },
42
+ };
43
+ /** Instruments whose own compass differs enough from their family to matter. */
44
+ const PROGRAM_RANGE = {
45
+ 6: { min: 29, max: 89 }, // Harpsichord
46
+ 8: { min: 60, max: 108 }, // Celesta
47
+ 9: { min: 79, max: 108 }, // Glockenspiel
48
+ 11: { min: 53, max: 89 }, // Vibraphone
49
+ 12: { min: 36, max: 96 }, // Marimba
50
+ 13: { min: 65, max: 108 }, // Xylophone
51
+ 14: { min: 65, max: 89 }, // Tubular Bells
52
+ 19: { min: 24, max: 96 }, // Church Organ
53
+ 21: { min: 41, max: 81 }, // Accordion
54
+ 22: { min: 60, max: 96 }, // Harmonica
55
+ 40: { min: 55, max: 100 }, // Violin
56
+ 41: { min: 48, max: 88 }, // Viola
57
+ 42: { min: 36, max: 84 }, // Cello
58
+ 43: { min: 28, max: 67 }, // Contrabass
59
+ 46: { min: 24, max: 103 }, // Orchestral Harp
60
+ 47: { min: 38, max: 57 }, // Timpani
61
+ 52: { min: 48, max: 84 }, // Choir Aahs
62
+ 53: { min: 48, max: 84 }, // Voice Oohs
63
+ 56: { min: 52, max: 86 }, // Trumpet
64
+ 57: { min: 40, max: 77 }, // Trombone
65
+ 58: { min: 26, max: 65 }, // Tuba
66
+ 60: { min: 35, max: 77 }, // French Horn
67
+ 64: { min: 56, max: 88 }, // Soprano Sax
68
+ 65: { min: 49, max: 81 }, // Alto Sax
69
+ 66: { min: 44, max: 76 }, // Tenor Sax
70
+ 67: { min: 36, max: 69 }, // Baritone Sax
71
+ 68: { min: 58, max: 91 }, // Oboe
72
+ 69: { min: 52, max: 81 }, // English Horn
73
+ 70: { min: 34, max: 75 }, // Bassoon
74
+ 71: { min: 50, max: 94 }, // Clarinet
75
+ 72: { min: 74, max: 108 }, // Piccolo
76
+ 73: { min: 60, max: 98 }, // Flute
77
+ 74: { min: 65, max: 91 }, // Recorder
78
+ 105: { min: 48, max: 81 }, // Banjo
79
+ 106: { min: 48, max: 79 }, // Shamisen
80
+ 107: { min: 43, max: 84 }, // Koto
81
+ 108: { min: 53, max: 89 }, // Kalimba
82
+ };
83
+ /**
84
+ * The practical range for `program`: its own if it has one, else its family's.
85
+ *
86
+ * An out-of-range program has no family, so it falls back to the full keyboard
87
+ * rather than guessing.
88
+ */
89
+ export function gmInstrumentRange(program) {
90
+ const override = PROGRAM_RANGE[program];
91
+ if (override)
92
+ return override;
93
+ return gmInstrument(program)
94
+ ? FAMILY_RANGE[gmFamilyOf(program)]
95
+ : FULL_KEYBOARD;
96
+ }
97
+ //# sourceMappingURL=gm-range.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gm-range.js","sourceRoot":"","sources":["../../../src/domain/instruments/gm-range.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMnD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,aAAa,GAAc,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE9D;;;;GAIG;AACH,MAAM,YAAY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