rlo-engine 1.0.3

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 (154) hide show
  1. package/README.md +493 -0
  2. package/dist/AudioEffects.d.ts +16 -0
  3. package/dist/AudioEffects.d.ts.map +1 -0
  4. package/dist/AudioEffects.js +41 -0
  5. package/dist/AudioEffects.js.map +1 -0
  6. package/dist/Instruments/Analog/AnalogSynthBase.d.ts +22 -0
  7. package/dist/Instruments/Analog/AnalogSynthBase.d.ts.map +1 -0
  8. package/dist/Instruments/Analog/AnalogSynthBase.js +30 -0
  9. package/dist/Instruments/Analog/AnalogSynthBase.js.map +1 -0
  10. package/dist/Instruments/Analog/BassSynth.d.ts +14 -0
  11. package/dist/Instruments/Analog/BassSynth.d.ts.map +1 -0
  12. package/dist/Instruments/Analog/BassSynth.js +25 -0
  13. package/dist/Instruments/Analog/BassSynth.js.map +1 -0
  14. package/dist/Instruments/Analog/ChiptuneSynth.d.ts +14 -0
  15. package/dist/Instruments/Analog/ChiptuneSynth.d.ts.map +1 -0
  16. package/dist/Instruments/Analog/ChiptuneSynth.js +19 -0
  17. package/dist/Instruments/Analog/ChiptuneSynth.js.map +1 -0
  18. package/dist/Instruments/Analog/FMSynth.d.ts +15 -0
  19. package/dist/Instruments/Analog/FMSynth.d.ts.map +1 -0
  20. package/dist/Instruments/Analog/FMSynth.js +23 -0
  21. package/dist/Instruments/Analog/FMSynth.js.map +1 -0
  22. package/dist/Instruments/Analog/FormantSynth.d.ts +14 -0
  23. package/dist/Instruments/Analog/FormantSynth.d.ts.map +1 -0
  24. package/dist/Instruments/Analog/FormantSynth.js +26 -0
  25. package/dist/Instruments/Analog/FormantSynth.js.map +1 -0
  26. package/dist/Instruments/Analog/LeadSynth.d.ts +13 -0
  27. package/dist/Instruments/Analog/LeadSynth.d.ts.map +1 -0
  28. package/dist/Instruments/Analog/LeadSynth.js +21 -0
  29. package/dist/Instruments/Analog/LeadSynth.js.map +1 -0
  30. package/dist/Instruments/Analog/OrganSynth.d.ts +13 -0
  31. package/dist/Instruments/Analog/OrganSynth.d.ts.map +1 -0
  32. package/dist/Instruments/Analog/OrganSynth.js +24 -0
  33. package/dist/Instruments/Analog/OrganSynth.js.map +1 -0
  34. package/dist/Instruments/Analog/PadSynth.d.ts +14 -0
  35. package/dist/Instruments/Analog/PadSynth.d.ts.map +1 -0
  36. package/dist/Instruments/Analog/PadSynth.js +22 -0
  37. package/dist/Instruments/Analog/PadSynth.js.map +1 -0
  38. package/dist/Instruments/Analog/ReeseBassSynth.d.ts +14 -0
  39. package/dist/Instruments/Analog/ReeseBassSynth.d.ts.map +1 -0
  40. package/dist/Instruments/Analog/ReeseBassSynth.js +22 -0
  41. package/dist/Instruments/Analog/ReeseBassSynth.js.map +1 -0
  42. package/dist/Instruments/Analog/StringSynth.d.ts +13 -0
  43. package/dist/Instruments/Analog/StringSynth.d.ts.map +1 -0
  44. package/dist/Instruments/Analog/StringSynth.js +19 -0
  45. package/dist/Instruments/Analog/StringSynth.js.map +1 -0
  46. package/dist/Instruments/Analog/WoodwindSynth.d.ts +14 -0
  47. package/dist/Instruments/Analog/WoodwindSynth.d.ts.map +1 -0
  48. package/dist/Instruments/Analog/WoodwindSynth.js +35 -0
  49. package/dist/Instruments/Analog/WoodwindSynth.js.map +1 -0
  50. package/dist/Instruments/CoreSynthBase.d.ts +29 -0
  51. package/dist/Instruments/CoreSynthBase.d.ts.map +1 -0
  52. package/dist/Instruments/CoreSynthBase.js +91 -0
  53. package/dist/Instruments/CoreSynthBase.js.map +1 -0
  54. package/dist/Instruments/Decay/AdditiveSynth.d.ts +15 -0
  55. package/dist/Instruments/Decay/AdditiveSynth.d.ts.map +1 -0
  56. package/dist/Instruments/Decay/AdditiveSynth.js +24 -0
  57. package/dist/Instruments/Decay/AdditiveSynth.js.map +1 -0
  58. package/dist/Instruments/Decay/BrassSynth.d.ts +13 -0
  59. package/dist/Instruments/Decay/BrassSynth.d.ts.map +1 -0
  60. package/dist/Instruments/Decay/BrassSynth.js +29 -0
  61. package/dist/Instruments/Decay/BrassSynth.js.map +1 -0
  62. package/dist/Instruments/Decay/ChromaticPercussionSynth.d.ts +15 -0
  63. package/dist/Instruments/Decay/ChromaticPercussionSynth.d.ts.map +1 -0
  64. package/dist/Instruments/Decay/ChromaticPercussionSynth.js +23 -0
  65. package/dist/Instruments/Decay/ChromaticPercussionSynth.js.map +1 -0
  66. package/dist/Instruments/Decay/DecaySynthBase.d.ts +23 -0
  67. package/dist/Instruments/Decay/DecaySynthBase.d.ts.map +1 -0
  68. package/dist/Instruments/Decay/DecaySynthBase.js +35 -0
  69. package/dist/Instruments/Decay/DecaySynthBase.js.map +1 -0
  70. package/dist/Instruments/Decay/ElectricGuitarSynth.d.ts +15 -0
  71. package/dist/Instruments/Decay/ElectricGuitarSynth.d.ts.map +1 -0
  72. package/dist/Instruments/Decay/ElectricGuitarSynth.js +31 -0
  73. package/dist/Instruments/Decay/ElectricGuitarSynth.js.map +1 -0
  74. package/dist/Instruments/Decay/EthnicSynth.d.ts +15 -0
  75. package/dist/Instruments/Decay/EthnicSynth.d.ts.map +1 -0
  76. package/dist/Instruments/Decay/EthnicSynth.js +21 -0
  77. package/dist/Instruments/Decay/EthnicSynth.js.map +1 -0
  78. package/dist/Instruments/Decay/GuitarSynth.d.ts +14 -0
  79. package/dist/Instruments/Decay/GuitarSynth.d.ts.map +1 -0
  80. package/dist/Instruments/Decay/GuitarSynth.js +23 -0
  81. package/dist/Instruments/Decay/GuitarSynth.js.map +1 -0
  82. package/dist/Instruments/Decay/KarplusSynth.d.ts +10 -0
  83. package/dist/Instruments/Decay/KarplusSynth.d.ts.map +1 -0
  84. package/dist/Instruments/Decay/KarplusSynth.js +34 -0
  85. package/dist/Instruments/Decay/KarplusSynth.js.map +1 -0
  86. package/dist/Instruments/Decay/PianoSynth.d.ts +14 -0
  87. package/dist/Instruments/Decay/PianoSynth.d.ts.map +1 -0
  88. package/dist/Instruments/Decay/PianoSynth.js +32 -0
  89. package/dist/Instruments/Decay/PianoSynth.js.map +1 -0
  90. package/dist/Instruments/Decay/SlapBassSynth.d.ts +15 -0
  91. package/dist/Instruments/Decay/SlapBassSynth.d.ts.map +1 -0
  92. package/dist/Instruments/Decay/SlapBassSynth.js +28 -0
  93. package/dist/Instruments/Decay/SlapBassSynth.js.map +1 -0
  94. package/dist/Instruments/ISynthInstrument.d.ts +16 -0
  95. package/dist/Instruments/ISynthInstrument.d.ts.map +1 -0
  96. package/dist/Instruments/ISynthInstrument.js +2 -0
  97. package/dist/Instruments/ISynthInstrument.js.map +1 -0
  98. package/dist/Instruments/InstrumentFactory.d.ts +2 -0
  99. package/dist/Instruments/InstrumentFactory.d.ts.map +1 -0
  100. package/dist/Instruments/InstrumentFactory.js +4 -0
  101. package/dist/Instruments/InstrumentFactory.js.map +1 -0
  102. package/dist/Instruments/Speciality/DrumSynth.d.ts +11 -0
  103. package/dist/Instruments/Speciality/DrumSynth.d.ts.map +1 -0
  104. package/dist/Instruments/Speciality/DrumSynth.js +61 -0
  105. package/dist/Instruments/Speciality/DrumSynth.js.map +1 -0
  106. package/dist/Instruments/Speciality/SoundEffectsSynth.d.ts +12 -0
  107. package/dist/Instruments/Speciality/SoundEffectsSynth.d.ts.map +1 -0
  108. package/dist/Instruments/Speciality/SoundEffectsSynth.js +27 -0
  109. package/dist/Instruments/Speciality/SoundEffectsSynth.js.map +1 -0
  110. package/dist/Instruments/Synthesizer.d.ts +15 -0
  111. package/dist/Instruments/Synthesizer.d.ts.map +1 -0
  112. package/dist/Instruments/Synthesizer.js +27 -0
  113. package/dist/Instruments/Synthesizer.js.map +1 -0
  114. package/dist/RLO-Player.d.ts +298 -0
  115. package/dist/RLO-Player.d.ts.map +1 -0
  116. package/dist/RLO-Player.js +724 -0
  117. package/dist/RLO-Player.js.map +1 -0
  118. package/dist/RLO-Transpiler.d.ts +22 -0
  119. package/dist/RLO-Transpiler.d.ts.map +1 -0
  120. package/dist/RLO-Transpiler.js +133 -0
  121. package/dist/RLO-Transpiler.js.map +1 -0
  122. package/dist/compiler.d.ts +40 -0
  123. package/dist/compiler.d.ts.map +1 -0
  124. package/dist/compiler.js +268 -0
  125. package/dist/compiler.js.map +1 -0
  126. package/dist/crush.d.ts +9 -0
  127. package/dist/crush.d.ts.map +1 -0
  128. package/dist/crush.js +20 -0
  129. package/dist/crush.js.map +1 -0
  130. package/dist/index.d.ts +36 -0
  131. package/dist/index.d.ts.map +1 -0
  132. package/dist/index.js +59 -0
  133. package/dist/index.js.map +1 -0
  134. package/dist/midi-parser.d.ts +10 -0
  135. package/dist/midi-parser.d.ts.map +1 -0
  136. package/dist/midi-parser.js +130 -0
  137. package/dist/midi-parser.js.map +1 -0
  138. package/dist/rlo-engine.min.js +655 -0
  139. package/dist/rlo-engine.min.js.map +1 -0
  140. package/dist/rlo-engine.min.umd.js +2 -0
  141. package/dist/rlo-engine.min.umd.js.map +1 -0
  142. package/dist/types.d.ts +16 -0
  143. package/dist/types.d.ts.map +1 -0
  144. package/dist/types.js +7 -0
  145. package/dist/types.js.map +1 -0
  146. package/dist/vite.config.d.ts +7 -0
  147. package/dist/vite.config.d.ts.map +1 -0
  148. package/dist/vite.config.js +244 -0
  149. package/dist/vite.config.js.map +1 -0
  150. package/dist/vite.config.js13k.d.ts +7 -0
  151. package/dist/vite.config.js13k.d.ts.map +1 -0
  152. package/dist/vite.config.js13k.js +72 -0
  153. package/dist/vite.config.js13k.js.map +1 -0
  154. package/package.json +50 -0
