spessasynth_lib 3.24.3 → 3.24.6

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 (99) hide show
  1. package/README.md +14 -4
  2. package/midi_parser/midi_loader.js +51 -28
  3. package/package.json +1 -2
  4. package/sequencer/sequencer.js +3 -3
  5. package/sequencer/worklet_sequencer/worklet_sequencer.js +6 -0
  6. package/synthetizer/synthetizer.js +8 -6
  7. package/synthetizer/worklet_processor.min.js +9 -9
  8. package/synthetizer/worklet_system/main_processor.js +9 -7
  9. package/synthetizer/worklet_system/worklet_methods/note_on.js +2 -1
  10. package/@types/external_midi/midi_handler.d.ts +0 -39
  11. package/@types/external_midi/web_midi_link.d.ts +0 -12
  12. package/@types/externals/stbvorbis_sync/stbvorbis_sync.min.d.ts +0 -1
  13. package/@types/index.d.ts +0 -44
  14. package/@types/midi_parser/basic_midi.d.ts +0 -36
  15. package/@types/midi_parser/midi_builder.d.ts +0 -68
  16. package/@types/midi_parser/midi_data.d.ts +0 -46
  17. package/@types/midi_parser/midi_editor.d.ts +0 -89
  18. package/@types/midi_parser/midi_loader.d.ts +0 -30
  19. package/@types/midi_parser/midi_message.d.ts +0 -155
  20. package/@types/midi_parser/midi_sequence.d.ts +0 -135
  21. package/@types/midi_parser/midi_writer.d.ts +0 -6
  22. package/@types/midi_parser/rmidi_writer.d.ts +0 -85
  23. package/@types/midi_parser/used_keys_loaded.d.ts +0 -10
  24. package/@types/sequencer/sequencer.d.ts +0 -277
  25. package/@types/sequencer/worklet_sequencer/sequencer_message.d.ts +0 -31
  26. package/@types/soundfont/basic_soundfont/basic_instrument.d.ts +0 -29
  27. package/@types/soundfont/basic_soundfont/basic_preset.d.ts +0 -86
  28. package/@types/soundfont/basic_soundfont/basic_sample.d.ts +0 -88
  29. package/@types/soundfont/basic_soundfont/basic_soundfont.d.ts +0 -102
  30. package/@types/soundfont/basic_soundfont/basic_zone.d.ts +0 -58
  31. package/@types/soundfont/basic_soundfont/basic_zones.d.ts +0 -22
  32. package/@types/soundfont/basic_soundfont/generator.d.ts +0 -102
  33. package/@types/soundfont/basic_soundfont/modulator.d.ts +0 -92
  34. package/@types/soundfont/basic_soundfont/riff_chunk.d.ts +0 -45
  35. package/@types/soundfont/basic_soundfont/write_dls/art2.d.ts +0 -6
  36. package/@types/soundfont/basic_soundfont/write_dls/articulator.d.ts +0 -28
  37. package/@types/soundfont/basic_soundfont/write_dls/combine_zones.d.ts +0 -8
  38. package/@types/soundfont/basic_soundfont/write_dls/ins.d.ts +0 -7
  39. package/@types/soundfont/basic_soundfont/write_dls/lins.d.ts +0 -5
  40. package/@types/soundfont/basic_soundfont/write_dls/modulator_converter.d.ts +0 -11
  41. package/@types/soundfont/basic_soundfont/write_dls/rgn2.d.ts +0 -8
  42. package/@types/soundfont/basic_soundfont/write_dls/wave.d.ts +0 -6
  43. package/@types/soundfont/basic_soundfont/write_dls/write_dls.d.ts +0 -6
  44. package/@types/soundfont/basic_soundfont/write_dls/wsmp.d.ts +0 -12
  45. package/@types/soundfont/basic_soundfont/write_dls/wvpl.d.ts +0 -8
  46. package/@types/soundfont/basic_soundfont/write_sf2/ibag.d.ts +0 -6
  47. package/@types/soundfont/basic_soundfont/write_sf2/igen.d.ts +0 -6
  48. package/@types/soundfont/basic_soundfont/write_sf2/imod.d.ts +0 -6
  49. package/@types/soundfont/basic_soundfont/write_sf2/inst.d.ts +0 -6
  50. package/@types/soundfont/basic_soundfont/write_sf2/pbag.d.ts +0 -6
  51. package/@types/soundfont/basic_soundfont/write_sf2/pgen.d.ts +0 -6
  52. package/@types/soundfont/basic_soundfont/write_sf2/phdr.d.ts +0 -6
  53. package/@types/soundfont/basic_soundfont/write_sf2/pmod.d.ts +0 -6
  54. package/@types/soundfont/basic_soundfont/write_sf2/sdta.d.ts +0 -11
  55. package/@types/soundfont/basic_soundfont/write_sf2/shdr.d.ts +0 -8
  56. package/@types/soundfont/basic_soundfont/write_sf2/soundfont_trimmer.d.ts +0 -6
  57. package/@types/soundfont/basic_soundfont/write_sf2/write.d.ts +0 -21
  58. package/@types/soundfont/dls/articulator_converter.d.ts +0 -19
  59. package/@types/soundfont/dls/dls_destinations.d.ts +0 -29
  60. package/@types/soundfont/dls/dls_preset.d.ts +0 -13
  61. package/@types/soundfont/dls/dls_sample.d.ts +0 -19
  62. package/@types/soundfont/dls/dls_soundfont.d.ts +0 -31
  63. package/@types/soundfont/dls/dls_sources.d.ts +0 -27
  64. package/@types/soundfont/dls/dls_zone.d.ts +0 -23
  65. package/@types/soundfont/dls/read_articulation.d.ts +0 -12
  66. package/@types/soundfont/dls/read_instrument.d.ts +0 -5
  67. package/@types/soundfont/dls/read_instrument_list.d.ts +0 -5
  68. package/@types/soundfont/dls/read_lart.d.ts +0 -7
  69. package/@types/soundfont/dls/read_region.d.ts +0 -7
  70. package/@types/soundfont/dls/read_samples.d.ts +0 -5
  71. package/@types/soundfont/load_soundfont.d.ts +0 -6
  72. package/@types/soundfont/read_sf2/generators.d.ts +0 -16
  73. package/@types/soundfont/read_sf2/instruments.d.ts +0 -29
  74. package/@types/soundfont/read_sf2/modulators.d.ts +0 -15
  75. package/@types/soundfont/read_sf2/presets.d.ts +0 -30
  76. package/@types/soundfont/read_sf2/samples.d.ts +0 -55
  77. package/@types/soundfont/read_sf2/soundfont.d.ts +0 -28
  78. package/@types/soundfont/read_sf2/zones.d.ts +0 -99
  79. package/@types/synthetizer/audio_effects/effects_config.d.ts +0 -41
  80. package/@types/synthetizer/audio_effects/fancy_chorus.d.ts +0 -97
  81. package/@types/synthetizer/audio_effects/reverb.d.ts +0 -7
  82. package/@types/synthetizer/key_modifier_manager.d.ts +0 -56
  83. package/@types/synthetizer/synth_event_handler.d.ts +0 -263
  84. package/@types/synthetizer/synth_soundfont_manager.d.ts +0 -52
  85. package/@types/synthetizer/synthetizer.d.ts +0 -358
  86. package/@types/synthetizer/worklet_system/message_protocol/worklet_message.d.ts +0 -98
  87. package/@types/synthetizer/worklet_system/worklet_methods/worklet_key_modifier.d.ts +0 -77
  88. package/@types/synthetizer/worklet_system/worklet_methods/worklet_soundfont_manager/sfman_message.d.ts +0 -7
  89. package/@types/synthetizer/worklet_system/worklet_utilities/controller_tables.d.ts +0 -23
  90. package/@types/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.d.ts +0 -155
  91. package/@types/synthetizer/worklet_url.d.ts +0 -5
  92. package/@types/utils/buffer_to_wav.d.ts +0 -31
  93. package/@types/utils/byte_functions/big_endian.d.ts +0 -13
  94. package/@types/utils/byte_functions/little_endian.d.ts +0 -35
  95. package/@types/utils/byte_functions/string.d.ts +0 -27
  96. package/@types/utils/byte_functions/variable_length_quantity.d.ts +0 -12
  97. package/@types/utils/indexed_array.d.ts +0 -21
  98. package/@types/utils/loggin.d.ts +0 -26
  99. package/@types/utils/other.d.ts +0 -37
