@sudobility/music_types 0.11.7 → 0.11.8

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.
@@ -24,24 +24,57 @@ export interface AudioCodec {
24
24
  encodeWav(audio: DecodedAudio): ArrayBuffer;
25
25
  encodeMp3(audio: DecodedAudio): ArrayBuffer;
26
26
  }
27
- /** One note to sound in an offline render. */
27
+ /**
28
+ * One channel of an offline render — everything that decides how a track
29
+ * sounds, as distinct from when its notes fall.
30
+ *
31
+ * Carries `midiProgram` and `instrumentName` rather than a resolved voice: the
32
+ * renderer picks the voice, so it picks it by the same rule live playback does
33
+ * and the two cannot drift apart.
34
+ */
35
+ export type RenderTrack = {
36
+ id: string;
37
+ midiProgram: number;
38
+ instrumentName: string;
39
+ /** From the track's clef, matching how live playback decides. */
40
+ isPercussion: boolean;
41
+ /** 0..1 channel gain. */
42
+ volume: number;
43
+ /** -1..1. */
44
+ pan: number;
45
+ };
46
+ /** One note to sound in an offline render, on the channel named by `trackId`. */
28
47
  export type RenderEvent = {
48
+ trackId: string;
29
49
  midi: number;
30
50
  startSec: number;
31
51
  durationSec: number;
32
52
  /** 0..1, as the synth voices expect. */
33
53
  velocity: number;
34
- midiProgram: number;
35
- isPercussion: boolean;
54
+ };
55
+ /**
56
+ * Everything an offline render needs.
57
+ *
58
+ * `tracks` lists every track the score has, **including silent and muted
59
+ * ones**, because the renderer's mix headroom is sized by how many channels
60
+ * exist — exactly as live playback sizes it. Deriving that from the events
61
+ * alone would open a muted-heavy score by a couple of dB against what was
62
+ * heard.
63
+ */
64
+ export type RenderPlan = {
65
+ tracks: readonly RenderTrack[];
66
+ events: readonly RenderEvent[];
67
+ /** How long the rendered file must be, including the tail of the last note. */
68
+ durationSec: number;
36
69
  };
37
70
  /**
38
71
  * Offline audio rendering — the platform-bound half of audio export.
39
72
  *
40
- * Takes events somebody else decided on (`renderEvents` in music_lib works out
73
+ * Takes a plan somebody else decided on (`renderEvents` in music_lib works out
41
74
  * mute, solo and timing), so everything musical stays testable without an
42
75
  * audio context and only the scheduling lives behind this interface.
43
76
  */
44
77
  export interface AudioRenderer {
45
- render(events: readonly RenderEvent[], durationSec: number): Promise<DecodedAudio>;
78
+ render(plan: RenderPlan): Promise<DecodedAudio>;
46
79
  }
47
80
  //# sourceMappingURL=audio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../src/platform/audio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,YAAY,GAAG;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAClD,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,WAAW,CAAC;IAC5C,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,WAAW,CAAC;CAC7C;AAED,8CAA8C;AAC9C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACpF"}
1
+ {"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../src/platform/audio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,YAAY,GAAG;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAClD,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,WAAW,CAAC;IAC5C,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,WAAW,CAAC;CAC7C;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,YAAY,EAAE,OAAO,CAAC;IACtB,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa;IACb,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,iFAAiF;AACjF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;IAC/B,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;IAC/B,+EAA+E;IAC/E,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACjD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/music_types",
3
- "version": "0.11.7",
3
+ "version": "0.11.8",
4
4
  "description": "TypeScript types and Zod schemas for the ScoreSmith music API - scores, generation contracts, project payloads",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",