@@ -0,0 +1,11 @@
1
+ import { CoreSynthBase } from "../CoreSynthBase.js";
2
+ /**
3
+ * Synthesizer strategy for Percussion and Drum kits.
4
+ */
5
+ export declare class DrumSynth extends CoreSynthBase {
6
+ /** Cached white noise buffer to prevent massive memory allocations and GC spikes. */
7
+ private static _cachedNoiseBuffer;
8
+ private static _getNoiseBuffer;
9
+ _playNote(ctx: AudioContext, masterGain: GainNode, time: number, freq: number, duration: number, velocity: number): void;
10
+ }
11
+ //# sourceMappingURL=DrumSynth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DrumSynth.d.ts","sourceRoot":"","sources":["../../../Instruments/Speciality/DrumSynth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAe,MAAM,qBAAqB,CAAC;AAEjE;;GAEG;AACH,qBAAa,SAAU,SAAQ,aAAa;IAC1C,qFAAqF;IACrF,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAA4B;IAE7D,OAAO,CAAC,MAAM,CAAC,eAAe;IAcvB,SAAS,CACd,GAAG,EAAE,YAAY,EACjB,UAAU,EAAE,QAAQ,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,IAAI;CA0DR"}
@@ -0,0 +1,61 @@
1
+ import { CoreSynthBase } from "../CoreSynthBase.js";
2
+ /**
3
+ * Synthesizer strategy for Percussion and Drum kits.
4
+ */
5
+ export class DrumSynth extends CoreSynthBase {
6
+ /** Cached white noise buffer to prevent massive memory allocations and GC spikes. */
7
+ static { this._cachedNoiseBuffer = null; }
8
+ static _getNoiseBuffer(ctx) {
9
+ if (!DrumSynth._cachedNoiseBuffer ||
10
+ DrumSynth._cachedNoiseBuffer.sampleRate !== ctx.sampleRate) {
11
+ const bufferSize = ctx.sampleRate * 1.0;
12
+ const buffer = ctx.createBuffer(1, bufferSize, ctx.sampleRate);
13
+ const data = buffer.getChannelData(0);
14
+ for (let i = 0; i < bufferSize; i++)
15
+ data[i] = Math.random() * 2 - 1;
16
+ DrumSynth._cachedNoiseBuffer = buffer;
17
+ }
18
+ return DrumSynth._cachedNoiseBuffer;
19
+ }
20
+ _playNote(ctx, masterGain, time, freq, duration, velocity) {
21
+ /** Standard MIDI maps specific frequencies to specific drum kit pieces */
22
+ if (freq < 70) {
23
+ const gain = this._gain(ctx, 0, masterGain);
24
+ const osc = this._osc(ctx, 0 /* Osc.Sine */, 0, gain);
25
+ this._set(osc.frequency, 150, time);
26
+ this._exp(osc.frequency, 30, time + 0.1);
27
+ this._set(gain.gain, Math.max(0.001, velocity * 1.5), time);
28
+ this._exp(gain.gain, 0.001, time + 0.5);
29
+ this._on(time, time + 0.5, osc);
30
+ this._gc(ctx, time, time + 0.6, gain);
31
+ }
32
+ else {
33
+ /** HI-HAT / SNARE (White Noise generation) */
34
+ const isSnare = freq < 90;
35
+ const noise = ctx.createBufferSource();
36
+ noise.buffer = DrumSynth._getNoiseBuffer(ctx);
37
+ const gain = this._gain(ctx, 0, masterGain);
38
+ const filter = this._filter(ctx, isSnare ? 2 /* Filter.Bandpass */ : 1 /* Filter.Highpass */);
39
+ const panner = this._pan(ctx, isSnare ? 0 : Math.random() * 0.6 - 0.3);
40
+ filter.frequency.value = isSnare ? 1500 : 5000;
41
+ this._set(gain.gain, Math.max(0.001, velocity), time);
42
+ this._exp(gain.gain, 0.001, time + (isSnare ? 0.2 : 0.05));
43
+ noise.connect(filter).connect(gain).connect(panner);
44
+ this._on(time, time + (isSnare ? 0.2 : 0.05), noise);
45
+ /** Add an extra body thwack tone if it is a snare */
46
+ if (isSnare) {
47
+ const snareOsc = this._osc(ctx, 3 /* Osc.Triangle */, 0, gain);
48
+ /** Snare drum head tension: quick pitch drop when the stick hits the skin */
49
+ this._set(snareOsc.frequency, 300, time);
50
+ this._exp(snareOsc.frequency, 100, time + 0.1);
51
+ this._on(time, time + 0.2, snareOsc);
52
+ }
53
+ else {
54
+ /** 808 Cymbal Metallic Ring: TR-808 hi-hats contain high-pitched ringing square waves */
55
+ this._transient(ctx, 1 /* Osc.Square */, 7000, panner, time, Math.max(0.001, velocity * 0.2), 0.05);
56
+ }
57
+ this._gc(ctx, time, time + 0.4, filter, gain, panner);
58
+ }
59
+ }
60
+ }
61
+ //# sourceMappingURL=DrumSynth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DrumSynth.js","sourceRoot":"","sources":["../../../Instruments/Speciality/DrumSynth.ts"],"names":[],"mappings":"AAAA,O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AAI,EAAE,MAAM,CAAC,CAAC;QACxD,CAAC;IACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { CoreSynthBase } from "../CoreSynthBase.js";
2
+ /**
3
+ * Synthesizer strategy for Sound Effects and Sci-Fi Synths.
4
+ * Features extreme frequency sweeping over the duration of the note.
5
+ */
6
+ export declare class SoundEffectsSynth extends CoreSynthBase {
7
+ /**
8
+ * Plays an automated sweeping sci-fi sound effect.
9
+ */
10
+ _playNote(ctx: AudioContext, masterGain: GainNode, time: number, freq: number, duration: number, velocity: number): void;
11
+ }
12
+ //# sourceMappingURL=SoundEffectsSynth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SoundEffectsSynth.d.ts","sourceRoot":"","sources":["../../../Instruments/Speciality/SoundEffectsSynth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAO,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,aAAa;IAClD;;OAEG;IACI,SAAS,CACd,GAAG,EAAE,YAAY,EACjB,UAAU,EAAE,QAAQ,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,IAAI;CA0BR"}
@@ -0,0 +1,27 @@
1
+ import { CoreSynthBase } from "../CoreSynthBase.js";
2
+ /**
3
+ * Synthesizer strategy for Sound Effects and Sci-Fi Synths.
4
+ * Features extreme frequency sweeping over the duration of the note.
5
+ */
6
+ export class SoundEffectsSynth extends CoreSynthBase {
7
+ /**
8
+ * Plays an automated sweeping sci-fi sound effect.
9
+ */
10
+ _playNote(ctx, masterGain, time, freq, duration, velocity) {
11
+ const gain = this._gain(ctx, 0);
12
+ const osc = this._osc(ctx, 2 /* Osc.Sawtooth */, 0, gain);
13
+ /** Extreme pitch dive from fundamental down one full octave over the note's duration */
14
+ this._set(osc.frequency, freq, time);
15
+ this._exp(osc.frequency, Math.max(1, freq / 2), time + Math.max(0.05, duration));
16
+ /** Sci-Fi "Laser Wobble": fast sine-wave amplitude modulation (avoids scratchy clicking of square wave) */
17
+ const stutterNode = this._gain(ctx, 0.5, masterGain);
18
+ this._lfo(ctx, 15, 0.5, time, 0, time + duration + 0.2, stutterNode.gain);
19
+ gain.connect(stutterNode);
20
+ this._set(gain.gain, 0, time);
21
+ this._lin(gain.gain, Math.max(0.001, velocity * 0.5), time + 0.05);
22
+ this._exp(gain.gain, 0.001, time + duration + 0.2);
23
+ this._on(time, time + duration + 0.2, osc);
24
+ this._gc(ctx, time, time + duration + 0.3, gain, stutterNode);
25
+ }
26
+ }
27
+ //# sourceMappingURL=SoundEffectsSynth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SoundEffectsSynth.js","sourceRoot":"","sources":["../../../Instruments/Speciality/SoundEffectsSynth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAO,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAClD;;OAEG;IACI,SAAS,CACd,GAAiB,EACjB,UAAoB,EACpB,IAAY,EACZ,IAAY,EACZ,QAAgB,EAChB,QAAgB;QAEhB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAChC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,wBAAgB,CAAC,EAAE,IAAI,CAAC,CAAC;QAElD,wFAAwF;QACxF,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,CACP,GAAG,CAAC,SAAS,EACb,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,EACrB,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAChC,CAAC;QAEF,2GAA2G;QAC3G,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,GAAG,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QAE1E,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,QAAQ,GAAG,GAAG,CAAC,CAAC;QAEnD,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,QAAQ,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;QAE3C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,GAAG,QAAQ,GAAG,GAAG,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAChE,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import { ISynthInstrument } from "./ISynthInstrument.js";
2
+ /**
3
+ * Handles routing and synthesis of different instrument types.
4
+ */
5
+ export declare class Synthesizer {
6
+ private _ctx;
7
+ private _masterGain;
8
+ private _instruments;
9
+ constructor(ctx: AudioContext, masterGain: GainNode, instruments: ISynthInstrument[]);
10
+ /**
11
+ * Routes the note to the correct instrument synthesis method.
12
+ */
13
+ _playNote(instrumentId: number, time: number, freq: number, duration: number, velocity: number): void;
14
+ }
15
+ //# sourceMappingURL=Synthesizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Synthesizer.d.ts","sourceRoot":"","sources":["../../Instruments/Synthesizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,WAAW,CAAW;IAC9B,OAAO,CAAC,YAAY,CAAqB;gBAGvC,GAAG,EAAE,YAAY,EACjB,UAAU,EAAE,QAAQ,EACpB,WAAW,EAAE,gBAAgB,EAAE;IAOjC;;OAEG;IACI,SAAS,CACd,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,IAAI;CAyBR"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Handles routing and synthesis of different instrument types.
3
+ */
4
+ export class Synthesizer {
5
+ constructor(ctx, masterGain, instruments) {
6
+ this._ctx = ctx;
7
+ this._masterGain = masterGain;
8
+ this._instruments = instruments;
9
+ }
10
+ /**
11
+ * Routes the note to the correct instrument synthesis method.
12
+ */
13
+ _playNote(instrumentId, time, freq, duration, velocity) {
14
+ /** Key Tracking: High frequency waveforms carry significantly more perceived energy.
15
+ * Gently rolling off the velocity of high notes prevents them from piercing the mix and distorting.
16
+ * We also apply a 0.6 global headroom multiplier to prevent 30+ note crescendos from clipping. */
17
+ const keyTrackVel = velocity * 0.6 * Math.min(1, 1600 / freq);
18
+ const instrument = this._instruments[instrumentId] || this._instruments[0];
19
+ if (globalThis.DEBUG_MIDI) {
20
+ console.log(`[MIDI Debug] Instr ID: ${instrumentId} | Class: ${instrument?.constructor.name || "Unknown"} | Freq: ${freq.toFixed(2)}Hz | Vel: ${velocity.toFixed(2)} | Dur: ${duration.toFixed(2)}s | Time: ${time.toFixed(2)}s`);
21
+ }
22
+ if (instrument) {
23
+ instrument._playNote(this._ctx, this._masterGain, time, freq, duration, keyTrackVel);
24
+ }
25
+ }
26
+ }
27
+ //# sourceMappingURL=Synthesizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Synthesizer.js","sourceRoot":"","sources":["../../Instruments/Synthesizer.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,WAAW;IAKtB,YACE,GAAiB,EACjB,UAAoB,EACpB,WAA+B;QAE/B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,SAAS,CACd,YAAoB,EACpB,IAAY,EACZ,IAAY,EACZ,QAAgB,EAChB,QAAgB;QAEhB;;0GAEkG;QAClG,MAAM,WAAW,GAAG,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC;QAE9D,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAE3E,IAAK,UAAkB,CAAC,UAAU,EAAE,CAAC;YACnC,OAAO,CAAC,GAAG,CACT,0BAA0B,YAAY,aAAa,UAAU,EAAE,WAAW,CAAC,IAAI,IAAI,SAAS,YAAY,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CACrN,CAAC;QACJ,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACf,UAAU,CAAC,SAAS,CAClB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,WAAW,EAChB,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,WAAW,CACZ,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,298 @@
1
+ import { RloData } from "./types.js";
2
+ import { ReverbMode } from "./AudioEffects.js";
3
+ import { RLOTranspiler } from "./RLO-Transpiler.js";
4
+ import { ISynthInstrument } from "./Instruments/ISynthInstrument.js";
5
+ export { RLOTranspiler };
6
+ export type { ISynthInstrument };
7
+ /**
8
+ * A dummy synthesizer that does absolutely nothing.
9
+ * Useful for completely muting specific MIDI IDs in an instrument map.
10
+ */
11
+ export declare const SilentSynth: ISynthInstrument;
12
+ /** Configuration options for playing sequences/music. */
13
+ export interface PlaySequenceOptions {
14
+ loop?: boolean;
15
+ fadeInTime?: number;
16
+ playbackRate?: number;
17
+ volume?: number;
18
+ }
19
+ /** Configuration options for playing single Sound Effects. */
20
+ export interface SFXOptions {
21
+ velocity?: number;
22
+ timeOffset?: number;
23
+ }
24
+ /** Configuration for a standard ADSR volume envelope. */
25
+ export interface ADSREnvelope {
26
+ attack?: number;
27
+ decay?: number;
28
+ sustain?: number;
29
+ release?: number;
30
+ peak?: number;
31
+ }
32
+ /**
33
+ * Syntactic sugar for applying a standard ADSR envelope to a Web Audio GainNode.
34
+ * @param gainParam The AudioParam (e.g., gainNode.gain) to animate.
35
+ * @param now The physical start time of the sound.
36
+ * @param duration The total held duration of the note.
37
+ * @param opts ADSR configuration object.
38
+ */
39
+ export declare function applyEnvelope(gainParam: AudioParam, now: number, duration: number, opts: ADSREnvelope): void;
40
+ /**
41
+ * Converts a musical note string (e.g., 'C4', 'F#5') to its frequency in Hz.
42
+ * If a number is provided, it is returned as-is.
43
+ */
44
+ export declare function Note(pitch: string | number): number;
45
+ /** A fluent, chainable builder for creating RloData sequences procedurally. */
46
+ export declare class RLOSequenceBuilder {
47
+ private _notes;
48
+ private _duration;
49
+ addNote(opts: {
50
+ instrument: number;
51
+ pitch: string | number;
52
+ duration: number;
53
+ time?: number;
54
+ velocity?: number;
55
+ }): this;
56
+ setDuration(secs: number): this;
57
+ compile(): RloData;
58
+ }
59
+ /**
60
+ * A "dumb" mapping mechanism for strict JS13K size-coding.
61
+ * Bypasses the closest-match algorithm and explicitly assigns synths to individual IDs.
62
+ * @param assignments An array of synthesizer modules and the exact MIDI IDs they should respond to.
63
+ * @returns A fully populated array of 129 elements, with unassigned slots remaining null.
64
+ */
65
+ export declare function createDirectMap(assignments: {
66
+ synth: ISynthInstrument;
67
+ ids: number[];
68
+ }[]): ISynthInstrument[];
69
+ /**
70
+ * Mathematically maps instruments by MIDI ID, auto-falling back to the closest available synthesizer.
71
+ * @param modules An array of synthesizer module configurations to map.
72
+ * @returns A fully populated array of 129 synthesizer instruments.
73
+ */
74
+ export declare function createInstrumentMap(modules: {
75
+ synth: ISynthInstrument;
76
+ start: number;
77
+ end: number;
78
+ }[]): ISynthInstrument[];
79
+ /**
80
+ * Creates a new instrument map by merging custom synth overrides into an existing base map.
81
+ * @param baseMap The base instrument map array.
82
+ * @param overrides An array of synthesizer module configurations to override in the base map.
83
+ * @returns A new array of synthesizer instruments with the overrides applied.
84
+ */
85
+ export declare function extendInstrumentMap(baseMap: ISynthInstrument[], overrides: {
86
+ synth: ISynthInstrument;
87
+ start: number;
88
+ end: number;
89
+ }[]): ISynthInstrument[];
90
+ /**
91
+ * RLOCore: The bare-metal procedural sequencer.
92
+ * Zero networking, zero master effects. Just pure math to audio waves.
93
+ */
94
+ export declare class RLOCore {
95
+ /** The Web Audio API context used for all audio operations. */
96
+ protected _ctx: AudioContext;
97
+ /** Indicates whether a sequence is currently playing. */
98
+ protected _isPlaying: boolean;
99
+ /** Stores the timer ID for the standard JavaScript timeout metronome. */
100
+ protected _timer: ReturnType<typeof setTimeout> | null;
101
+ /** Stores the Web Worker instance for accurate background metronome timing. */
102
+ protected _workerTimer: Worker | null;
103
+ /** Incremental ID to keep track of the current playback sequence and prevent overlapping schedules. */
104
+ protected _sequenceId: number;
105
+ /** The current track playback time in seconds. */
106
+ protected _trkT: number;
107
+ /** The total duration of the currently playing track in seconds. */
108
+ protected _trkD: number;
109
+ /** Array of active audio nodes that need to be cleaned up when playback stops. */
110
+ protected _activeNodes: AudioNode[];
111
+ /** The current global volume level (0.0 to 1.0). */
112
+ protected _volume: number;
113
+ /** The target time to seek to on the next scheduling tick. */
114
+ protected _seekTarget: number | null;
115
+ /** The playback speed multiplier (1.0 is normal speed). */
116
+ playbackRate: number;
117
+ /** Array of synthesizers mapped to their corresponding MIDI instrument IDs. */
118
+ protected _instrumentMap: ISynthInstrument[];
119
+ /** The object URL for the Web Worker script, used for cleanup. */
120
+ protected _workerUrl: string | null;
121
+ /**
122
+ * Initializes a new RLOCore instance.
123
+ * @param audioContext The Web Audio API context.
124
+ * @param instrumentMap The instrument routing map to use for synthesis.
125
+ */
126
+ constructor(audioContext: AudioContext, instrumentMap?: ISynthInstrument[]);
127
+ /** Gets the current time of the audio context. */
128
+ protected get _now(): number;
129
+ /**
130
+ * Sets the global playback volume.
131
+ * @param vol The volume level (0.0 to 1.0).
132
+ */
133
+ setVolume(vol: number): void;
134
+ /**
135
+ * Seeks the currently playing track to the specified time in seconds.
136
+ * @param timeInSeconds The target time in seconds.
137
+ */
138
+ seek(timeInSeconds: number): void;
139
+ /** Stops playback and clears all scheduled audio nodes and timers. */
140
+ stop(): void;
141
+ /** Destroys the core engine, releasing memory and background workers. */
142
+ dispose(): void;
143
+ /** Creates and returns a new GainNode. */
144
+ protected _gain(): GainNode;
145
+ /**
146
+ * Applies a linear fade to an AudioParam over a specified duration.
147
+ * @param gain The AudioParam to fade.
148
+ * @param target The target value.
149
+ * @param time The duration of the fade in seconds.
150
+ */
151
+ protected _fade(gain: AudioParam, target: number, time: number): void;
152
+ /** Creates a pre-configured DynamicsCompressorNode for mastering. */
153
+ protected _comp(ctx?: AudioContext): DynamicsCompressorNode;
154
+ /**
155
+ * Sets up the master audio routing graph for this core.
156
+ * @param fadeInTime Optional fade-in duration in seconds.
157
+ * @returns An object containing the destination AudioNode.
158
+ */
159
+ protected _createRouting(fadeInTime?: number): {
160
+ destination: AudioNode;
161
+ };
162
+ /**
163
+ * Plays a compiled RLO sequence.
164
+ * @param track The compiled RloData to play.
165
+ * @param loopOrOpts Whether the track should loop, or an Options Object.
166
+ * @param fadeInTime Optional fade-in duration in seconds (default 0).
167
+ */
168
+ playSequence(track: RloData, loopOrOpts?: boolean | PlaySequenceOptions, oldFadeInTime?: number): void;
169
+ }
170
+ /**
171
+ * RLOMusicPlayer: The standard music player.
172
+ * Includes network fetching, gzip decoding, convolution reverb, compression, and UI playback controls.
173
+ */
174
+ export declare class RLOMusicPlayer extends RLOCore {
175
+ /** The master volume control node. */
176
+ private _masterGain;
177
+ /** The convolver node used for reverb effects. */
178
+ private _reverb;
179
+ /** The gain node controlling the wet/dry mix of the reverb effect. */
180
+ private _fxGain;
181
+ /** A cache of recently loaded tracks to prevent redundant network requests. */
182
+ private _trackCache;
183
+ /** Event handler for pausing/resuming audio when the document visibility changes. */
184
+ private _visibilityHandler;
185
+ /** The maximum number of tracks to store in the cache. */
186
+ private _maxCacheSize;
187
+ /** The current acoustic space simulation mode. */
188
+ private _reverbMode;
189
+ /**
190
+ * Initializes a new RLOMusicPlayer instance with advanced effects and network capabilities.
191
+ * @param audioContext The Web Audio API context.
192
+ * @param instrumentMap Optional custom instrument map.
193
+ */
194
+ constructor(audioContext: AudioContext, instrumentMap?: ISynthInstrument[]);
195
+ /**
196
+ * Changes the acoustic space simulation for the reverb effect.
197
+ * @param mode 'concert' (large hall) or 'studio' (small room).
198
+ */
199
+ setReverbMode(mode: ReverbMode): void;
200
+ /** Disposes the player, clearing caches and removing event listeners. */
201
+ dispose(): void;
202
+ /**
203
+ * Sets the playback volume, smoothly ramping to the target value.
204
+ * @param vol The volume level (0.0 to 1.0).
205
+ */
206
+ setVolume(vol: number): void;
207
+ /** Returns the current playback time of the track in seconds. */
208
+ getCurrentTime(): number;
209
+ /** Returns the total duration of the currently loaded track in seconds. */
210
+ getTotalDuration(): number;
211
+ /**
212
+ * Overrides the core routing to include reverb, filtering, and mastering compression.
213
+ * @param fadeInTime Optional fade-in duration in seconds.
214
+ * @returns An object containing the destination AudioNode.
215
+ */
216
+ protected _createRouting(fadeInTime?: number): {
217
+ destination: AudioNode;
218
+ };
219
+ /**
220
+ * Loads and plays a track from a URL, a JSON object, or an existing RloData object.
221
+ * @param trackUrlOrData The URL to fetch, or the raw track data.
222
+ * @param fadeInOrOpts Optional fade-in duration in seconds, or an Options Object.
223
+ * @param oldLoop Whether to loop the track (default true).
224
+ */
225
+ play(trackUrlOrData: string | RloData, fadeInOrOpts?: number | PlaySequenceOptions, oldLoop?: boolean): Promise<void>;
226
+ /** Stops playback and gently resets the master gain nodes. */
227
+ stop(): void;
228
+ }
229
+ /**
230
+ * RLOGameEngine: Built for instant action.
231
+ * Features a persistent master routing bus so SFX can play over background music
232
+ * without interrupting each other or causing clipping.
233
+ */
234
+ export declare class RLOGameEngine extends RLOCore {
235
+ /** The persistent master routing bus volume node. */
236
+ private _masterGain;
237
+ /** The dedicated routing bus for Sound Effects. */
238
+ private _sfxGain;
239
+ /** The dedicated routing bus for Background Music. */
240
+ private _musicGain;
241
+ /** A separate synthesizer instance strictly for playing non-blocking sound effects. */
242
+ private _sfxSynthesizer;
243
+ /**
244
+ * Initializes a new RLOGameEngine instance tailored for dynamic real-time audio.
245
+ * @param audioContext The Web Audio API context.
246
+ * @param instrumentMap Optional custom instrument map.
247
+ */
248
+ constructor(audioContext: AudioContext, instrumentMap?: ISynthInstrument[]);
249
+ /**
250
+ * Smoothly changes the master volume for all game audio.
251
+ * @param vol The volume level (0.0 to 1.0).
252
+ */
253
+ setVolume(vol: number): void;
254
+ /**
255
+ * Smoothly changes the volume strictly for the background music routing bus.
256
+ * @param vol The volume level (0.0 to 1.0).
257
+ */
258
+ setMusicVolume(vol: number): void;
259
+ /**
260
+ * Smoothly changes the volume strictly for the sound effects routing bus.
261
+ * @param vol The volume level (0.0 to 1.0).
262
+ */
263
+ setSFXVolume(vol: number): void;
264
+ /**
265
+ * Overrides the core routing to tap into the persistent master game bus.
266
+ * @param fadeInTime Optional fade-in duration in seconds.
267
+ * @returns An object containing the destination AudioNode.
268
+ */
269
+ protected _createRouting(fadeInTime?: number): {
270
+ destination: AudioNode;
271
+ };
272
+ /**
273
+ * Plays a fire-and-forget sound effect dynamically at runtime.
274
+ * @param instrumentId The General MIDI ID of the instrument to use (e.g., 128 for percussion).
275
+ * @param freqOrNote The frequency in Hz, or a Note String (e.g. 'E4').
276
+ * @param duration The duration of the sound effect in seconds.
277
+ * @param velocityOrOpts The velocity (0.0 to 1.0), or an Options Object.
278
+ * @param oldTimeOffset Optional delay in seconds before the sound effect plays.
279
+ */
280
+ playSFX(instrumentId: number, freqOrNote: number | string, duration: number, velocityOrOpts?: number | SFXOptions, oldTimeOffset?: number): void;
281
+ /**
282
+ * Plays an entire compiled RLO sequence as a fire-and-forget sound effect.
283
+ * Note: This bypasses the sequencer and schedules all notes instantly. Ideal for short, complex jingles.
284
+ * @param track The compiled RloData to play.
285
+ * @param timeOffset Optional delay in seconds before the sequence starts.
286
+ */
287
+ playSFXSequence(track: RloData, timeOffset?: number): void;
288
+ /**
289
+ * Plays a background music track, routing it through the master game bus.
290
+ * @param track The compiled RloData to play.
291
+ * @param loopOrOpts Whether the track should loop indefinitely (default true), or an Options Object.
292
+ * @param fadeInTime Optional fade-in duration in seconds (default 0).
293
+ */
294
+ playMusic(track: RloData, loopOrOpts?: boolean | PlaySequenceOptions, oldFadeInTime?: number): void;
295
+ /** Stops the currently playing background music. SFX will continue to function. */
296
+ stopMusic(): void;
297
+ }
298
+ //# sourceMappingURL=RLO-Player.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RLO-Player.d.ts","sourceRoot":"","sources":["../RLO-Player.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAgB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE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