@@ -1,358 +0,0 @@
1
- /**
2
- * synthesizer.js
3
- * purpose: responds to midi messages and called functions, managing the channels and passing the messages to them
4
- */
5
- /**
6
- * @typedef {Object} StartRenderingDataConfig
7
- * @property {BasicMIDI} parsedMIDI - the MIDI to render
8
- * @property {SynthesizerSnapshot} snapshot - the snapshot to apply
9
- * @property {boolean|undefined} oneOutput - if synth should use one output with 32 channels (2 audio channels for each midi channel).
10
- * this disabled chorus and reverb.
11
- * @property {number|undefined} loopCount - the times to loop the song
12
- */
13
- export const WORKLET_PROCESSOR_NAME: "spessasynth-worklet-system";
14
- export const VOICE_CAP: 350;
15
- export const DEFAULT_PERCUSSION: 9;
16
- export const MIDI_CHANNEL_COUNT: 16;
17
- export const DEFAULT_SYNTH_MODE: "gs";
18
- export class Synthetizer {
19
- /**
20
- * Creates a new instance of the SpessaSynth synthesizer
21
- * @param targetNode {AudioNode}
22
- * @param soundFontBuffer {ArrayBuffer} the soundfont file array buffer
23
- * @param enableEventSystem {boolean} enables the event system. Defaults to true
24
- * @param startRenderingData {StartRenderingDataConfig} if set, starts playing this immediately and restores the values
25
- * @param synthConfig {SynthConfig} optional configuration for the synthesizer.
26
- */
27
- constructor(targetNode: AudioNode, soundFontBuffer: ArrayBuffer, enableEventSystem?: boolean, startRenderingData?: StartRenderingDataConfig, synthConfig?: SynthConfig);
28
- context: BaseAudioContext;
29
- targetNode: AudioNode;
30
- /**
31
- * Allows setting up custom event listeners for the synthesizer
32
- * @type {EventHandler}
33
- */
34
- eventHandler: EventHandler;
35
- _voiceCap: number;
36
- _destroyed: boolean;
37
- /**
38
- * the new channels will have their audio sent to the moduled output by this constant.
39
- * what does that mean? e.g., if outputsAmount is 16, then channel's 16 audio data will be sent to channel 0
40
- * @type {number}
41
- * @private
42
- */
43
- private _outputsAmount;
44
- /**
45
- * the number of midi channels
46
- * @type {number}
47
- */
48
- channelsAmount: number;
49
- /**
50
- * @type {function}
51
- */
52
- resolveWhenReady: Function;
53
- /**
54
- * Indicates if the synth is fully ready
55
- * @type {Promise<void>}
56
- */
57
- isReady: Promise<void>;
58
- /**
59
- * individual channel voices amount
60
- * @type {ChannelProperty[]}
61
- */
62
- channelProperties: ChannelProperty[];
63
- _voicesAmount: number;
64
- /**
65
- * For Black MIDI's - forces release time to 50ms
66
- * @type {boolean}
67
- */
68
- _highPerformanceMode: boolean;
69
- /**
70
- * @type {SynthConfig}
71
- */
72
- effectsConfig: SynthConfig;
73
- worklet: any;
74
- /**
75
- * The synth's soundfont manager
76
- * @type {SoundfontManager}
77
- */
78
- soundfontManager: SoundfontManager;
79
- /**
80
- * The synth's key modifier manager
81
- * @type {KeyModifierManager}
82
- */
83
- keyModifierManager: KeyModifierManager;
84
- /**
85
- * @type {function(SynthesizerSnapshot)}
86
- * @private
87
- */
88
- private _snapshotCallback;
89
- /**
90
- * for the worklet sequencer's messages
91
- * @type {function(WorkletSequencerReturnMessageType, any)}
92
- */
93
- sequencerCallbackFunction: (arg0: WorkletSequencerReturnMessageType, arg1: any) => any;
94
- reverbProcessor: ConvolverNode;
95
- chorusProcessor: FancyChorus;
96
- /**
97
- * The maximum number of voices allowed at once
98
- * @param value {number}
99
- */
100
- set voiceCap(value: number);
101
- /**
102
- * The maximum number of voices allowed at once
103
- * @returns {number}
104
- */
105
- get voiceCap(): number;
106
- /**
107
- * For Black MIDI's - forces release time to 50ms
108
- * @param {boolean} value
109
- */
110
- set highPerformanceMode(value: boolean);
111
- get highPerformanceMode(): boolean;
112
- /**
113
- * @returns {number} the audioContext's current time
114
- */
115
- get currentTime(): number;
116
- /**
117
- * @returns {number} the current number of voices playing
118
- */
119
- get voicesAmount(): number;
120
- /**
121
- * Sets the SpessaSynth's log level
122
- * @param enableInfo {boolean} - enable info (verbose)
123
- * @param enableWarning {boolean} - enable warnings (unrecognized messages)
124
- * @param enableGroup {boolean} - enable groups (recomended)
125
- * @param enableTable {boolean} - enable table (debug message)
126
- */
127
- setLogLevel(enableInfo: boolean, enableWarning: boolean, enableGroup: boolean, enableTable: boolean): void;
128
- /**
129
- * @param type {masterParameterType}
130
- * @param data {any}
131
- * @private
132
- */
133
- private _setMasterParam;
134
- /**
135
- * Sets the interpolation type for the synthesizer:
136
- * 0 - linear
137
- * 1 - nearest neighbor
138
- * @param type {interpolationTypes}
139
- */
140
- setInterpolationType(type: interpolationTypes): void;
141
- /**
142
- * Handles the messages received from the worklet
143
- * @param message {WorkletReturnMessage}
144
- * @private
145
- */
146
- private handleMessage;
147
- /**
148
- * Gets a complete snapshot of the synthesizer, including controllers
149
- * @returns {Promise<SynthesizerSnapshot>}
150
- */
151
- getSynthesizerSnapshot(): Promise<SynthesizerSnapshot>;
152
- /**
153
- * Adds a new channel to the synthesizer
154
- * @param postMessage {boolean} leave at true, set to false only at initialization
155
- */
156
- addNewChannel(postMessage?: boolean): void;
157
- /**
158
- * @param channel {number}
159
- * @param value {{delay: number, depth: number, rate: number}}
160
- */
161
- setVibrato(channel: number, value: {
162
- delay: number;
163
- depth: number;
164
- rate: number;
165
- }): void;
166
- /**
167
- * Connects the individual audio outputs to the given audio nodes. In the app, it's used by the renderer.
168
- * @param audioNodes {AudioNode[]}
169
- */
170
- connectIndividualOutputs(audioNodes: AudioNode[]): void;
171
- disableGSNRPparams(): void;
172
- /**
173
- * A message for debugging
174
- */
175
- debugMessage(): void;
176
- /**
177
- * Starts playing a note
178
- * @param channel {number} usually 0-15: the channel to play the note
179
- * @param midiNote {number} 0-127 the key number of the note
180
- * @param velocity {number} 0-127 the velocity of the note (generally controls loudness)
181
- * @param enableDebugging {boolean} set to true to log technical details to console
182
- */
183
- noteOn(channel: number, midiNote: number, velocity: number, enableDebugging?: boolean): void;
184
- /**
185
- * Stops playing a note
186
- * @param channel {number} usually 0-15: the channel of the note
187
- * @param midiNote {number} 0-127 the key number of the note
188
- * @param force {boolean} instantly kills the note if true
189
- */
190
- noteOff(channel: number, midiNote: number, force?: boolean): void;
191
- /**
192
- * Stops all notes
193
- * @param force {boolean} if we should instantly kill the note, defaults to false
194
- */
195
- stopAll(force?: boolean): void;
196
- /**
197
- * Changes the given controller
198
- * @param channel {number} usually 0-15: the channel to change the controller
199
- * @param controllerNumber {number} 0-127 the MIDI CC number
200
- * @param controllerValue {number} 0-127 the controller value
201
- * @param force {boolean} forces the controller change, even if it's locked or gm system is set and the cc is bank select
202
- */
203
- controllerChange(channel: number, controllerNumber: number, controllerValue: number, force?: boolean): void;
204
- /**
205
- * Resets all controllers (for every channel)
206
- */
207
- resetControllers(): void;
208
- /**
209
- * Applies pressure to a given channel
210
- * @param channel {number} usually 0-15: the channel to change the controller
211
- * @param pressure {number} 0-127: the pressure to apply
212
- */
213
- channelPressure(channel: number, pressure: number): void;
214
- /**
215
- * Applies pressure to a given note
216
- * @param channel {number} usually 0-15: the channel to change the controller
217
- * @param midiNote {number} 0-127: the MIDI note
218
- * @param pressure {number} 0-127: the pressure to apply
219
- */
220
- polyPressure(channel: number, midiNote: number, pressure: number): void;
221
- /**
222
- * @param data {WorkletMessage}
223
- */
224
- post(data: WorkletMessage): void;
225
- /**
226
- * Sets the pitch of the given channel
227
- * @param channel {number} usually 0-15: the channel to change pitch
228
- * @param MSB {number} SECOND byte of the MIDI pitchWheel message
229
- * @param LSB {number} FIRST byte of the MIDI pitchWheel message
230
- */
231
- pitchWheel(channel: number, MSB: number, LSB: number): void;
232
- /**
233
- * Transposes the synthetizer's pitch by given semitones amount (percussion channels don’t get affected)
234
- * @param semitones {number} the semitones to transpose by. Can be a floating point number for more precision
235
- */
236
- transpose(semitones: number): void;
237
- /**
238
- * Transposes the channel by given amount of semitones
239
- * @param channel {number} the channel number
240
- * @param semitones {number} the transposition of the channel, can be a float
241
- * @param force {boolean} defaults to false, if true transposes the channel even if it's a drum channel
242
- */
243
- transposeChannel(channel: number, semitones: number, force?: boolean): void;
244
- /**
245
- * Sets the main volume
246
- * @param volume {number} 0-1 the volume
247
- */
248
- setMainVolume(volume: number): void;
249
- /**
250
- * Sets the master stereo panning
251
- * @param pan {number} -1 to 1, the pan (-1 is left, 0 is midde, 1 is right)
252
- */
253
- setMasterPan(pan: number): void;
254
- /**
255
- * Sets the channel's pitch bend range, in semitones
256
- * @param channel {number} usually 0-15: the channel to change
257
- * @param pitchBendRangeSemitones {number} the bend range in semitones
258
- */
259
- setPitchBendRange(channel: number, pitchBendRangeSemitones: number): void;
260
- /**
261
- * Changes the patch for a given channel
262
- * @param channel {number} usually 0-15: the channel to change
263
- * @param programNumber {number} 0-127 the MIDI patch number
264
- * @param userChange {boolean} indicates if the program change has been called by user. defaults to false
265
- */
266
- programChange(channel: number, programNumber: number, userChange?: boolean): void;
267
- /**
268
- * Overrides velocity on a given channel
269
- * @param channel {number} usually 0-15: the channel to change
270
- * @param velocity {number} 1-127, the velocity to use.
271
- * 0 Disables this functionality
272
- */
273
- velocityOverride(channel: number, velocity: number): void;
274
- /**
275
- * Causes the given midi channel to ignore controller messages for the given controller number
276
- * @param channel {number} usually 0-15: the channel to lock
277
- * @param controllerNumber {number} 0-127 MIDI CC number NOTE: -1 locks the preset
278
- * @param isLocked {boolean} true if locked, false if unlocked
279
- */
280
- lockController(channel: number, controllerNumber: number, isLocked: boolean): void;
281
- /**
282
- * Mutes or unmutes the given channel
283
- * @param channel {number} usually 0-15: the channel to lock
284
- * @param isMuted {boolean} indicates if the channel is muted
285
- */
286
- muteChannel(channel: number, isMuted: boolean): void;
287
- /**
288
- * Reloads the sounfont.
289
- * THIS IS DEPRECATED!
290
- * USE soundfontManager INSTEAD
291
- * @param soundFontBuffer {ArrayBuffer} the new soundfont file array buffer
292
- * @return {Promise<void>}
293
- * @deprecated Use the soundfontManager property
294
- */
295
- reloadSoundFont(soundFontBuffer: ArrayBuffer): Promise<void>;
296
- /**
297
- * Sends a MIDI Sysex message to the synthesizer
298
- * @param messageData {number[]|ArrayLike|Uint8Array} the message's data
299
- * (excluding the F0 byte, but including the F7 at the end)
300
- */
301
- systemExclusive(messageData: number[] | ArrayLike<any> | Uint8Array): void;
302
- /**
303
- * Toggles drums on a given channel
304
- * @param channel {number}
305
- * @param isDrum {boolean}
306
- */
307
- setDrums(channel: number, isDrum: boolean): void;
308
- /**
309
- * sends a raw MIDI message to the synthesizer
310
- * @param message {number[]|Uint8Array} the midi message, each number is a byte
311
- * @param channelOffset {number} the channel offset of the message
312
- */
313
- sendMessage(message: number[] | Uint8Array, channelOffset?: number): void;
314
- /**
315
- * Updates the reverb processor with a new impulse response
316
- * @param buffer {AudioBuffer} the new reverb impulse response
317
- */
318
- setReverbResponse(buffer: AudioBuffer): void;
319
- /**
320
- * Updates the chorus processor parameters
321
- * @param config {ChorusConfig} the new chorus
322
- */
323
- setChorusConfig(config: ChorusConfig): void;
324
- /**
325
- * Changes the effects gain
326
- * @param reverbGain {number} the reverb gain, 0-1
327
- * @param chorusGain {number} the chorus gain, 0-1
328
- */
329
- setEffectsGain(reverbGain: number, chorusGain: number): void;
330
- /**
331
- * Destroys the synthesizer instance
332
- */
333
- destroy(): void;
334
- reverbateEverythingBecauseWhyNot(): string;
335
- }
336
- export type StartRenderingDataConfig = {
337
- /**
338
- * - the MIDI to render
339
- */
340
- parsedMIDI: BasicMIDI;
341
- /**
342
- * - the snapshot to apply
343
- */
344
- snapshot: SynthesizerSnapshot;
345
- /**
346
- * - if synth should use one output with 32 channels (2 audio channels for each midi channel).
347
- * this disabled chorus and reverb.
348
- */
349
- oneOutput: boolean | undefined;
350
- /**
351
- * - the times to loop the song
352
- */
353
- loopCount: number | undefined;
354
- };
355
- import { EventHandler } from "./synth_event_handler.js";
356
- import { SoundfontManager } from "./synth_soundfont_manager.js";
357
- import { KeyModifierManager } from "./key_modifier_manager.js";
358
- import { FancyChorus } from "./audio_effects/fancy_chorus.js";
@@ -1,98 +0,0 @@
1
- /**
2
- * * // NOTE: Every message needs a channel number (if not relevant or all, set to -1)
3
- */
4
- export type workletMessageType = number;
5
- export namespace workletMessageType {
6
- let noteOff: number;
7
- let noteOn: number;
8
- let ccChange: number;
9
- let programChange: number;
10
- let channelPressure: number;
11
- let polyPressure: number;
12
- let killNote: number;
13
- let ccReset: number;
14
- let setChannelVibrato: number;
15
- let soundFontManager: number;
16
- let stopAll: number;
17
- let killNotes: number;
18
- let muteChannel: number;
19
- let addNewChannel: number;
20
- let customcCcChange: number;
21
- let debugMessage: number;
22
- let systemExclusive: number;
23
- let setMasterParameter: number;
24
- let setDrums: number;
25
- let pitchWheel: number;
26
- let transpose: number;
27
- let highPerformanceMode: number;
28
- let lockController: number;
29
- let sequencerSpecific: number;
30
- let requestSynthesizerSnapshot: number;
31
- let setLogLevel: number;
32
- let keyModifierManager: number;
33
- let setEffectsGain: number;
34
- let destroyWorklet: number;
35
- }
36
- export type masterParameterType = number;
37
- export namespace masterParameterType {
38
- let mainVolume: number;
39
- let masterPan: number;
40
- let voicesCap: number;
41
- let interpolationType: number;
42
- }
43
- export const ALL_CHANNELS_OR_DIFFERENT_ACTION: -1;
44
- export type returnMessageType = number;
45
- export namespace returnMessageType {
46
- export let channelProperties: number;
47
- export let eventCall: number;
48
- export let reportedCurrentTime: number;
49
- let sequencerSpecific_1: number;
50
- export { sequencerSpecific_1 as sequencerSpecific };
51
- export let synthesizerSnapshot: number;
52
- export let ready: number;
53
- export let soundfontError: number;
54
- export let identify: number;
55
- }
56
- export type WorkletMessage = {
57
- channelNumber: number;
58
- messageType: workletMessageType;
59
- messageData: (number[] | boolean[] | WorkletVoice[] | number | {
60
- sampleData: Float32Array;
61
- sampleID: number;
62
- } | {
63
- rate: number;
64
- depth: number;
65
- delay: number;
66
- } | boolean | ArrayBuffer | {
67
- messageType: WorkletSequencerMessageType;
68
- messageData: any;
69
- } | {
70
- messageType: workletKeyModifierMessageType;
71
- messageData: any;
72
- });
73
- };
74
- export type WorkletReturnMessage = {
75
- /**
76
- * - the message's type
77
- */
78
- messageType: returnMessageType;
79
- /**
80
- * - the message's data
81
- *
82
- * 0 - channel properties -> [...<ChannelProperty>] see message_sending.js line 29
83
- * 1 - event call -> {eventName<string>, eventData:<the event's data>}
84
- * 2 - reported current time -> currentTime<number>
85
- * 3 - sequencer specific -> [messageType<WorkletSequencerReturnMessageType> messageData<any>] note: refer to sequencer_message.js
86
- * 4 - synthesizer snapshot -> snapshot<SynthesizerSnapshot> note: refer to snapshot.js
87
- * 5 - ready -> (no data)
88
- * 6 - soundfontError -> errorMessage<string>
89
- * 7 - idenfity -> version<string>
90
- */
91
- messageData: {
92
- eventName: string;
93
- eventData: any;
94
- } | ChannelProperty[] | PresetListElement[] | string | {
95
- messageType: WorkletSequencerReturnMessageType;
96
- messageData: any;
97
- } | SynthesizerSnapshot | [WorkletSoundfontManagerMessageType, any];
98
- };
@@ -1,77 +0,0 @@
1
- export class KeyModifier {
2
- /**
3
- * @param velocity {number}
4
- * @param bank {number}
5
- * @param program {number}
6
- */
7
- constructor(velocity?: number, bank?: number, program?: number);
8
- /**
9
- * The new override velocity. -1 means unchanged
10
- * @type {number}
11
- */
12
- velocity: number;
13
- /**
14
- * The patch this key uses. -1 on either means default
15
- * @type {{bank: number, program: number}}
16
- */
17
- patch: {
18
- bank: number;
19
- program: number;
20
- };
21
- }
22
- export type workletKeyModifierMessageType = number;
23
- export namespace workletKeyModifierMessageType {
24
- let addMapping: number;
25
- let deleteMapping: number;
26
- let clearMappings: number;
27
- }
28
- export class WorkletKeyModifierManager {
29
- /**
30
- * The velocity override mappings for MIDI keys
31
- * @type {KeyModifier[][]}
32
- * @private
33
- */
34
- private _keyMappings;
35
- /**
36
- * @param type {workletKeyModifierMessageType}
37
- * @param data {any}
38
- */
39
- handleMessage(type: workletKeyModifierMessageType, data: any): void;
40
- /**
41
- * @param channel {number}
42
- * @param midiNote {number}
43
- * @param mapping {KeyModifier}
44
- */
45
- addMapping(channel: number, midiNote: number, mapping: KeyModifier): void;
46
- deleteMapping(channel: any, midiNote: any): void;
47
- clearMappings(): void;
48
- /**
49
- * @param mappings {KeyModifier[][]}
50
- */
51
- setMappings(mappings: KeyModifier[][]): void;
52
- /**
53
- * @returns {KeyModifier[][]}
54
- */
55
- getMappings(): KeyModifier[][];
56
- /**
57
- * @param channel {number}
58
- * @param midiNote {number}
59
- * @returns {number} velocity, -1 if unchanged
60
- */
61
- getVelocity(channel: number, midiNote: number): number;
62
- /**
63
- * @param channel {number}
64
- * @param midiNote {number}
65
- * @returns {boolean}
66
- */
67
- hasOverridePatch(channel: number, midiNote: number): boolean;
68
- /**
69
- * @param channel {number}
70
- * @param midiNote {number}
71
- * @returns {{bank: number, program: number}} -1 if unchanged
72
- */
73
- getPatch(channel: number, midiNote: number): {
74
- bank: number;
75
- program: number;
76
- };
77
- }
@@ -1,7 +0,0 @@
1
- export type WorkletSoundfontManagerMessageType = number;
2
- export namespace WorkletSoundfontManagerMessageType {
3
- let reloadSoundFont: number;
4
- let addNewSoundFont: number;
5
- let deleteSoundFont: number;
6
- let rearrangeSoundFonts: number;
7
- }
@@ -1,23 +0,0 @@
1
- export const NON_CC_INDEX_OFFSET: 128;
2
- export const CONTROLLER_TABLE_SIZE: 147;
3
- export const resetArray: Int16Array<ArrayBuffer>;
4
- export function setResetValue(i: any, v: any): number;
5
- export namespace customControllers {
6
- let channelTuning: number;
7
- let channelTransposeFine: number;
8
- let modulationMultiplier: number;
9
- let masterTuning: number;
10
- let channelTuningSemitones: number;
11
- }
12
- export const CUSTOM_CONTROLLER_TABLE_SIZE: number;
13
- export const customResetArray: Float32Array<ArrayBuffer>;
14
- export type dataEntryStates = number;
15
- export namespace dataEntryStates {
16
- let Idle: number;
17
- let RPCoarse: number;
18
- let RPFine: number;
19
- let NRPCoarse: number;
20
- let NRPFine: number;
21
- let DataCoarse: number;
22
- let DataFine: number;
23
- }