@typeonce/ritmo-tools 0.17.0 → 0.19.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.
Files changed (131) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +304 -24
  3. package/dist/cli.js +5 -1
  4. package/dist/cli.js.map +1 -1
  5. package/dist/internal/version.d.ts +1 -1
  6. package/dist/internal/version.js +1 -1
  7. package/dist/music/cli/commands.d.ts +15 -0
  8. package/dist/music/cli/commands.d.ts.map +1 -0
  9. package/dist/music/cli/commands.js +180 -0
  10. package/dist/music/cli/commands.js.map +1 -0
  11. package/dist/music/cli/io.d.ts +11 -0
  12. package/dist/music/cli/io.d.ts.map +1 -0
  13. package/dist/music/cli/io.js +28 -0
  14. package/dist/music/cli/io.js.map +1 -0
  15. package/dist/music/cli/serve.d.ts +13 -0
  16. package/dist/music/cli/serve.d.ts.map +1 -0
  17. package/dist/music/cli/serve.js +168 -0
  18. package/dist/music/cli/serve.js.map +1 -0
  19. package/dist/music/core/audio.d.ts +22 -0
  20. package/dist/music/core/audio.d.ts.map +1 -0
  21. package/dist/music/core/audio.js +95 -0
  22. package/dist/music/core/audio.js.map +1 -0
  23. package/dist/music/core/check.d.ts +51 -0
  24. package/dist/music/core/check.d.ts.map +1 -0
  25. package/dist/music/core/check.js +113 -0
  26. package/dist/music/core/check.js.map +1 -0
  27. package/dist/music/core/instruments.d.ts +179 -0
  28. package/dist/music/core/instruments.d.ts.map +1 -0
  29. package/dist/music/core/instruments.js +531 -0
  30. package/dist/music/core/instruments.js.map +1 -0
  31. package/dist/music/core/listen.d.ts +32 -0
  32. package/dist/music/core/listen.d.ts.map +1 -0
  33. package/dist/music/core/listen.js +350 -0
  34. package/dist/music/core/listen.js.map +1 -0
  35. package/dist/music/core/midi.d.ts +4 -0
  36. package/dist/music/core/midi.d.ts.map +1 -0
  37. package/dist/music/core/midi.js +76 -0
  38. package/dist/music/core/midi.js.map +1 -0
  39. package/dist/music/core/render.d.ts +37 -0
  40. package/dist/music/core/render.d.ts.map +1 -0
  41. package/dist/music/core/render.js +204 -0
  42. package/dist/music/core/render.js.map +1 -0
  43. package/dist/music/core/review.d.ts +41 -0
  44. package/dist/music/core/review.d.ts.map +1 -0
  45. package/dist/music/core/review.js +139 -0
  46. package/dist/music/core/review.js.map +1 -0
  47. package/dist/music/core/song.d.ts +144 -0
  48. package/dist/music/core/song.d.ts.map +1 -0
  49. package/dist/music/core/song.js +291 -0
  50. package/dist/music/core/song.js.map +1 -0
  51. package/dist/music/page/assets/index-BfO_jOqP.js +4 -0
  52. package/dist/music/page/assets/index-Dw14kxkL.css +1 -0
  53. package/dist/music/page/index.html +19 -0
  54. package/dist/pixel/cli/commands.d.ts.map +1 -1
  55. package/dist/pixel/cli/commands.js +122 -46
  56. package/dist/pixel/cli/commands.js.map +1 -1
  57. package/dist/pixel/cli/io.d.ts +5 -1
  58. package/dist/pixel/cli/io.d.ts.map +1 -1
  59. package/dist/pixel/cli/io.js +16 -1
  60. package/dist/pixel/cli/io.js.map +1 -1
  61. package/dist/pixel/core/animation.d.ts +23 -8
  62. package/dist/pixel/core/animation.d.ts.map +1 -1
  63. package/dist/pixel/core/animation.js +41 -18
  64. package/dist/pixel/core/animation.js.map +1 -1
  65. package/dist/pixel/core/grid.d.ts +3 -2
  66. package/dist/pixel/core/grid.d.ts.map +1 -1
  67. package/dist/pixel/core/grid.js +14 -6
  68. package/dist/pixel/core/grid.js.map +1 -1
  69. package/dist/pixel/core/preview.d.ts +8 -3
  70. package/dist/pixel/core/preview.d.ts.map +1 -1
  71. package/dist/pixel/core/preview.js +39 -25
  72. package/dist/pixel/core/preview.js.map +1 -1
  73. package/dist/pixel/core/project.d.ts +27 -0
  74. package/dist/pixel/core/project.d.ts.map +1 -0
  75. package/dist/pixel/core/project.js +117 -0
  76. package/dist/pixel/core/project.js.map +1 -0
  77. package/dist/pixel/core/recipe.d.ts.map +1 -1
  78. package/dist/pixel/core/recipe.js +43 -6
  79. package/dist/pixel/core/recipe.js.map +1 -1
  80. package/dist/pixel/core/report.d.ts +21 -3
  81. package/dist/pixel/core/report.d.ts.map +1 -1
  82. package/dist/pixel/core/report.js +52 -22
  83. package/dist/pixel/core/report.js.map +1 -1
  84. package/dist/pixel/core/sheet.d.ts +68 -8
  85. package/dist/pixel/core/sheet.d.ts.map +1 -1
  86. package/dist/pixel/core/sheet.js +250 -32
  87. package/dist/pixel/core/sheet.js.map +1 -1
  88. package/dist/pixel/core/spritesheet.d.ts +43 -35
  89. package/dist/pixel/core/spritesheet.d.ts.map +1 -1
  90. package/dist/pixel/core/spritesheet.js +63 -59
  91. package/dist/pixel/core/spritesheet.js.map +1 -1
  92. package/dist/sound/cli/commands.d.ts +25 -0
  93. package/dist/sound/cli/commands.d.ts.map +1 -0
  94. package/dist/sound/cli/commands.js +137 -0
  95. package/dist/sound/cli/commands.js.map +1 -0
  96. package/dist/sound/cli/io.d.ts +24 -0
  97. package/dist/sound/cli/io.d.ts.map +1 -0
  98. package/dist/sound/cli/io.js +51 -0
  99. package/dist/sound/cli/io.js.map +1 -0
  100. package/dist/sound/cli/serve.d.ts +11 -0
  101. package/dist/sound/cli/serve.d.ts.map +1 -0
  102. package/dist/sound/cli/serve.js +147 -0
  103. package/dist/sound/cli/serve.js.map +1 -0
  104. package/dist/sound/core/measure.d.ts +67 -0
  105. package/dist/sound/core/measure.d.ts.map +1 -0
  106. package/dist/sound/core/measure.js +138 -0
  107. package/dist/sound/core/measure.js.map +1 -0
  108. package/dist/sound/core/recipe.d.ts +143 -0
  109. package/dist/sound/core/recipe.d.ts.map +1 -0
  110. package/dist/sound/core/recipe.js +292 -0
  111. package/dist/sound/core/recipe.js.map +1 -0
  112. package/dist/sound/core/render.d.ts +37 -0
  113. package/dist/sound/core/render.d.ts.map +1 -0
  114. package/dist/sound/core/render.js +317 -0
  115. package/dist/sound/core/render.js.map +1 -0
  116. package/dist/sound/core/review.d.ts +52 -0
  117. package/dist/sound/core/review.d.ts.map +1 -0
  118. package/dist/sound/core/review.js +89 -0
  119. package/dist/sound/core/review.js.map +1 -0
  120. package/dist/sound/core/takes.d.ts +29 -0
  121. package/dist/sound/core/takes.d.ts.map +1 -0
  122. package/dist/sound/core/takes.js +109 -0
  123. package/dist/sound/core/takes.js.map +1 -0
  124. package/dist/sound/core/wav.d.ts +4 -0
  125. package/dist/sound/core/wav.d.ts.map +1 -0
  126. package/dist/sound/core/wav.js +28 -0
  127. package/dist/sound/core/wav.js.map +1 -0
  128. package/dist/sound/page/assets/index-Cjun5b92.js +6 -0
  129. package/dist/sound/page/assets/index-DZm59wkQ.css +1 -0
  130. package/dist/sound/page/index.html +19 -0
  131. package/package.json +10 -4
