spessasynth_core 4.3.20 → 4.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2091,6 +2091,157 @@ type ChannelMIDIParameterChange = { [P in keyof ChannelMIDIParameter]: {
2091
2091
  value: ChannelMIDIParameter[P];
2092
2092
  } }[keyof ChannelMIDIParameter];
2093
2093
  //#endregion
2094
+ //#region src/synthesizer/audio_engine/sound_bank_manager.d.ts
2095
+ declare class SoundBankManager {
2096
+ /**
2097
+ * All the sound banks, ordered from the most important to the least.
2098
+ */
2099
+ soundBankList: SoundBankManagerListEntry[];
2100
+ private readonly presetListChangeCallback;
2101
+ private selectablePresetList;
2102
+ /**
2103
+ * @param presetListChangeCallback Supplied by the parent synthesizer class,
2104
+ * this is called whenever the preset list changes.
2105
+ */
2106
+ constructor(presetListChangeCallback: () => unknown);
2107
+ private _presetList;
2108
+ /**
2109
+ * The list of all presets in the sound bank stack.
2110
+ */
2111
+ get presetList(): MIDIPatchFull[];
2112
+ /**
2113
+ * The current sound bank priority order.
2114
+ * @returns The IDs of the sound banks in the current order.
2115
+ */
2116
+ get priorityOrder(): string[];
2117
+ /**
2118
+ * The current sound bank priority order.
2119
+ * @param newList The new order of sound bank IDs.
2120
+ */
2121
+ set priorityOrder(newList: string[]);
2122
+ /**
2123
+ * Deletes a given sound bank by its ID.
2124
+ * @param id the ID of the sound bank to delete.
2125
+ */
2126
+ deleteSoundBank(id: string): void;
2127
+ /**
2128
+ * Adds a new sound bank with a given ID, or replaces an existing one.
2129
+ * @param font the sound bank to add.
2130
+ * @param id the ID of the sound bank.
2131
+ * @param bankOffset the bank offset of the sound bank.
2132
+ */
2133
+ addSoundBank(font: BasicSoundBank, id: string, bankOffset?: number): void;
2134
+ destroy(): void;
2135
+ private generatePresetList;
2136
+ }
2137
+ //#endregion
2138
+ //#region src/synthesizer/audio_engine/key_modifier_manager.d.ts
2139
+ declare class KeyModifier {
2140
+ /**
2141
+ * The new override velocity. -1 means unchanged.
2142
+ */
2143
+ velocity: number;
2144
+ /**
2145
+ * The MIDI patch this key uses. -1 on any property means unchanged.
2146
+ */
2147
+ patch: MIDIPatch;
2148
+ /**
2149
+ * Linear gain override for the voice.
2150
+ */
2151
+ gain: number;
2152
+ }
2153
+ declare class KeyModifierManager {
2154
+ /**
2155
+ * The velocity override mappings for MIDI keys
2156
+ * stored as [channelNumber][midiNote].
2157
+ */
2158
+ private keyMappings;
2159
+ /**
2160
+ * Add a mapping for a MIDI key to a KeyModifier.
2161
+ * @param channel The MIDI channel number.
2162
+ * @param midiNote The MIDI note number (0-127).
2163
+ * @param mapping The KeyModifier to apply for this key.
2164
+ */
2165
+ addMapping(channel: number, midiNote: number, mapping: KeyModifier): void;
2166
+ /**
2167
+ * Delete a mapping for a MIDI key.
2168
+ * @param channel The MIDI channel number.
2169
+ * @param midiNote The MIDI note number (0-127).
2170
+ */
2171
+ deleteMapping(channel: number, midiNote: number): void;
2172
+ /**
2173
+ * Clear all key mappings.
2174
+ */
2175
+ clearMappings(): void;
2176
+ /**
2177
+ * Sets the key mappings to a new array.
2178
+ * @param mappings A 2D array where the first dimension is the channel number and the second dimension is the MIDI note number.
2179
+ */
2180
+ setMappings(mappings: (KeyModifier | undefined)[][]): void;
2181
+ /**
2182
+ * Returns the current key mappings.
2183
+ */
2184
+ getMappings(): (KeyModifier | undefined)[][];
2185
+ /**
2186
+ * Gets the velocity override for a MIDI key.
2187
+ * @param channel The MIDI channel number.
2188
+ * @param midiNote The MIDI note number (0-127).
2189
+ * @returns The velocity override, or -1 if no override is set.
2190
+ */
2191
+ getVelocity(channel: number, midiNote: number): number;
2192
+ /**
2193
+ * Gets the gain override for a MIDI key.
2194
+ * @param channel The MIDI channel number.
2195
+ * @param midiNote The MIDI note number (0-127).
2196
+ * @returns The gain override, or 1 if no override is set.
2197
+ */
2198
+ getGain(channel: number, midiNote: number): number;
2199
+ /**
2200
+ * Checks if a MIDI key has an override for the patch.
2201
+ * @param channel The MIDI channel number.
2202
+ * @param midiNote The MIDI note number (0-127).
2203
+ * @returns True if the key has an override patch, false otherwise.
2204
+ */
2205
+ hasOverridePatch(channel: number, midiNote: number): boolean;
2206
+ /**
2207
+ * Gets the patch override for a MIDI key.
2208
+ * @param channel The MIDI channel number.
2209
+ * @param midiNote The MIDI note number (0-127).
2210
+ * @returns An object containing the bank and program numbers.
2211
+ * @throws Error if no modifier is set for the key.
2212
+ */
2213
+ getPatch(channel: number, midiNote: number): MIDIPatch;
2214
+ }
2215
+ //#endregion
2216
+ //#region src/synthesizer/audio_engine/channel/channel_snapshot.d.ts
2217
+ interface DrumParameterSnapshot {
2218
+ pitch: number;
2219
+ gain: number;
2220
+ exclusiveClass: number;
2221
+ pan: number;
2222
+ reverbGain: number;
2223
+ chorusGain: number;
2224
+ delayGain: number;
2225
+ rxNoteOn: boolean;
2226
+ rxNoteOff: boolean;
2227
+ }
2228
+ interface ChannelSnapshot {
2229
+ patch?: MIDIPatchFull;
2230
+ lockedSystem: MIDISystem;
2231
+ midiControllers: Int16Array;
2232
+ lockedControllers: boolean[];
2233
+ pitchWheels: Int16Array;
2234
+ generators: ChannelGenerators;
2235
+ midiParameters: ChannelMIDIParameter;
2236
+ lockedMIDIParameters: Record<keyof ChannelMIDIParameter, boolean>;
2237
+ systemParameters: ChannelSystemParameter;
2238
+ octaveTuning: Int8Array;
2239
+ perNotePitch: boolean;
2240
+ drumParams: DrumParameterSnapshot[];
2241
+ drumChannel: boolean;
2242
+ channel: number;
2243
+ }
2244
+ //#endregion
2094
2245
  //#region src/synthesizer/audio_engine/parameters/system.d.ts