@@ -0,0 +1,51 @@
1
+ import { type NoteCache } from "./render.ts";
2
+ import { type Song } from "./song.ts";
3
+ export type Severity = "error" | "warning";
4
+ export interface Issue {
5
+ readonly rule: string;
6
+ readonly severity: Severity;
7
+ /** The track it is about, by name; none for the whole song. */
8
+ readonly track?: string | undefined;
9
+ readonly message: string;
10
+ }
11
+ export interface TrackReport {
12
+ readonly name: string;
13
+ readonly instrument: string;
14
+ readonly notes: number;
15
+ /** RMS in dBFS of the track alone, at its volume. */
16
+ readonly loudness: number;
17
+ readonly range: readonly [string, string] | undefined;
18
+ }
19
+ export interface Follow {
20
+ /** The track whose notes follow the reference most closely. */
21
+ readonly track: string;
22
+ /** Share of the reference's notes this track also plays at that moment (same note, any octave), 0 to 1. */
23
+ readonly share: number;
24
+ }
25
+ export type Verdict = "clean" | "warnings" | "errors";
26
+ export interface SongReport {
27
+ readonly verdict: Verdict;
28
+ readonly seconds: number;
29
+ readonly bars: number;
30
+ readonly tempo: number;
31
+ readonly key: string;
32
+ readonly peak: number;
33
+ readonly loudness: number;
34
+ readonly tracks: ReadonlyArray<TrackReport>;
35
+ readonly follows?: Follow | undefined;
36
+ readonly issues: ReadonlyArray<Issue>;
37
+ }
38
+ export declare const limits: {
39
+ /** Past full scale, samples are clipped (dBFS). */
40
+ readonly clipping: -0.1;
41
+ /** Game music this quiet gets lost under the sounds (RMS dBFS). */
42
+ readonly quiet: -30;
43
+ /** A track this much quieter than the loudest one is barely heard (dB). */
44
+ readonly buried: 18;
45
+ /** A melody following less than this share of the reference has wandered off it. */
46
+ readonly follows: 0.5;
47
+ };
48
+ /** How closely each melodic track follows the reference's notes; the closest one. */
49
+ export declare const followOf: (song: Song) => Follow | undefined;
50
+ export declare const checkSong: (song: Song, cache?: NoteCache) => SongReport;
51
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/music/core/check.ts"],"names":[],"mappings":"AASA,OAAO,EAAkC,KAAK,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5E,OAAO,EAA2E,KAAK,IAAI,EAAE,MAAM,WAAW,CAAA;AAE9G,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAA;AAE1C,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAC3B,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,qDAAqD;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAA;CACtD;AAED,MAAM,WAAW,MAAM;IACrB,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,2GAA2G;IAC3G,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAA;AAErD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,CAAA;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAA;CACtC;AAED,eAAO,MAAM,MAAM;IACjB,mDAAmD;aACnD,QAAQ,EAAE,CAAC,GAAG;IACd,mEAAmE;aACnE,KAAK,EAAE,CAAC,EAAE;IACV,2EAA2E;aAC3E,MAAM,EAAE,EAAE;IACV,oFAAoF;aACpF,OAAO,EAAE,GAAG;CACJ,CAAA;AAIV,qFAAqF;AACrF,eAAO,MAAM,QAAQ,SAAU,IAAI,KAAG,MAAM,GAAG,SAiB9C,CAAA;AAED,eAAO,MAAM,SAAS,SAAU,IAAI,UAAU,SAAS,KAAG,UAuDzD,CAAA"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Checking a song: what the agent can know about it without hearing it.
3
+ * It renders the song and measures it (length, peak, loudness, each track's
4
+ * loudness), and reads its notes for what usually sounds wrong: notes out of
5
+ * the key, notes an instrument cannot play well, a track drowned by the
6
+ * others, the same note struck twice at once. With a reference, it says how
7
+ * closely the song's melody follows it.
8
+ */
9
+ import { instruments } from "./instruments.js";
10
+ import { loudnessOf, peakOf, renderSong } from "./render.js";
11
+ import { barsOf, inKey, lengthInBeats, lengthInSeconds, midiOf, nameOf, parseKey } from "./song.js";
12
+ export const limits = {
13
+ /** Past full scale, samples are clipped (dBFS). */
14
+ clipping: -0.1,
15
+ /** Game music this quiet gets lost under the sounds (RMS dBFS). */
16
+ quiet: -30,
17
+ /** A track this much quieter than the loudest one is barely heard (dB). */
18
+ buried: 18,
19
+ /** A melody following less than this share of the reference has wandered off it. */
20
+ follows: 0.5
21
+ };
22
+ const round = (value) => Math.round(value * 10) / 10;
23
+ /** How closely each melodic track follows the reference's notes; the closest one. */
24
+ export const followOf = (song) => {
25
+ const reference = song.reference;
26
+ if (reference === undefined || reference.notes.length === 0)
27
+ return undefined;
28
+ let best;
29
+ for (const track of song.tracks) {
30
+ if (instruments[track.instrument].kind === "drums")
31
+ continue;
32
+ let matched = 0;
33
+ for (const heard of reference.notes) {
34
+ const pitch = midiOf(heard.pitch);
35
+ const at = heard.at + reference.offset + Math.min(heard.length, 0.25) / 2;
36
+ const hit = track.notes.some((note) => note.at <= at && at < note.at + note.length && (((midiOf(note.pitch) ?? -1) - (pitch ?? 0)) % 12 + 12) % 12 === 0);
37
+ if (hit)
38
+ matched++;
39
+ }
40
+ const share = Math.round((matched / reference.notes.length) * 100) / 100;
41
+ if (best === undefined || share > best.share)
42
+ best = { track: track.name, share };
43
+ }
44
+ return best;
45
+ };
46
+ export const checkSong = (song, cache) => {
47
+ const issues = [];
48
+ const key = parseKey(song.key);
49
+ const end = lengthInBeats(song);
50
+ const mix = renderSong(song, { cache });
51
+ const peak = peakOf(mix);
52
+ const loudness = loudnessOf(mix);
53
+ const tracks = song.tracks.map((track, index) => {
54
+ const instrument = instruments[track.instrument];
55
+ const melodic = instrument.kind === "melodic";
56
+ const midis = melodic ? track.notes.flatMap((note) => midiOf(note.pitch) ?? []) : [];
57
+ if (track.notes.length === 0)
58
+ issues.push({ rule: "empty-track", severity: "warning", track: track.name, message: "Has no notes." });
59
+ if (melodic && key !== undefined) {
60
+ const outside = track.notes.filter((note) => !inKey(key, midiOf(note.pitch) ?? 0));
61
+ if (outside.length > 0) {
62
+ const listed = outside.slice(0, 6).map((note) => `${note.pitch} (${barsOf(song, note.at, note.at + note.length)})`);
63
+ issues.push({ rule: "out-of-key", severity: "warning", track: track.name, message: `${outside.length} note${outside.length === 1 ? " is" : "s are"} outside ${song.key}: ${listed.join(", ")}${outside.length > 6 ? ", …" : ""}. Fine for a passing color; otherwise move ${outside.length === 1 ? "it" : "them"} to a note of the key.` });
64
+ }
65
+ }
66
+ if (melodic) {
67
+ const [low, high] = instrument.range;
68
+ const outOfRange = midis.filter((midi) => midi < low || midi > high);
69
+ if (outOfRange.length > 0)
70
+ issues.push({ rule: "range", severity: "warning", track: track.name, message: `${outOfRange.length} note${outOfRange.length === 1 ? "" : "s"} outside what the ${instrument.label.toLowerCase()} plays well (${nameOf(low)} to ${nameOf(high)}): ${[...new Set(outOfRange.map(nameOf))].slice(0, 6).join(", ")}.` });
71
+ }
72
+ const late = track.notes.filter((note) => note.at >= end);
73
+ if (late.length > 0)
74
+ issues.push({ rule: "past-the-end", severity: "warning", track: track.name, message: `${late.length} note${late.length === 1 ? " starts" : "s start"} after the song's last bar (${song.bars}) and ${late.length === 1 ? "is" : "are"} never heard. Add bars or move ${late.length === 1 ? "it" : "them"}.` });
75
+ // The same note struck again while it still sounds: two copies at once, or a note cut short.
76
+ let doubled = 0;
77
+ const sorted = [...track.notes].sort((a, b) => a.at - b.at);
78
+ for (let i = 0; i < sorted.length; i++) {
79
+ for (let j = i + 1; j < sorted.length && sorted[j].at < sorted[i].at + sorted[i].length - 1e-6; j++)
80
+ if (sorted[j].pitch === sorted[i].pitch)
81
+ doubled++;
82
+ }
83
+ if (doubled > 0)
84
+ issues.push({ rule: "overlap", severity: "warning", track: track.name, message: `${doubled} note${doubled === 1 ? " starts" : "s start"} while the same note is still held. Shorten the first, or remove one.` });
85
+ // Each track alone, uncompressed: the compressor would lift a buried track and hide it.
86
+ const alone = loudnessOf(renderSong({ ...song, compressor: false }, { tracks: [index], cache }));
87
+ return {
88
+ name: track.name,
89
+ instrument: track.instrument,
90
+ notes: track.notes.length,
91
+ loudness: alone,
92
+ range: midis.length === 0 ? undefined : [nameOf(Math.min(...midis)), nameOf(Math.max(...midis))]
93
+ };
94
+ });
95
+ if (song.tracks.every((track) => track.notes.length === 0))
96
+ issues.push({ rule: "silent", severity: "error", message: "No track has notes: the song is silent." });
97
+ else if (peak > limits.clipping)
98
+ issues.push({ rule: "clipping", severity: "error", message: `Peaks at +${round(Math.max(0, peak))} dBFS: it clips and distorts. Lower master by about ${Math.ceil(peak + 1)} dB (master × ${round(Math.pow(10, -(peak + 1) / 20))}).` });
99
+ else if (loudness < limits.quiet)
100
+ issues.push({ rule: "quiet", severity: "warning", message: `${loudness} dBFS overall: quiet for game music (about -18 to -24 sits well under sound effects). Raise master.` });
101
+ const heard = tracks.filter((track, i) => track.notes > 0 && song.tracks[i].mute !== true);
102
+ const loudest = Math.max(...heard.map((track) => track.loudness));
103
+ for (const track of heard) {
104
+ if (loudest - track.loudness > limits.buried)
105
+ issues.push({ rule: "buried", severity: "warning", track: track.name, message: `${round(loudest - track.loudness)} dB under the loudest track: barely heard. Raise its volume, or drop it.` });
106
+ }
107
+ const follows = followOf(song);
108
+ if (follows !== undefined && follows.share < limits.follows)
109
+ issues.push({ rule: "off-reference", severity: "warning", message: `The closest track (${follows.track}) plays ${Math.round(follows.share * 100)}% of the reference's notes: the melody has wandered from the hum. Keep its notes, or say why not.` });
110
+ const verdict = issues.some((issue) => issue.severity === "error") ? "errors" : issues.length > 0 ? "warnings" : "clean";
111
+ return { verdict, seconds: round(lengthInSeconds(song)), bars: song.bars, tempo: song.tempo, key: song.key, peak, loudness, tracks, follows, issues };
112
+ };
113
+ //# sourceMappingURL=check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/music/core/check.ts"],"names":[],"mappings":"AAAA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EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,0EAA0E,EAAE,CAAC,CAAA;IAC9O,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC9B,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO;QAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,sBAAsB,OAAO,CAAC,KAAK,WAAW,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,mGAAmG,EAAE,CAAC,CAAA;IACnT,MAAM,OAAO,GAAY,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAA;IACjI,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;AACvJ,CAAC,CAAA"}
@@ -0,0 +1,179 @@
1
+ /**
2
+ * The instruments a song can use: each one is synthesized from a small
3
+ * model of how the real instrument makes its sound (a plucked string for
4
+ * the guitar, struck strings for the piano, a breath and a tube for the
5
+ * flute), so they need no sample files and play the same bits everywhere.
6
+ *
7
+ * Each instrument turns one note (a pitch, how long it is held, how hard it
8
+ * is played) into mono samples; the renderer places, pans, and mixes them.
9
+ */
10
+ export type InstrumentKind = "melodic" | "drums";
11
+ export interface Instrument {
12
+ readonly label: string;
13
+ readonly kind: InstrumentKind;
14
+ /** What it sounds like and what it is good for, for the agent and the person. */
15
+ readonly about: string;
16
+ /** The lowest and highest notes it plays well, as MIDI numbers. */
17
+ readonly range: readonly [number, number];
18
+ /** The General MIDI program a MIDI export names for it (drums use channel 10). */
19
+ readonly program: number;
20
+ /** The page draws its notes in this color. */
21
+ readonly color: string;
22
+ }
23
+ export declare const instruments: {
24
+ readonly piano: {
25
+ readonly label: "Piano";
26
+ readonly kind: "melodic";
27
+ readonly about: "A grand piano: chords, melodies, bass. Warm and full; notes ring and fade.";
28
+ readonly range: readonly [21, 108];
29
+ readonly program: 0;
30
+ readonly color: "#7aa2f7";
31
+ };
32
+ readonly epiano: {
33
+ readonly label: "Electric piano";
34
+ readonly kind: "melodic";
35
+ readonly about: "A soft electric piano (Rhodes): mellow chords, lo-fi and cozy tunes.";
36
+ readonly range: readonly [28, 103];
37
+ readonly program: 4;
38
+ readonly color: "#9d8cf7";
39
+ };
40
+ readonly guitar: {
41
+ readonly label: "Acoustic guitar";
42
+ readonly kind: "melodic";
43
+ readonly about: "A plucked steel-string guitar: strummed chords, picked patterns (arpeggios), folk melodies.";
44
+ readonly range: readonly [40, 88];
45
+ readonly program: 25;
46
+ readonly color: "#f0a843";
47
+ };
48
+ readonly bass: {
49
+ readonly label: "Bass guitar";
50
+ readonly kind: "melodic";
51
+ readonly about: "A plucked electric bass: the low line under the chords, one note at a time.";
52
+ readonly range: readonly [28, 60];
53
+ readonly program: 33;
54
+ readonly color: "#e06c75";
55
+ };
56
+ readonly strings: {
57
+ readonly label: "Strings";
58
+ readonly kind: "melodic";
59
+ readonly about: "A string section: long held chords that swell in, sweeping melodies. Slow to start, so give it long notes.";
60
+ readonly range: readonly [28, 96];
61
+ readonly program: 48;
62
+ readonly color: "#56b6c2";
63
+ };
64
+ readonly flute: {
65
+ readonly label: "Flute";
66
+ readonly kind: "melodic";
67
+ readonly about: "A breathy wooden flute: gentle melodies, one note at a time, best in its middle and high notes.";
68
+ readonly range: readonly [60, 96];
69
+ readonly program: 73;
70
+ readonly color: "#98c379";
71
+ };
72
+ readonly marimba: {
73
+ readonly label: "Marimba";
74
+ readonly kind: "melodic";
75
+ readonly about: "Wooden bars struck by mallets: short bright notes, playful patterns.";
76
+ readonly range: readonly [45, 96];
77
+ readonly program: 12;
78
+ readonly color: "#d19a66";
79
+ };
80
+ readonly bells: {
81
+ readonly label: "Bells";
82
+ readonly kind: "melodic";
83
+ readonly about: "Glassy bells: sparkle, magic, a few long high notes over the rest.";
84
+ readonly range: readonly [60, 108];
85
+ readonly program: 9;
86
+ readonly color: "#e5c07b";
87
+ };
88
+ readonly pad: {
89
+ readonly label: "Warm pad";
90
+ readonly kind: "melodic";
91
+ readonly about: "A soft synth pad: a cushion of held chords behind everything; slow to swell.";
92
+ readonly range: readonly [36, 96];
93
+ readonly program: 89;
94
+ readonly color: "#c678dd";
95
+ };
96
+ readonly chipLead: {
97
+ readonly label: "Chip lead";
98
+ readonly kind: "melodic";
99
+ readonly about: "A retro game-console square wave: chiptune melodies, one note at a time.";
100
+ readonly range: readonly [48, 96];
101
+ readonly program: 80;
102
+ readonly color: "#4cc38a";
103
+ };
104
+ readonly chipBass: {
105
+ readonly label: "Chip bass";
106
+ readonly kind: "melodic";
107
+ readonly about: "A retro game-console triangle wave: chiptune bass lines.";
108
+ readonly range: readonly [28, 72];
109
+ readonly program: 38;
110
+ readonly color: "#2fb3a3";
111
+ };
112
+ readonly rockGuitar: {
113
+ readonly label: "Distorted guitar";
114
+ readonly kind: "melodic";
115
+ readonly about: "An electric guitar through an overdriven amp: rock riffs, power chords (a note and the one seven semitones up), crunchy rhythm parts.";
116
+ readonly range: readonly [40, 88];
117
+ readonly program: 30;
118
+ readonly color: "#ff7b54";
119
+ };
120
+ readonly reese: {
121
+ readonly label: "Reese bass";
122
+ readonly kind: "melodic";
123
+ readonly about: "Detuned saws, a sub, and grit, slowly moving: the drum & bass bass, also for dark electronic lines. One note at a time; hold notes long.";
124
+ readonly range: readonly [28, 60];
125
+ readonly program: 38;
126
+ readonly color: "#b4475a";
127
+ };
128
+ readonly synthLead: {
129
+ readonly label: "Synth lead";
130
+ readonly kind: "melodic";
131
+ readonly about: "A wide stack of detuned saws (a supersaw): modern electronic leads and riffs, bright and big. One note at a time.";
132
+ readonly range: readonly [48, 96];
133
+ readonly program: 81;
134
+ readonly color: "#3fb6f2";
135
+ };
136
+ readonly drums: {
137
+ readonly label: "Drum kit";
138
+ readonly kind: "drums";
139
+ readonly about: "A clean drum kit. Its notes are drums, not pitches: kick, snare, hat, openHat, clap, tomLow, tomHigh, crash, rim, shaker.";
140
+ readonly range: readonly [0, 127];
141
+ readonly program: 0;
142
+ readonly color: "#bdbab3";
143
+ };
144
+ readonly breaks: {
145
+ readonly label: "Punchy kit";
146
+ readonly kind: "drums";
147
+ readonly about: "A hard-hitting kit for rock, drum & bass, and electronic music: a clicky, driven kick, a cracking snare, crisp hats. The same drums as the drum kit.";
148
+ readonly range: readonly [0, 127];
149
+ readonly program: 0;
150
+ readonly color: "#e8e3d5";
151
+ };
152
+ };
153
+ export type InstrumentId = keyof typeof instruments;
154
+ export declare const instrumentIds: ReadonlyArray<InstrumentId>;
155
+ /** The instruments whose notes are drums. */
156
+ export type KitId = "drums" | "breaks";
157
+ export declare const isKit: (id: InstrumentId) => id is KitId;
158
+ export type DrumName = "kick" | "snare" | "hat" | "openHat" | "clap" | "tomLow" | "tomHigh" | "crash" | "rim" | "shaker";
159
+ /** The drums, top to bottom as the page lists them, with their General MIDI numbers. */
160
+ export declare const drums: ReadonlyArray<{
161
+ readonly name: DrumName;
162
+ readonly label: string;
163
+ readonly gm: number;
164
+ }>;
165
+ export declare const drumNames: ReadonlyArray<string>;
166
+ export declare const isDrum: (name: string) => name is DrumName;
167
+ export interface NoteInput {
168
+ readonly midi: number;
169
+ /** How long the note is held, in seconds. */
170
+ readonly held: number;
171
+ readonly velocity: number;
172
+ readonly rate: number;
173
+ readonly random: () => number;
174
+ }
175
+ /** One note of a melodic instrument (`midi` a MIDI number), as mono samples from the note's start. */
176
+ export declare const playVoice: (instrument: Exclude<InstrumentId, KitId>, midi: number, held: number, velocity: number, rate: number, random: () => number) => Float32Array;
177
+ /** One hit of a drum kit, as mono samples from the hit. */
178
+ export declare const playDrum: (kit: KitId, name: DrumName, velocity: number, rate: number, random: () => number) => Float32Array;
179
+ //# sourceMappingURL=instruments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instruments.d.ts","sourceRoot":"","sources":["../../../src/music/core/instruments.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,CAAA;AAEhD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,mEAAmE;IACnE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,kFAAkF;IAClF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,eAAO,MAAM,WAAW;;iBACb,KAAK,EAAE,OAAO;iBAAE,IAAI,EAAE,SAAS;iBAAE,KAAK,EAAE,4EAA4E;iBAAE,KAAK;iBAAa,OAAO,EAAE,CAAC;iBAAE,KAAK,EAAE,SAAS;;;iBACnK,KAAK,EAAE,gBAAgB;iBAAE,IAAI,EAAE,SAAS;iBAAE,KAAK,EAAE,sEAAsE;iBAAE,KAAK;iBAAa,OAAO,EAAE,CAAC;iBAAE,KAAK,EAAE,SAAS;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