2095
2246
  /**
2096
2247
  * The global parameters of the synthesizer.
@@ -2218,126 +2369,20 @@ interface GlobalSystemParameter {
2218
2369
  }
2219
2370
  declare const DEFAULT_GLOBAL_SYSTEM_PARAMETERS: GlobalSystemParameter;
2220
2371
  //#endregion
2221
- //#region src/synthesizer/audio_engine/sound_bank_manager.d.ts
2222
- declare class SoundBankManager {
2223
- /**
2224
- * All the sound banks, ordered from the most important to the least.
2225
- */
2226
- soundBankList: SoundBankManagerListEntry[];
2227
- private readonly presetListChangeCallback;
2228
- private selectablePresetList;
2229
- /**
2230
- * @param presetListChangeCallback Supplied by the parent synthesizer class,
2231
- * this is called whenever the preset list changes.
2232
- */
2233
- constructor(presetListChangeCallback: () => unknown);
2234
- private _presetList;
2235
- /**
2236
- * The list of all presets in the sound bank stack.
2237
- */
2238
- get presetList(): MIDIPatchFull[];
2239
- /**
2240
- * The current sound bank priority order.
2241
- * @returns The IDs of the sound banks in the current order.
2242
- */
2243
- get priorityOrder(): string[];
2244
- /**
2245
- * The current sound bank priority order.
2246
- * @param newList The new order of sound bank IDs.
2247
- */
2248
- set priorityOrder(newList: string[]);
2249
- /**
2250
- * Deletes a given sound bank by its ID.
2251
- * @param id the ID of the sound bank to delete.
2252
- */
2253
- deleteSoundBank(id: string): void;
2254
- /**
2255
- * Adds a new sound bank with a given ID, or replaces an existing one.
2256
- * @param font the sound bank to add.
2257
- * @param id the ID of the sound bank.
2258
- * @param bankOffset the bank offset of the sound bank.
2259
- */
2260
- addSoundBank(font: BasicSoundBank, id: string, bankOffset?: number): void;
2261
- destroy(): void;
2262
- private generatePresetList;
2263
- }
2264
- //#endregion
2265
- //#region src/synthesizer/audio_engine/key_modifier_manager.d.ts
2266
- declare class KeyModifier {
2267
- /**
2268
- * The new override velocity. -1 means unchanged.
2269
- */
2270
- velocity: number;
2271
- /**
2272
- * The MIDI patch this key uses. -1 on any property means unchanged.
2273
- */
2274
- patch: MIDIPatch;
2275
- /**
2276
- * Linear gain override for the voice.
2277
- */
2278
- gain: number;
2279
- }
2280
- declare class KeyModifierManager {
2281
- /**
2282
- * The velocity override mappings for MIDI keys
2283
- * stored as [channelNumber][midiNote].
2284
- */
2285
- private keyMappings;
2286
- /**
2287
- * Add a mapping for a MIDI key to a KeyModifier.
2288
- * @param channel The MIDI channel number.
2289
- * @param midiNote The MIDI note number (0-127).
2290
- * @param mapping The KeyModifier to apply for this key.
2291
- */
2292
- addMapping(channel: number, midiNote: number, mapping: KeyModifier): void;
2293
- /**
2294
- * Delete a mapping for a MIDI key.
2295
- * @param channel The MIDI channel number.
2296
- * @param midiNote The MIDI note number (0-127).
2297
- */
2298
- deleteMapping(channel: number, midiNote: number): void;
2299
- /**
2300
- * Clear all key mappings.
2301
- */
2302
- clearMappings(): void;
2303
- /**
2304
- * Sets the key mappings to a new array.
2305
- * @param mappings A 2D array where the first dimension is the channel number and the second dimension is the MIDI note number.
2306
- */
2307
- setMappings(mappings: (KeyModifier | undefined)[][]): void;
2308
- /**
2309
- * Returns the current key mappings.
2310
- */
2311
- getMappings(): (KeyModifier | undefined)[][];
2312
- /**
2313
- * Gets the velocity override for a MIDI key.
2314
- * @param channel The MIDI channel number.
2315
- * @param midiNote The MIDI note number (0-127).
2316
- * @returns The velocity override, or -1 if no override is set.
2317
- */
2318
- getVelocity(channel: number, midiNote: number): number;
2319
- /**
2320
- * Gets the gain override for a MIDI key.
2321
- * @param channel The MIDI channel number.
2322
- * @param midiNote The MIDI note number (0-127).
2323
- * @returns The gain override, or 1 if no override is set.
2324
- */
2325
- getGain(channel: number, midiNote: number): number;
2326
- /**
2327
- * Checks if a MIDI key has an override for the patch.
2328
- * @param channel The MIDI channel number.
2329
- * @param midiNote The MIDI note number (0-127).
2330
- * @returns True if the key has an override patch, false otherwise.
2331
- */
2332
- hasOverridePatch(channel: number, midiNote: number): boolean;
2372
+ //#region src/synthesizer/audio_engine/synthesizer_snapshot.d.ts
2373
+ interface SynthesizerSnapshot {
2374
+ midiChannels: ChannelSnapshot[];
2333
2375
  /**
2334
- * Gets the patch override for a MIDI key.
2335
- * @param channel The MIDI channel number.
2336
- * @param midiNote The MIDI note number (0-127).
2337
- * @returns An object containing the bank and program numbers.
2338
- * @throws Error if no modifier is set for the key.
2376
+ * Key modifiers.
2339
2377
  */
2340
- getPatch(channel: number, midiNote: number): MIDIPatch;
2378
+ keyMappings: (KeyModifier | undefined)[][];
2379
+ midiParameters: GlobalMIDIParameter;
2380
+ lockedMIDIParameters: Record<keyof GlobalMIDIParameter, boolean>;
2381
+ systemParameters: GlobalSystemParameter;
2382
+ reverbProcessor: ReverbProcessorSnapshot;
2383
+ chorusProcessor: ChorusProcessorSnapshot;
2384
+ delayProcessor: DelayProcessorSnapshot;
2385
+ insertionProcessor: InsertionProcessorSnapshot;
2341
2386
  }
2342
2387
  //#endregion
2343
2388
  //#region src/midi/types.d.ts
@@ -2479,49 +2524,71 @@ interface TimelineEvent {
2479
2524
  }
2480
2525
  type SysExAcceptedArray = number[] | Uint8Array | Int8Array | Uint8ClampedArray;
2481
2526
  //#endregion
2482
- //#region src/synthesizer/audio_engine/channel/channel_snapshot.d.ts
2483
- interface DrumParameterSnapshot {
2484
- pitch: number;
2485
- gain: number;
2486
- exclusiveClass: number;
2487
- pan: number;
2488
- reverbGain: number;
2489
- chorusGain: number;
2490
- delayGain: number;
2491
- rxNoteOn: boolean;
2492
- rxNoteOff: boolean;
2493
- }
2494
- interface ChannelSnapshot {
2495
- patch?: MIDIPatchFull;
2496
- lockedSystem: MIDISystem;
2497
- midiControllers: Int16Array;
2498
- lockedControllers: boolean[];
2499
- pitchWheels: Int16Array;
2500
- generators: ChannelGenerators;
2501
- midiParameters: ChannelMIDIParameter;
2502
- lockedMIDIParameters: Record<keyof ChannelMIDIParameter, boolean>;
2503
- systemParameters: ChannelSystemParameter;
2504
- octaveTuning: Int8Array;
2505
- perNotePitch: boolean;
2506
- drumParams: DrumParameterSnapshot[];
2507
- drumChannel: boolean;
2508
- channel: number;
2509
- }
2510
- //#endregion
2511
- //#region src/synthesizer/audio_engine/synthesizer_snapshot.d.ts
2512
- interface SynthesizerSnapshot {
2513
- midiChannels: ChannelSnapshot[];
2527
+ //#region src/midi/midi_message.d.ts
2528
+ declare class MIDIMessage {
2514
2529
  /**
2515
- * Key modifiers.
2530
+ * Absolute number of MIDI ticks from the start of the track.
2516
2531
  */
2517
- keyMappings: (KeyModifier | undefined)[][];
2518
- midiParameters: GlobalMIDIParameter;
2519
- lockedMIDIParameters: Record<keyof GlobalMIDIParameter, boolean>;
2520
- systemParameters: GlobalSystemParameter;
2521
- reverbProcessor: ReverbProcessorSnapshot;
2522
- chorusProcessor: ChorusProcessorSnapshot;
2523
- delayProcessor: DelayProcessorSnapshot;
2524
- insertionProcessor: InsertionProcessorSnapshot;
2532
+ ticks: number;
2533
+ /**
2534
+ * The MIDI message status byte. Note that for meta events, it is the second byte. (not 0xFF).
2535
+ */
2536
+ statusByte: MIDIMessageType;
2537
+ /**
2538
+ * Message's binary data.
2539
+ */
2540
+ data: Uint8Array<ArrayBuffer>;
2541
+ /**
2542
+ * Creates a new MIDI message.
2543
+ * @param ticks time of this message in absolute MIDI ticks.
2544
+ * @param byte the message status byte.
2545
+ * @param data the message's binary data.
2546
+ */
2547
+ constructor(ticks: number, byte: MIDIMessageType, data: Uint8Array<ArrayBuffer>);
2548
+ /**
2549
+ * Returns a new MIDI Pitch Wheel message.
2550
+ * @param ticks time of this message in absolute MIDI ticks.
2551
+ * @param channel the channel number of this message.
2552
+ * @param value the new value, between 0 and 16383, where 8192 is the center (no pitch change).
2553
+ */
2554
+ static pitchWheel(ticks: number, channel: number, value: number): MIDIMessage;
2555
+ /**
2556
+ * Returns a new MIDI Channel Pressure message.
2557
+ * @param ticks time of this message in absolute MIDI ticks.
2558
+ * @param channel the channel number of this message.
2559
+ * @param value the new value, between 0 and 127.
2560
+ */
2561
+ static channelPressure(ticks: number, channel: number, value: number): MIDIMessage;
2562
+ /**
2563
+ * Returns a new MIDI Program Change message.
2564
+ * @param ticks time of this message in absolute MIDI ticks.
2565
+ * @param channel the channel number of this message.
2566
+ * @param program the new MIDI program number, between 0 and 127.
2567
+ */
2568
+ static programChange(ticks: number, channel: number, program: number): MIDIMessage;
2569
+ /**
2570
+ * Returns a new MIDI Controller Change message.
2571
+ * @param ticks time of this message in absolute MIDI ticks.
2572
+ * @param channel the channel number of this message.
2573
+ * @param controller the MIDI controller.
2574
+ * @param value the new value.
2575
+ */
2576
+ static controllerChange(ticks: number, channel: number, controller: MIDIController, value: number): MIDIMessage;
2577
+ /**
2578
+ * Returns a new MIDI System Exclusive message.
2579
+ * @param ticks time of this message in absolute MIDI ticks.
2580
+ * @param data the data of the system exclusive message,
2581
+ * excluding the starting 0xF0 byte.
2582
+ */
2583
+ static systemExclusive(ticks: number, data: number[]): MIDIMessage;
2584
+ /**
2585
+ * Returns a new MIDI Registered Parameter message. Sends both data MSB and LSB.
2586
+ * @param ticks time of this message in absolute MIDI ticks.
2587
+ * @param channel the channel number of this message.
2588
+ * @param parameter the 14-bit MIDI registered parameter number.
2589
+ * @param value the 14-bit new value.
2590
+ */
2591
+ static registeredParameter(ticks: number, channel: number, parameter: number, value: number): MIDIMessage[];
2525
2592
  }
2526
2593
  //#endregion
2527
2594
  //#region src/synthesizer/processor.d.ts
@@ -2625,7 +2692,14 @@ declare class SpessaSynthProcessor {
2625
2692
  * @param channelOffset The channel offset for the message. It will be added to message's channel number if applicable.
2626
2693
  * @param options Additional options for scheduling the message.
2627
2694
  */
2628
- readonly processMessage: (message: SysExAcceptedArray, channelOffset?: number, options?: SynthMethodOptions) => void;
2695
+ readonly processMessage: (message: SysExAcceptedArray | MIDIMessage, channelOffset?: number, options?: SynthMethodOptions) => void;
2696
+ /**
2697
+ * Processes multiple MIDI messages and allows scheduling them at a specific time.
2698
+ * @param message The MIDI messages to process.
2699
+ * @param channelOffset The channel offset for the messages. It will be added to messages' channel number if applicable.
2700
+ * @param options Additional options for scheduling the message.
2701
+ */
2702
+ readonly processMessages: (message: (SysExAcceptedArray | MIDIMessage)[], channelOffset?: number, options?: SynthMethodOptions) => void;
2629
2703
  /**
2630
2704
  * Core synthesis engine.
2631
2705
  */
@@ -3804,73 +3878,6 @@ interface WaveMetadata {
3804
3878
  genre: string;
3805
3879
  }
3806
3880
  //#endregion
3807
- //#region src/midi/midi_message.d.ts
3808
- declare class MIDIMessage {
3809
- /**
3810
- * Absolute number of MIDI ticks from the start of the track.
3811
- */
3812
- ticks: number;
3813
- /**
3814
- * The MIDI message status byte. Note that for meta events, it is the second byte. (not 0xFF).
3815
- */
3816
- statusByte: MIDIMessageType;
3817
- /**
3818
- * Message's binary data.
3819
- */
3820
- data: Uint8Array<ArrayBuffer>;
3821
- /**
3822
- * Creates a new MIDI message.
3823
- * @param ticks time of this message in absolute MIDI ticks.
3824
- * @param byte the message status byte.
3825
- * @param data the message's binary data.
3826
- */
3827
- constructor(ticks: number, byte: MIDIMessageType, data: Uint8Array<ArrayBuffer>);
3828
- /**
3829
- * Returns a new MIDI Pitch Wheel message.
3830
- * @param ticks time of this message in absolute MIDI ticks.
3831
- * @param channel the channel number of this message.
3832
- * @param value the new value, between 0 and 16383, where 8192 is the center (no pitch change).
3833
- */
3834
- static pitchWheel(ticks: number, channel: number, value: number): MIDIMessage;
3835
- /**
3836
- * Returns a new MIDI Channel Pressure message.
3837
- * @param ticks time of this message in absolute MIDI ticks.
3838
- * @param channel the channel number of this message.
3839
- * @param value the new value, between 0 and 127.
3840
- */
3841
- static channelPressure(ticks: number, channel: number, value: number): MIDIMessage;
3842
- /**
3843
- * Returns a new MIDI Program Change message.
3844
- * @param ticks time of this message in absolute MIDI ticks.
3845
- * @param channel the channel number of this message.
3846
- * @param program the new MIDI program number, between 0 and 127.
3847
- */
3848
- static programChange(ticks: number, channel: number, program: number): MIDIMessage;
3849
- /**
3850
- * Returns a new MIDI Controller Change message.
3851
- * @param ticks time of this message in absolute MIDI ticks.
3852
- * @param channel the channel number of this message.
3853
- * @param controller the MIDI controller.
3854
- * @param value the new value.
3855
- */
3856
- static controllerChange(ticks: number, channel: number, controller: MIDIController, value: number): MIDIMessage;
3857
- /**
3858
- * Returns a new MIDI System Exclusive message.
3859
- * @param ticks time of this message in absolute MIDI ticks.
3860
- * @param data the data of the system exclusive message,
3861
- * excluding the starting 0xF0 byte.
3862
- */
3863
- static systemExclusive(ticks: number, data: number[]): MIDIMessage;
3864
- /**
3865
- * Returns a new MIDI Registered Parameter message. Sends both data MSB and LSB.
3866
- * @param ticks time of this message in absolute MIDI ticks.
3867
- * @param channel the channel number of this message.
3868
- * @param parameter the 14-bit MIDI registered parameter number.
3869
- * @param value the 14-bit new value.
3870
- */
3871
- static registeredParameter(ticks: number, channel: number, parameter: number, value: number): MIDIMessage[];
3872
- }
3873
- //#endregion
3874
3881
  //#region src/midi/midi_tools/modify_midi.d.ts
3875
3882
  /**
3876
3883
  * Represents a value that means "clear this parameter" instead of "replace this parameter with".