spessasynth_lib 3.27.8 → 4.0.1
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/README.md +48 -47
- package/dist/index.d.ts +1328 -0
- package/dist/index.js +3212 -0
- package/dist/index.js.map +1 -0
- package/dist/spessasynth_processor.min.js +21 -0
- package/dist/spessasynth_processor.min.js.map +7 -0
- package/package.json +26 -14
- package/index.js +0 -29
- package/src/external_midi/README.md +0 -4
- package/src/external_midi/midi_handler.js +0 -130
- package/src/external_midi/web_midi_link.js +0 -43
- package/src/sequencer/README.md +0 -30
- package/src/sequencer/default_sequencer_options.js +0 -9
- package/src/sequencer/midi_data.js +0 -67
- package/src/sequencer/sequencer.js +0 -813
- package/src/sequencer/sequencer_message.js +0 -53
- package/src/synthetizer/README.md +0 -30
- package/src/synthetizer/audio_effects/effects_config.js +0 -25
- package/src/synthetizer/audio_effects/fancy_chorus.js +0 -166
- package/src/synthetizer/audio_effects/rb_compressed.min.js +0 -1
- package/src/synthetizer/audio_effects/reverb.js +0 -35
- package/src/synthetizer/audio_effects/reverb_as_binary.js +0 -18
- package/src/synthetizer/key_modifier_manager.js +0 -113
- package/src/synthetizer/sfman_message.js +0 -9
- package/src/synthetizer/synth_event_handler.js +0 -217
- package/src/synthetizer/synth_soundfont_manager.js +0 -115
- package/src/synthetizer/synthetizer.js +0 -1033
- package/src/synthetizer/worklet_message.js +0 -121
- package/src/synthetizer/worklet_processor.js +0 -654
- package/src/synthetizer/worklet_url.js +0 -18
- package/src/utils/buffer_to_wav.js +0 -40
- package/src/utils/fill_with_defaults.js +0 -21
- package/src/utils/other.js +0 -11
- package/synthetizer/worklet_processor.min.js +0 -22
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1328 @@
|
|
|
1
|
+
import { BasicMIDI, MIDITrack, MIDIMessage, SequencerEvent, SpessaSynthProcessor, SpessaSynthSequencer, SynthProcessorOptions, BasicSoundBank, SoundFont2WriteOptions, DLSWriteOptions, RMIDIWriteOptions, SynthesizerSnapshot, SynthMethodOptions, CustomController, MIDIController, MasterParameterType, KeyModifier, SynthProcessorEvent, MIDIPatch, SoundBankManagerListEntry, SynthProcessorEventData, ChannelSnapshot, ChannelProperty, PresetList, WaveWriteOptions } from 'spessasynth_core';
|
|
2
|
+
|
|
3
|
+
declare const songChangeType: {
|
|
4
|
+
readonly shuffleOn: 1;
|
|
5
|
+
readonly shuffleOff: 2;
|
|
6
|
+
readonly index: 3;
|
|
7
|
+
};
|
|
8
|
+
type SongChangeType = (typeof songChangeType)[keyof typeof songChangeType];
|
|
9
|
+
|
|
10
|
+
declare class MIDIDataTrack extends MIDITrack {
|
|
11
|
+
/**
|
|
12
|
+
* THIS DATA WILL BE EMPTY! USE sequencer.getMIDI() TO GET THE ACTUAL DATA!
|
|
13
|
+
*/
|
|
14
|
+
events: never[];
|
|
15
|
+
constructor(track: MIDITrack);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A simplified version of the MIDI, accessible at all times from the Sequencer.
|
|
19
|
+
* Use getMIDI() to get the actual sequence.
|
|
20
|
+
* This class contains all properties that MIDI does, except for tracks and the embedded sound bank.
|
|
21
|
+
*/
|
|
22
|
+
declare class MIDIData extends BasicMIDI {
|
|
23
|
+
tracks: MIDIDataTrack[];
|
|
24
|
+
/**
|
|
25
|
+
* THIS DATA WILL BE EMPTY! USE sequencer.getMIDI() TO GET THE ACTUAL DATA!
|
|
26
|
+
*/
|
|
27
|
+
embeddedSoundBank: undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The byte length of the sound bank if it exists.
|
|
30
|
+
*/
|
|
31
|
+
readonly embeddedSoundBankSize?: number;
|
|
32
|
+
constructor(mid: BasicMIDI);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface SequencerOptions {
|
|
36
|
+
/**
|
|
37
|
+
* If true, the sequencer will skip to the first note.
|
|
38
|
+
*/
|
|
39
|
+
skipToFirstNoteOn: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The initial playback rate, defaults to 1.0 (normal speed).
|
|
42
|
+
*/
|
|
43
|
+
initialPlaybackRate: number;
|
|
44
|
+
}
|
|
45
|
+
type SequencerMessage = {
|
|
46
|
+
[K in keyof SequencerMessageData]: {
|
|
47
|
+
type: K;
|
|
48
|
+
data: SequencerMessageData[K];
|
|
49
|
+
};
|
|
50
|
+
}[keyof SequencerMessageData];
|
|
51
|
+
interface SequencerMessageData {
|
|
52
|
+
loadNewSongList: SuppliedMIDIData[];
|
|
53
|
+
pause: null;
|
|
54
|
+
play: null;
|
|
55
|
+
setTime: number;
|
|
56
|
+
changeMIDIMessageSending: boolean;
|
|
57
|
+
setPlaybackRate: number;
|
|
58
|
+
setLoopCount: number;
|
|
59
|
+
changeSong: {
|
|
60
|
+
changeType: SongChangeType;
|
|
61
|
+
data?: number;
|
|
62
|
+
};
|
|
63
|
+
getMIDI: null;
|
|
64
|
+
setSkipToFirstNote: boolean;
|
|
65
|
+
}
|
|
66
|
+
type SequencerReturnMessage = SequencerEvent | {
|
|
67
|
+
type: "getMIDI";
|
|
68
|
+
data: BasicMIDI;
|
|
69
|
+
} | {
|
|
70
|
+
type: "midiError";
|
|
71
|
+
data: Error;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Sequencer.js
|
|
75
|
+
* purpose: plays back the midi file decoded by midi_loader.js, including support for multichannel midis
|
|
76
|
+
* (adding channels when more than one midi port is detected)
|
|
77
|
+
* note: this is the sequencer class that runs on the main thread
|
|
78
|
+
* and only communicates with the worklet sequencer which does the actual playback
|
|
79
|
+
*/
|
|
80
|
+
type SuppliedMIDIData = BasicMIDI | {
|
|
81
|
+
/**
|
|
82
|
+
* The binary data of the file.
|
|
83
|
+
*/
|
|
84
|
+
binary: ArrayBuffer;
|
|
85
|
+
/**
|
|
86
|
+
* The file name of this file as a fallback.
|
|
87
|
+
*/
|
|
88
|
+
fileName?: string;
|
|
89
|
+
};
|
|
90
|
+
interface WorkletSequencerEventType {
|
|
91
|
+
/**
|
|
92
|
+
* New song.
|
|
93
|
+
*/
|
|
94
|
+
songChange: MIDIData;
|
|
95
|
+
/**
|
|
96
|
+
* New time.
|
|
97
|
+
*/
|
|
98
|
+
timeChange: number;
|
|
99
|
+
/**
|
|
100
|
+
* No data.
|
|
101
|
+
*/
|
|
102
|
+
songEnded: null;
|
|
103
|
+
metaEvent: {
|
|
104
|
+
event: MIDIMessage;
|
|
105
|
+
trackNumber: number;
|
|
106
|
+
};
|
|
107
|
+
textEvent: {
|
|
108
|
+
/**
|
|
109
|
+
* The raw event.
|
|
110
|
+
*/
|
|
111
|
+
event: MIDIMessage;
|
|
112
|
+
/**
|
|
113
|
+
* If the text is a lyric, the index of the lyric in BasicMIDI's "lyrics" property, otherwise -1.
|
|
114
|
+
*/
|
|
115
|
+
lyricsIndex: number;
|
|
116
|
+
};
|
|
117
|
+
midiError: Error;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
type PostMessageSynthCore = (data: BasicSynthesizerReturnMessage, transfer?: Transferable[]) => unknown;
|
|
121
|
+
/**
|
|
122
|
+
* The interface for the audio processing code that uses spessasynth_core and runs on a separate thread.
|
|
123
|
+
*/
|
|
124
|
+
declare abstract class BasicSynthesizerCore {
|
|
125
|
+
readonly synthesizer: SpessaSynthProcessor;
|
|
126
|
+
readonly sequencer: SpessaSynthSequencer;
|
|
127
|
+
protected readonly post: PostMessageSynthCore;
|
|
128
|
+
/**
|
|
129
|
+
* Indicates if the processor is alive.
|
|
130
|
+
* @protected
|
|
131
|
+
*/
|
|
132
|
+
protected alive: boolean;
|
|
133
|
+
protected constructor(sampleRate: number, options: SynthProcessorOptions, postMessage: PostMessageSynthCore);
|
|
134
|
+
protected postReady<K extends keyof SynthesizerReturn>(type: K, data: SynthesizerReturn[K], transferable?: Transferable[]): void;
|
|
135
|
+
protected postProgress<K extends keyof SynthesizerProgress>(type: K, data: SynthesizerProgress[K]): void;
|
|
136
|
+
protected destroy(): void;
|
|
137
|
+
protected handleMessage(m: BasicSynthesizerMessage): void;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare class WorkerSynthesizerCore extends BasicSynthesizerCore {
|
|
141
|
+
/**
|
|
142
|
+
* The message port to the playback audio worklet.
|
|
143
|
+
*/
|
|
144
|
+
readonly workletMessagePort: MessagePort;
|
|
145
|
+
protected readonly compressionFunction?: WorkerSampleEncodingFunction;
|
|
146
|
+
/**
|
|
147
|
+
* Creates a new worker synthesizer core: the synthesizer that runs in the worker.
|
|
148
|
+
* Most parameters here are provided with the first message that is posted to the worker by the WorkerSynthesizer.
|
|
149
|
+
* @param synthesizerConfiguration The data from the first message sent from WorkerSynthesizer.
|
|
150
|
+
* Listen for the first event and use its data to initialize this class.
|
|
151
|
+
* @param workletMessagePort The first port from the first message sent from WorkerSynthesizer.
|
|
152
|
+
* @param mainThreadCallback postMessage function or similar.
|
|
153
|
+
* @param compressionFunction Optional function for compressing SF3 banks.
|
|
154
|
+
*/
|
|
155
|
+
constructor(synthesizerConfiguration: {
|
|
156
|
+
sampleRate: number;
|
|
157
|
+
initialTime: number;
|
|
158
|
+
}, workletMessagePort: MessagePort, mainThreadCallback: typeof Worker.prototype.postMessage, compressionFunction?: WorkerSampleEncodingFunction);
|
|
159
|
+
/**
|
|
160
|
+
* Handles a message received from the main thread.
|
|
161
|
+
* @param m The message received.
|
|
162
|
+
*/
|
|
163
|
+
handleMessage(m: BasicSynthesizerMessage): void;
|
|
164
|
+
protected getBank(opts: WorkerBankWriteOptions): BasicSoundBank;
|
|
165
|
+
protected stopAudioLoop(): void;
|
|
166
|
+
protected startAudioLoop(): void;
|
|
167
|
+
protected destroy(): void;
|
|
168
|
+
protected renderAndSendChunk(): void;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
interface WorkerRenderAudioOptions {
|
|
172
|
+
/**
|
|
173
|
+
* Extra fadeout time after the song finishes, in seconds.
|
|
174
|
+
*/
|
|
175
|
+
extraTime: number;
|
|
176
|
+
/**
|
|
177
|
+
* If channels should be rendered separately.
|
|
178
|
+
*/
|
|
179
|
+
separateChannels: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* The amount of times to loop the song.
|
|
182
|
+
*/
|
|
183
|
+
loopCount: number;
|
|
184
|
+
/**
|
|
185
|
+
* The function that tracks the rendering progress.
|
|
186
|
+
* @param progress mapped 0 to 1.
|
|
187
|
+
* @param stage 0 is a dry pass, 1 is adding effects.
|
|
188
|
+
*/
|
|
189
|
+
progressCallback?: (progress: number, stage: number) => unknown;
|
|
190
|
+
/**
|
|
191
|
+
* If the current parameters of the synthesizer should be preserved.
|
|
192
|
+
*/
|
|
193
|
+
preserveSynthParams: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* If the effects should be enabled.
|
|
196
|
+
*/
|
|
197
|
+
enableEffects: boolean;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
interface PassedProcessorParameters {
|
|
201
|
+
/**
|
|
202
|
+
* If the synthesizer should send events.
|
|
203
|
+
*/
|
|
204
|
+
enableEventSystem: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* If the synth should use one output with 32 channels (2 audio channels for each midi channel).
|
|
207
|
+
*/
|
|
208
|
+
oneOutput: boolean;
|
|
209
|
+
}
|
|
210
|
+
interface OfflineRenderWorkletData {
|
|
211
|
+
/**
|
|
212
|
+
* The MIDI to render.
|
|
213
|
+
*/
|
|
214
|
+
midiSequence: BasicMIDI;
|
|
215
|
+
/**
|
|
216
|
+
* The snapshot to apply.
|
|
217
|
+
*/
|
|
218
|
+
snapshot?: SynthesizerSnapshot;
|
|
219
|
+
/**
|
|
220
|
+
* The amount times to loop the song.
|
|
221
|
+
*/
|
|
222
|
+
loopCount: number;
|
|
223
|
+
/**
|
|
224
|
+
* The list of sound banks to render this file with.
|
|
225
|
+
*/
|
|
226
|
+
soundBankList: {
|
|
227
|
+
bankOffset: number;
|
|
228
|
+
soundBankBuffer: ArrayBuffer;
|
|
229
|
+
}[];
|
|
230
|
+
/**
|
|
231
|
+
* The options to pass to the sequencer.
|
|
232
|
+
*/
|
|
233
|
+
sequencerOptions: Partial<SequencerOptions>;
|
|
234
|
+
}
|
|
235
|
+
interface WorkletSBKManagerData {
|
|
236
|
+
addSoundBank: {
|
|
237
|
+
soundBankBuffer: ArrayBuffer;
|
|
238
|
+
id: string;
|
|
239
|
+
bankOffset: number;
|
|
240
|
+
};
|
|
241
|
+
deleteSoundBank: string;
|
|
242
|
+
rearrangeSoundBanks: string[];
|
|
243
|
+
}
|
|
244
|
+
interface WorkletKMManagerData {
|
|
245
|
+
addMapping: {
|
|
246
|
+
channel: number;
|
|
247
|
+
midiNote: number;
|
|
248
|
+
mapping: KeyModifier;
|
|
249
|
+
};
|
|
250
|
+
deleteMapping: {
|
|
251
|
+
channel: number;
|
|
252
|
+
midiNote: number;
|
|
253
|
+
};
|
|
254
|
+
clearMappings: null;
|
|
255
|
+
}
|
|
256
|
+
type BasicSynthesizerMessage = {
|
|
257
|
+
[K in keyof BasicSynthesizerMessageData]: {
|
|
258
|
+
channelNumber: number;
|
|
259
|
+
type: K;
|
|
260
|
+
data: BasicSynthesizerMessageData[K];
|
|
261
|
+
};
|
|
262
|
+
}[keyof BasicSynthesizerMessageData];
|
|
263
|
+
interface WorkerBankWriteOptions {
|
|
264
|
+
/**
|
|
265
|
+
* Trim the sound bank to only include samples used in the current MIDI file.
|
|
266
|
+
*/
|
|
267
|
+
trim: boolean;
|
|
268
|
+
/**
|
|
269
|
+
* The sound bank ID in the sound bank manager to write.
|
|
270
|
+
*/
|
|
271
|
+
bankID: string;
|
|
272
|
+
/**
|
|
273
|
+
* If the embedded sound bank should be written instead if it exists.
|
|
274
|
+
*/
|
|
275
|
+
writeEmbeddedSoundBank: boolean;
|
|
276
|
+
}
|
|
277
|
+
type WorkerDLSWriteOptions = Omit<DLSWriteOptions, "progressFunction"> & WorkerBankWriteOptions;
|
|
278
|
+
type WorkerSoundFont2WriteOptions = Omit<SoundFont2WriteOptions, "compressionFunction" | "progressFunction"> & WorkerBankWriteOptions & {
|
|
279
|
+
/**
|
|
280
|
+
* The compression quality to call your provided compressionFunction with, if compressing.
|
|
281
|
+
*/
|
|
282
|
+
compressionQuality: number;
|
|
283
|
+
};
|
|
284
|
+
type WorkerSampleEncodingFunction = (audioData: Float32Array, sampleRate: number, quality: number) => Promise<Uint8Array>;
|
|
285
|
+
type WorkerRMIDIWriteOptions = Omit<RMIDIWriteOptions, "soundBank"> & (({
|
|
286
|
+
format: "sf2";
|
|
287
|
+
} & WorkerSoundFont2WriteOptions) | ({
|
|
288
|
+
format: "dls";
|
|
289
|
+
} & WorkerDLSWriteOptions));
|
|
290
|
+
interface BasicSynthesizerMessageData {
|
|
291
|
+
workerInitialization: {
|
|
292
|
+
sampleRate: number;
|
|
293
|
+
currentTime: number;
|
|
294
|
+
};
|
|
295
|
+
renderAudio: {
|
|
296
|
+
sampleRate: number;
|
|
297
|
+
options: WorkerRenderAudioOptions;
|
|
298
|
+
};
|
|
299
|
+
writeSF2: WorkerSoundFont2WriteOptions;
|
|
300
|
+
writeDLS: WorkerDLSWriteOptions;
|
|
301
|
+
writeRMIDI: WorkerRMIDIWriteOptions;
|
|
302
|
+
startOfflineRender: OfflineRenderWorkletData;
|
|
303
|
+
midiMessage: {
|
|
304
|
+
messageData: Uint8Array;
|
|
305
|
+
channelOffset: number;
|
|
306
|
+
force: boolean;
|
|
307
|
+
options: SynthMethodOptions;
|
|
308
|
+
};
|
|
309
|
+
ccReset: null;
|
|
310
|
+
setChannelVibrato: {
|
|
311
|
+
rate: number;
|
|
312
|
+
depth: number;
|
|
313
|
+
delay: number;
|
|
314
|
+
};
|
|
315
|
+
stopAll: number;
|
|
316
|
+
killNotes: number;
|
|
317
|
+
muteChannel: boolean;
|
|
318
|
+
addNewChannel: null;
|
|
319
|
+
customCcChange: {
|
|
320
|
+
ccNumber: CustomController;
|
|
321
|
+
ccValue: number;
|
|
322
|
+
};
|
|
323
|
+
transposeChannel: {
|
|
324
|
+
semitones: number;
|
|
325
|
+
force: boolean;
|
|
326
|
+
};
|
|
327
|
+
setDrums: boolean;
|
|
328
|
+
lockController: {
|
|
329
|
+
controllerNumber: MIDIController | -1;
|
|
330
|
+
isLocked: boolean;
|
|
331
|
+
};
|
|
332
|
+
sequencerSpecific: SequencerMessage;
|
|
333
|
+
requestSynthesizerSnapshot: null;
|
|
334
|
+
setLogLevel: {
|
|
335
|
+
enableInfo: boolean;
|
|
336
|
+
enableWarning: boolean;
|
|
337
|
+
enableGroup: boolean;
|
|
338
|
+
};
|
|
339
|
+
setMasterParameter: {
|
|
340
|
+
[K in keyof MasterParameterType]: {
|
|
341
|
+
type: K;
|
|
342
|
+
data: MasterParameterType[K];
|
|
343
|
+
};
|
|
344
|
+
}[keyof MasterParameterType];
|
|
345
|
+
soundBankManager: {
|
|
346
|
+
[K in keyof WorkletSBKManagerData]: {
|
|
347
|
+
type: K;
|
|
348
|
+
data: WorkletSBKManagerData[K];
|
|
349
|
+
};
|
|
350
|
+
}[keyof WorkletSBKManagerData];
|
|
351
|
+
keyModifierManager: {
|
|
352
|
+
[K in keyof WorkletKMManagerData]: {
|
|
353
|
+
type: K;
|
|
354
|
+
data: WorkletKMManagerData[K];
|
|
355
|
+
};
|
|
356
|
+
}[keyof WorkletKMManagerData];
|
|
357
|
+
destroyWorklet: null;
|
|
358
|
+
}
|
|
359
|
+
interface BasicSynthesizerReturnMessageData {
|
|
360
|
+
eventCall: SynthProcessorEvent;
|
|
361
|
+
sequencerReturn: SequencerReturnMessage;
|
|
362
|
+
isFullyInitialized: {
|
|
363
|
+
[K in keyof SynthesizerReturn]: {
|
|
364
|
+
type: K;
|
|
365
|
+
data: SynthesizerReturn[K];
|
|
366
|
+
};
|
|
367
|
+
}[keyof SynthesizerReturn];
|
|
368
|
+
soundBankError: Error;
|
|
369
|
+
renderingProgress: {
|
|
370
|
+
[K in keyof SynthesizerProgress]: {
|
|
371
|
+
type: K;
|
|
372
|
+
data: SynthesizerProgress[K];
|
|
373
|
+
};
|
|
374
|
+
}[keyof SynthesizerProgress];
|
|
375
|
+
}
|
|
376
|
+
type BasicSynthesizerReturnMessage = {
|
|
377
|
+
[K in keyof BasicSynthesizerReturnMessageData]: {
|
|
378
|
+
type: K;
|
|
379
|
+
data: BasicSynthesizerReturnMessageData[K];
|
|
380
|
+
currentTime: number;
|
|
381
|
+
};
|
|
382
|
+
}[keyof BasicSynthesizerReturnMessageData];
|
|
383
|
+
interface SynthesizerProgress {
|
|
384
|
+
renderAudio: number;
|
|
385
|
+
workerSynthWriteFile: {
|
|
386
|
+
sampleName: string;
|
|
387
|
+
sampleIndex: number;
|
|
388
|
+
sampleCount: number;
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
interface SynthesizerReturn {
|
|
392
|
+
sf3Decoder: null;
|
|
393
|
+
soundBankManager: null;
|
|
394
|
+
startOfflineRender: null;
|
|
395
|
+
synthesizerSnapshot: SynthesizerSnapshot;
|
|
396
|
+
renderAudio: {
|
|
397
|
+
reverb: [Float32Array, Float32Array];
|
|
398
|
+
chorus: [Float32Array, Float32Array];
|
|
399
|
+
dry: [Float32Array, Float32Array][];
|
|
400
|
+
};
|
|
401
|
+
workerSynthWriteFile: {
|
|
402
|
+
/**
|
|
403
|
+
* The binary data of the file.
|
|
404
|
+
*/
|
|
405
|
+
binary: ArrayBuffer;
|
|
406
|
+
/**
|
|
407
|
+
* The suggested name of the file.
|
|
408
|
+
*/
|
|
409
|
+
fileName: string;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
interface SynthConfig {
|
|
414
|
+
/**
|
|
415
|
+
* If the synth should use one output with 32 channels (2 audio channels for each midi channel).
|
|
416
|
+
*/
|
|
417
|
+
oneOutput: boolean;
|
|
418
|
+
/**
|
|
419
|
+
* If the chorus processor should be initialized during creation.
|
|
420
|
+
* Note that setting this to false will not allow it to be used later.
|
|
421
|
+
* If you want to enable it at some point, set this to true and set the chorus gain to 0.
|
|
422
|
+
*/
|
|
423
|
+
initializeChorusProcessor: boolean;
|
|
424
|
+
/**
|
|
425
|
+
* If the reverb processor should be initialized during creation.
|
|
426
|
+
* Note that setting this to false will not allow it to be used later.
|
|
427
|
+
* If you want to enable it at some point, set this to true and set the reverb gain to 0.
|
|
428
|
+
*/
|
|
429
|
+
initializeReverbProcessor: boolean;
|
|
430
|
+
/**
|
|
431
|
+
* Custom audio node creation functions for Web Audio wrappers, such as standardized-audio-context.
|
|
432
|
+
* Pass undefined to use the Web Audio API.
|
|
433
|
+
*/
|
|
434
|
+
audioNodeCreators?: AudioNodeCreators;
|
|
435
|
+
/**
|
|
436
|
+
* If the event system should be enabled. This can only be set once.
|
|
437
|
+
*/
|
|
438
|
+
enableEventSystem: boolean;
|
|
439
|
+
}
|
|
440
|
+
interface BasicEffectConfig {
|
|
441
|
+
null?: null;
|
|
442
|
+
}
|
|
443
|
+
interface AudioNodeCreators {
|
|
444
|
+
/**
|
|
445
|
+
* A custom creator for an AudioWorkletNode.
|
|
446
|
+
* @param context
|
|
447
|
+
* @param workletName
|
|
448
|
+
* @param options
|
|
449
|
+
*/
|
|
450
|
+
worklet: (context: BaseAudioContext, workletName: string, options?: AudioWorkletNodeOptions & {
|
|
451
|
+
processorOptions: PassedProcessorParameters;
|
|
452
|
+
}) => AudioWorkletNode;
|
|
453
|
+
}
|
|
454
|
+
interface ReverbConfig extends BasicEffectConfig {
|
|
455
|
+
/**
|
|
456
|
+
* The impulse response for the reverb. Pass undefined to use default one.
|
|
457
|
+
*/
|
|
458
|
+
impulseResponse?: AudioBuffer;
|
|
459
|
+
}
|
|
460
|
+
interface ChorusConfig extends BasicEffectConfig {
|
|
461
|
+
/**
|
|
462
|
+
* The amount of delay nodes (for each channel) and the corresponding oscillators.
|
|
463
|
+
*/
|
|
464
|
+
nodesAmount: number;
|
|
465
|
+
/**
|
|
466
|
+
* The initial delay, in seconds.
|
|
467
|
+
*/
|
|
468
|
+
defaultDelay: number;
|
|
469
|
+
/**
|
|
470
|
+
* The difference between delays in the delay nodes.
|
|
471
|
+
*/
|
|
472
|
+
delayVariation: number;
|
|
473
|
+
/**
|
|
474
|
+
* The difference of delays between two channels (added to the right channel).
|
|
475
|
+
*/
|
|
476
|
+
stereoDifference: number;
|
|
477
|
+
/**
|
|
478
|
+
* The initial delay time oscillator frequency, in Hz.
|
|
479
|
+
*/
|
|
480
|
+
oscillatorFrequency: number;
|
|
481
|
+
/**
|
|
482
|
+
* The difference between frequencies of oscillators, in Hz.
|
|
483
|
+
*/
|
|
484
|
+
oscillatorFrequencyVariation: number;
|
|
485
|
+
/**
|
|
486
|
+
* How much will oscillator alter the delay in delay nodes, in seconds.
|
|
487
|
+
*/
|
|
488
|
+
oscillatorGain: number;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
declare class WorkletKeyModifierManagerWrapper {
|
|
492
|
+
private keyModifiers;
|
|
493
|
+
private synth;
|
|
494
|
+
constructor(synth: BasicSynthesizer);
|
|
495
|
+
/**
|
|
496
|
+
* Modifies a single key.
|
|
497
|
+
* @param channel The channel affected. Usually 0-15.
|
|
498
|
+
* @param midiNote The MIDI note to change. 0-127.
|
|
499
|
+
* @param options The key's modifiers.
|
|
500
|
+
*/
|
|
501
|
+
addModifier(channel: number, midiNote: number, options: Partial<{
|
|
502
|
+
velocity: number;
|
|
503
|
+
patch: MIDIPatch;
|
|
504
|
+
gain: number;
|
|
505
|
+
}>): void;
|
|
506
|
+
/**
|
|
507
|
+
* Gets a key modifier.
|
|
508
|
+
* @param channel The channel affected. Usually 0-15.
|
|
509
|
+
* @param midiNote The MIDI note to change. 0-127.
|
|
510
|
+
* @returns The key modifier if it exists.
|
|
511
|
+
*/
|
|
512
|
+
getModifier(channel: number, midiNote: number): KeyModifier | undefined;
|
|
513
|
+
/**
|
|
514
|
+
* Deletes a key modifier.
|
|
515
|
+
* @param channel The channel affected. Usually 0-15.
|
|
516
|
+
* @param midiNote The MIDI note to change. 0-127.
|
|
517
|
+
*/
|
|
518
|
+
deleteModifier(channel: number, midiNote: number): void;
|
|
519
|
+
/**
|
|
520
|
+
* Clears ALL Modifiers
|
|
521
|
+
*/
|
|
522
|
+
clearModifiers(): void;
|
|
523
|
+
private sendToWorklet;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
type LibSBKManagerEntry = Omit<SoundBankManagerListEntry, "soundBank">;
|
|
527
|
+
declare class SoundBankManager {
|
|
528
|
+
/**
|
|
529
|
+
* All the sound banks, ordered from the most important to the least.
|
|
530
|
+
*/
|
|
531
|
+
soundBankList: LibSBKManagerEntry[];
|
|
532
|
+
private synth;
|
|
533
|
+
/**
|
|
534
|
+
* Creates a new instance of the sound bank manager.
|
|
535
|
+
*/
|
|
536
|
+
constructor(synth: BasicSynthesizer);
|
|
537
|
+
/**
|
|
538
|
+
* The current sound bank priority order.
|
|
539
|
+
* @returns The IDs of the sound banks in the current order.
|
|
540
|
+
*/
|
|
541
|
+
get priorityOrder(): string[];
|
|
542
|
+
/**
|
|
543
|
+
* Rearranges the sound banks in a given order.
|
|
544
|
+
* @param newList The order of sound banks, a list of identifiers, first overwrites second.
|
|
545
|
+
*/
|
|
546
|
+
set priorityOrder(newList: string[]);
|
|
547
|
+
/**
|
|
548
|
+
* Adds a new sound bank buffer with a given ID.
|
|
549
|
+
* @param soundBankBuffer The sound bank's buffer
|
|
550
|
+
* @param id The sound bank's unique identifier.
|
|
551
|
+
* @param bankOffset The sound bank's bank offset. Default is 0.
|
|
552
|
+
*/
|
|
553
|
+
addSoundBank(soundBankBuffer: ArrayBuffer, id: string, bankOffset?: number): Promise<void>;
|
|
554
|
+
/**
|
|
555
|
+
* Deletes a sound bank with the given ID.
|
|
556
|
+
* @param id The sound bank to delete.
|
|
557
|
+
*/
|
|
558
|
+
deleteSoundBank(id: string): Promise<void>;
|
|
559
|
+
private awaitResponse;
|
|
560
|
+
private sendToWorklet;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
type ProcessorEventCallback<T extends keyof SynthProcessorEventData> = (callbackData: SynthProcessorEventData[T]) => unknown;
|
|
564
|
+
declare class SynthEventHandler {
|
|
565
|
+
/**
|
|
566
|
+
* The time delay before an event is called.
|
|
567
|
+
* Set to 0 to disable it.
|
|
568
|
+
*/
|
|
569
|
+
timeDelay: number;
|
|
570
|
+
/**
|
|
571
|
+
* The main list of events.
|
|
572
|
+
* @private
|
|
573
|
+
*/
|
|
574
|
+
private readonly events;
|
|
575
|
+
/**
|
|
576
|
+
* Adds a new event listener.
|
|
577
|
+
* @param event The event to listen to.
|
|
578
|
+
* @param id The unique identifier for the event. It can be used to overwrite existing callback with the same ID.
|
|
579
|
+
* @param callback The callback for the event.
|
|
580
|
+
*/
|
|
581
|
+
addEvent<T extends keyof SynthProcessorEventData>(event: T, id: string, callback: ProcessorEventCallback<T>): void;
|
|
582
|
+
/**
|
|
583
|
+
* Removes an event listener
|
|
584
|
+
* @param name The event to remove a listener from.
|
|
585
|
+
* @param id The unique identifier for the event to remove.
|
|
586
|
+
*/
|
|
587
|
+
removeEvent<T extends keyof SynthProcessorEventData>(name: T, id: string): void;
|
|
588
|
+
/**
|
|
589
|
+
* Calls the given event.
|
|
590
|
+
* INTERNAL USE ONLY!
|
|
591
|
+
*/
|
|
592
|
+
callEventInternal<T extends keyof SynthProcessorEventData>(name: T, eventData: SynthProcessorEventData[T]): void;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
declare abstract class BasicEffectsProcessor {
|
|
596
|
+
readonly input: AudioNode;
|
|
597
|
+
protected readonly output: AudioNode;
|
|
598
|
+
protected constructor(input: AudioNode, output: AudioNode);
|
|
599
|
+
abstract get config(): BasicEffectConfig;
|
|
600
|
+
abstract update(config: BasicEffectConfig): void;
|
|
601
|
+
/**
|
|
602
|
+
* Connects the processor to a given node.
|
|
603
|
+
* @param destinationNode The node to connect to.
|
|
604
|
+
*/
|
|
605
|
+
connect(destinationNode: AudioNode): AudioNode;
|
|
606
|
+
/**
|
|
607
|
+
* Disconnects the processor from a given node.
|
|
608
|
+
* @param destinationNode The node to disconnect from.
|
|
609
|
+
*/
|
|
610
|
+
disconnect(destinationNode?: AudioNode): void;
|
|
611
|
+
/**
|
|
612
|
+
* Disconnects the effect processor.
|
|
613
|
+
*/
|
|
614
|
+
delete(): void;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Fancy_chorus.js
|
|
619
|
+
* purpose: creates a simple chorus effect node
|
|
620
|
+
*/
|
|
621
|
+
|
|
622
|
+
declare class ChorusProcessor extends BasicEffectsProcessor {
|
|
623
|
+
private readonly chorusLeft;
|
|
624
|
+
private readonly chorusRight;
|
|
625
|
+
/**
|
|
626
|
+
* Creates a fancy chorus effect.
|
|
627
|
+
* @param context The audio context.
|
|
628
|
+
* @param config The configuration for the chorus.
|
|
629
|
+
*/
|
|
630
|
+
constructor(context: BaseAudioContext, config?: Partial<ChorusConfig>);
|
|
631
|
+
private _config;
|
|
632
|
+
get config(): ChorusConfig;
|
|
633
|
+
/**
|
|
634
|
+
* Updates the chorus with a given config.
|
|
635
|
+
* @param chorusConfig The config to use.
|
|
636
|
+
*/
|
|
637
|
+
update(chorusConfig: Partial<ChorusConfig>): void;
|
|
638
|
+
/**
|
|
639
|
+
* Disconnects and deletes the chorus effect.
|
|
640
|
+
*/
|
|
641
|
+
delete(): void;
|
|
642
|
+
private deleteNodes;
|
|
643
|
+
private createChorusNode;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
declare class ReverbProcessor extends BasicEffectsProcessor {
|
|
647
|
+
/**
|
|
648
|
+
* Indicates that the reverb is ready.
|
|
649
|
+
*/
|
|
650
|
+
readonly isReady: Promise<AudioBuffer>;
|
|
651
|
+
private conv;
|
|
652
|
+
/**
|
|
653
|
+
* Creates a new reverb processor.
|
|
654
|
+
* @param context The context to use.
|
|
655
|
+
* @param config The reverb configuration.
|
|
656
|
+
*/
|
|
657
|
+
constructor(context: BaseAudioContext, config?: Partial<ReverbConfig>);
|
|
658
|
+
private _config;
|
|
659
|
+
get config(): ReverbConfig;
|
|
660
|
+
/**
|
|
661
|
+
* Updates the reverb with a given config.
|
|
662
|
+
* @param config The config to use.
|
|
663
|
+
*/
|
|
664
|
+
update(config: Partial<ReverbConfig>): void;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
declare class LibSynthesizerSnapshot extends SynthesizerSnapshot {
|
|
668
|
+
chorusConfig: ChorusConfig;
|
|
669
|
+
reverbConfig: ReverbConfig;
|
|
670
|
+
constructor(channelSnapshots: ChannelSnapshot[], masterParameters: MasterParameterType, keyMappings: (KeyModifier | undefined)[][], chorusConfig?: ChorusConfig, reverbConfig?: ReverbConfig);
|
|
671
|
+
/**
|
|
672
|
+
* Retrieves the spessasynth_core snapshot from the lib snapshot.
|
|
673
|
+
*/
|
|
674
|
+
getCoreSnapshot(): SynthesizerSnapshot;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
declare abstract class BasicSynthesizer {
|
|
678
|
+
/**
|
|
679
|
+
* Allows managing the sound bank list.
|
|
680
|
+
*/
|
|
681
|
+
readonly soundBankManager: SoundBankManager;
|
|
682
|
+
/**
|
|
683
|
+
* Allows managing key modifications.
|
|
684
|
+
*/
|
|
685
|
+
readonly keyModifierManager: WorkletKeyModifierManagerWrapper;
|
|
686
|
+
/**
|
|
687
|
+
* Allows setting up custom event listeners for the synthesizer.
|
|
688
|
+
*/
|
|
689
|
+
readonly eventHandler: SynthEventHandler;
|
|
690
|
+
/**
|
|
691
|
+
* Synthesizer's parent AudioContext instance.
|
|
692
|
+
*/
|
|
693
|
+
readonly context: BaseAudioContext;
|
|
694
|
+
/**
|
|
695
|
+
* Synth's current channel properties.
|
|
696
|
+
*/
|
|
697
|
+
readonly channelProperties: ChannelProperty[];
|
|
698
|
+
/**
|
|
699
|
+
* The current preset list.
|
|
700
|
+
*/
|
|
701
|
+
presetList: PresetList;
|
|
702
|
+
sequencerCallbackFunction?: (m: SequencerReturnMessage) => unknown;
|
|
703
|
+
/**
|
|
704
|
+
* Resolves when the synthesizer is ready.
|
|
705
|
+
*/
|
|
706
|
+
readonly isReady: Promise<unknown>;
|
|
707
|
+
/**
|
|
708
|
+
* Synthesizer's reverb processor.
|
|
709
|
+
* Undefined if reverb is disabled.
|
|
710
|
+
*/
|
|
711
|
+
readonly reverbProcessor?: ReverbProcessor;
|
|
712
|
+
/**
|
|
713
|
+
* Synthesizer's chorus processor.
|
|
714
|
+
* Undefined if chorus is disabled.
|
|
715
|
+
*/
|
|
716
|
+
readonly chorusProcessor?: ChorusProcessor;
|
|
717
|
+
readonly post: (data: BasicSynthesizerMessage, transfer?: Transferable[]) => unknown;
|
|
718
|
+
protected readonly worklet: AudioWorkletNode;
|
|
719
|
+
/**
|
|
720
|
+
* The new channels will have their audio sent to the modulated output by this constant.
|
|
721
|
+
* what does that mean?
|
|
722
|
+
* e.g., if outputsAmount is 16, then channel's 16 audio data will be sent to channel 0
|
|
723
|
+
*/
|
|
724
|
+
protected readonly _outputsAmount = 16;
|
|
725
|
+
/**
|
|
726
|
+
* The current amount of MIDI channels the synthesizer has.
|
|
727
|
+
*/
|
|
728
|
+
channelsAmount: number;
|
|
729
|
+
protected readonly masterParameters: MasterParameterType;
|
|
730
|
+
protected resolveMap: Map<keyof SynthesizerReturn, (data: SynthesizerReturn[keyof SynthesizerReturn]) => unknown>;
|
|
731
|
+
protected renderingProgressTracker: Map<keyof SynthesizerProgress, ((args: number) => unknown) | ((args: {
|
|
732
|
+
sampleName: string;
|
|
733
|
+
sampleIndex: number;
|
|
734
|
+
sampleCount: number;
|
|
735
|
+
}) => unknown)>;
|
|
736
|
+
/**
|
|
737
|
+
* Creates a new instance of a synthesizer.
|
|
738
|
+
* @param worklet The AudioWorkletNode to use.
|
|
739
|
+
* @param postFunction The internal post function.
|
|
740
|
+
* @param config Optional configuration for the synthesizer.
|
|
741
|
+
*/
|
|
742
|
+
protected constructor(worklet: AudioWorkletNode, postFunction: (data: BasicSynthesizerMessage, transfer?: Transferable[]) => unknown, config: SynthConfig);
|
|
743
|
+
/**
|
|
744
|
+
* Current voice amount
|
|
745
|
+
*/
|
|
746
|
+
protected _voicesAmount: number;
|
|
747
|
+
/**
|
|
748
|
+
* The current number of voices playing.
|
|
749
|
+
*/
|
|
750
|
+
get voicesAmount(): number;
|
|
751
|
+
/**
|
|
752
|
+
* The audioContext's current time.
|
|
753
|
+
*/
|
|
754
|
+
get currentTime(): number;
|
|
755
|
+
/**
|
|
756
|
+
* Connects from a given node.
|
|
757
|
+
* @param destinationNode The node to connect to.
|
|
758
|
+
*/
|
|
759
|
+
connect(destinationNode: AudioNode): AudioNode;
|
|
760
|
+
/**
|
|
761
|
+
* Disconnects from a given node.
|
|
762
|
+
* @param destinationNode The node to disconnect from.
|
|
763
|
+
*/
|
|
764
|
+
disconnect(destinationNode?: AudioNode): AudioNode | undefined;
|
|
765
|
+
/**
|
|
766
|
+
* Sets the SpessaSynth's log level in the processor.
|
|
767
|
+
* @param enableInfo Enable info (verbose)
|
|
768
|
+
* @param enableWarning Enable warnings (unrecognized messages)
|
|
769
|
+
* @param enableGroup Enable groups (to group a lot of logs)
|
|
770
|
+
*/
|
|
771
|
+
setLogLevel(enableInfo: boolean, enableWarning: boolean, enableGroup: boolean): void;
|
|
772
|
+
/**
|
|
773
|
+
* Gets a master parameter from the synthesizer.
|
|
774
|
+
* @param type The parameter to get.
|
|
775
|
+
* @returns The parameter value.
|
|
776
|
+
*/
|
|
777
|
+
getMasterParameter<K extends keyof MasterParameterType>(type: K): MasterParameterType[K];
|
|
778
|
+
/**
|
|
779
|
+
* Sets a master parameter to a given value.
|
|
780
|
+
* @param type The parameter to set.
|
|
781
|
+
* @param value The value to set.
|
|
782
|
+
*/
|
|
783
|
+
setMasterParameter<K extends keyof MasterParameterType>(type: K, value: MasterParameterType[K]): void;
|
|
784
|
+
/**
|
|
785
|
+
* Gets a complete snapshot of the synthesizer, effects.
|
|
786
|
+
*/
|
|
787
|
+
getSnapshot(): Promise<LibSynthesizerSnapshot>;
|
|
788
|
+
/**
|
|
789
|
+
* Adds a new channel to the synthesizer.
|
|
790
|
+
*/
|
|
791
|
+
addNewChannel(): void;
|
|
792
|
+
/**
|
|
793
|
+
* Sets custom vibrato for the channel.
|
|
794
|
+
* @param channel The channel number.
|
|
795
|
+
* @param value The vibrato parameters.
|
|
796
|
+
*/
|
|
797
|
+
setVibrato(channel: number, value: {
|
|
798
|
+
delay: number;
|
|
799
|
+
depth: number;
|
|
800
|
+
rate: number;
|
|
801
|
+
}): void;
|
|
802
|
+
/**
|
|
803
|
+
* Connects the individual audio outputs to the given audio nodes. In the app, it's used by the renderer.
|
|
804
|
+
* @param audioNodes Exactly 16 outputs.
|
|
805
|
+
*/
|
|
806
|
+
connectIndividualOutputs(audioNodes: AudioNode[]): void;
|
|
807
|
+
/**
|
|
808
|
+
* Disconnects the individual audio outputs to the given audio nodes. In the app, it's used by the renderer.
|
|
809
|
+
* @param audioNodes Exactly 16 outputs.
|
|
810
|
+
*/
|
|
811
|
+
disconnectIndividualOutputs(audioNodes: AudioNode[]): void;
|
|
812
|
+
/**
|
|
813
|
+
* Disables the GS NRPN parameters like vibrato or drum key tuning.
|
|
814
|
+
*/
|
|
815
|
+
disableGSNPRNParams(): void;
|
|
816
|
+
/**
|
|
817
|
+
* Sends a raw MIDI message to the synthesizer.
|
|
818
|
+
* @param message the midi message, each number is a byte.
|
|
819
|
+
* @param channelOffset the channel offset of the message.
|
|
820
|
+
* @param eventOptions additional options for this command.
|
|
821
|
+
*/
|
|
822
|
+
sendMessage(message: Iterable<number>, channelOffset?: number, eventOptions?: SynthMethodOptions): void;
|
|
823
|
+
/**
|
|
824
|
+
* Starts playing a note
|
|
825
|
+
* @param channel Usually 0-15: the channel to play the note.
|
|
826
|
+
* @param midiNote 0-127 the key number of the note.
|
|
827
|
+
* @param velocity 0-127 the velocity of the note (generally controls loudness).
|
|
828
|
+
* @param eventOptions Additional options for this command.
|
|
829
|
+
*/
|
|
830
|
+
noteOn(channel: number, midiNote: number, velocity: number, eventOptions?: SynthMethodOptions): void;
|
|
831
|
+
/**
|
|
832
|
+
* Stops playing a note.
|
|
833
|
+
* @param channel Usually 0-15: the channel of the note.
|
|
834
|
+
* @param midiNote {number} 0-127 the key number of the note.
|
|
835
|
+
* @param force Instantly kills the note if true.
|
|
836
|
+
* @param eventOptions Additional options for this command.
|
|
837
|
+
*/
|
|
838
|
+
noteOff(channel: number, midiNote: number, force?: boolean, eventOptions?: SynthMethodOptions): void;
|
|
839
|
+
/**
|
|
840
|
+
* Stops all notes.
|
|
841
|
+
* @param force If the notes should immediately be stopped, defaults to false.
|
|
842
|
+
*/
|
|
843
|
+
stopAll(force?: boolean): void;
|
|
844
|
+
/**
|
|
845
|
+
* Changes the given controller
|
|
846
|
+
* @param channel Usually 0-15: the channel to change the controller.
|
|
847
|
+
* @param controllerNumber 0-127 the MIDI CC number.
|
|
848
|
+
* @param controllerValue 0-127 the controller value.
|
|
849
|
+
* @param force Forces the controller-change message, even if it's locked or gm system is set and the cc is bank select.
|
|
850
|
+
* @param eventOptions Additional options for this command.
|
|
851
|
+
*/
|
|
852
|
+
controllerChange(channel: number, controllerNumber: MIDIController, controllerValue: number, force?: boolean, eventOptions?: SynthMethodOptions): void;
|
|
853
|
+
/**
|
|
854
|
+
* Resets all controllers (for every channel)
|
|
855
|
+
*/
|
|
856
|
+
resetControllers(): void;
|
|
857
|
+
/**
|
|
858
|
+
* Causes the given midi channel to ignore controller messages for the given controller number.
|
|
859
|
+
* @param channel Usually 0-15: the channel to lock.
|
|
860
|
+
* @param controllerNumber 0-127 MIDI CC number.
|
|
861
|
+
* @param isLocked True if locked, false if unlocked.
|
|
862
|
+
* @remarks
|
|
863
|
+
* Controller number -1 locks the preset.
|
|
864
|
+
*/
|
|
865
|
+
lockController(channel: number, controllerNumber: MIDIController | -1, isLocked: boolean): void;
|
|
866
|
+
/**
|
|
867
|
+
* Applies pressure to a given channel.
|
|
868
|
+
* @param channel Usually 0-15: the channel to change the controller.
|
|
869
|
+
* @param pressure 0-127: the pressure to apply.
|
|
870
|
+
* @param eventOptions Additional options for this command.
|
|
871
|
+
*/
|
|
872
|
+
channelPressure(channel: number, pressure: number, eventOptions?: SynthMethodOptions): void;
|
|
873
|
+
/**
|
|
874
|
+
* Applies pressure to a given note.
|
|
875
|
+
* @param channel Usually 0-15: the channel to change the controller.
|
|
876
|
+
* @param midiNote 0-127: the MIDI note.
|
|
877
|
+
* @param pressure 0-127: the pressure to apply.
|
|
878
|
+
* @param eventOptions Additional options for this command.
|
|
879
|
+
*/
|
|
880
|
+
polyPressure(channel: number, midiNote: number, pressure: number, eventOptions?: SynthMethodOptions): void;
|
|
881
|
+
/**
|
|
882
|
+
* Sets the pitch of the given channel.
|
|
883
|
+
* @param channel Usually 0-15: the channel to change pitch.
|
|
884
|
+
* @param value The bend of the MIDI pitch wheel message. 0 - 16384
|
|
885
|
+
* @param eventOptions Additional options for this command.
|
|
886
|
+
*/
|
|
887
|
+
pitchWheel(channel: number, value: number, eventOptions?: SynthMethodOptions): void;
|
|
888
|
+
/**
|
|
889
|
+
* Sets the channel's pitch wheel range, in semitones.
|
|
890
|
+
* @param channel Usually 0-15: the channel to change.
|
|
891
|
+
* @param range The bend range in semitones.
|
|
892
|
+
*/
|
|
893
|
+
pitchWheelRange(channel: number, range: number): void;
|
|
894
|
+
/**
|
|
895
|
+
* Changes the program for a given channel
|
|
896
|
+
* @param channel Usually 0-15: the channel to change.
|
|
897
|
+
* @param programNumber 0-127 the MIDI patch number.
|
|
898
|
+
* defaults to false
|
|
899
|
+
*/
|
|
900
|
+
programChange(channel: number, programNumber: number): void;
|
|
901
|
+
/**
|
|
902
|
+
* Transposes the channel by given number of semitones.
|
|
903
|
+
* @param channel The channel number.
|
|
904
|
+
* @param semitones The transposition of the channel, it can be a float.
|
|
905
|
+
* @param force Defaults to false, if true transposes the channel even if it's a drum channel.
|
|
906
|
+
*/
|
|
907
|
+
transposeChannel(channel: number, semitones: number, force?: boolean): void;
|
|
908
|
+
/**
|
|
909
|
+
* Mutes or unmutes the given channel.
|
|
910
|
+
* @param channel Usually 0-15: the channel to mute.
|
|
911
|
+
* @param isMuted Indicates if the channel is muted.
|
|
912
|
+
*/
|
|
913
|
+
muteChannel(channel: number, isMuted: boolean): void;
|
|
914
|
+
/**
|
|
915
|
+
* Sends a MIDI Sysex message to the synthesizer.
|
|
916
|
+
* @param messageData The message's data, excluding the F0 byte, but including the F7 at the end.
|
|
917
|
+
* @param channelOffset Channel offset for the system exclusive message, defaults to zero.
|
|
918
|
+
* @param eventOptions Additional options for this command.
|
|
919
|
+
*/
|
|
920
|
+
systemExclusive(messageData: number[] | Iterable<number> | Uint8Array, channelOffset?: number, eventOptions?: SynthMethodOptions): void;
|
|
921
|
+
/**
|
|
922
|
+
* Tune MIDI keys of a given program using the MIDI Tuning Standard.
|
|
923
|
+
* @param program 0 - 127 the MIDI program number to use.
|
|
924
|
+
* @param tunings The keys and their tunings.
|
|
925
|
+
* TargetPitch of -1 sets the tuning for this key to be tuned regularly.
|
|
926
|
+
*/
|
|
927
|
+
tuneKeys(program: number, tunings: {
|
|
928
|
+
sourceKey: number;
|
|
929
|
+
targetPitch: number;
|
|
930
|
+
}[]): void;
|
|
931
|
+
/**
|
|
932
|
+
* Toggles drums on a given channel.
|
|
933
|
+
* @param channel The channel number.
|
|
934
|
+
* @param isDrum If the channel should be drums.
|
|
935
|
+
*/
|
|
936
|
+
setDrums(channel: number, isDrum: boolean): void;
|
|
937
|
+
/**
|
|
938
|
+
* Yes please!
|
|
939
|
+
*/
|
|
940
|
+
reverbateEverythingBecauseWhyNot(): "That's the spirit!";
|
|
941
|
+
/**
|
|
942
|
+
* INTERNAL USE ONLY!
|
|
943
|
+
* @param type INTERNAL USE ONLY!
|
|
944
|
+
* @param resolve INTERNAL USE ONLY!
|
|
945
|
+
*/
|
|
946
|
+
awaitWorkerResponse<K extends keyof SynthesizerReturn>(type: K, resolve: (data: SynthesizerReturn[K]) => unknown): void;
|
|
947
|
+
protected assignProgressTracker<K extends keyof SynthesizerProgress>(type: K, progressFunction: (args: SynthesizerProgress[K]) => unknown): void;
|
|
948
|
+
protected revokeProgressTracker<K extends keyof SynthesizerProgress>(type: K): void;
|
|
949
|
+
protected _sendInternal(message: Iterable<number>, channelOffset: number, force: boolean | undefined, eventOptions: Partial<SynthMethodOptions>): void;
|
|
950
|
+
/**
|
|
951
|
+
* Handles the messages received from the worklet.
|
|
952
|
+
*/
|
|
953
|
+
protected handleMessage(m: BasicSynthesizerReturnMessage): void;
|
|
954
|
+
protected addNewChannelInternal(post: boolean): void;
|
|
955
|
+
protected workletResponds<K extends keyof SynthesizerReturn>(type: K, data: SynthesizerReturn[K]): void;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* This synthesizer uses an audio worklet node containing the processor.
|
|
960
|
+
*/
|
|
961
|
+
declare class WorkletSynthesizer extends BasicSynthesizer {
|
|
962
|
+
/**
|
|
963
|
+
* Creates a new instance of an AudioWorklet-based synthesizer.
|
|
964
|
+
* @param context The audio context.
|
|
965
|
+
* @param config Optional configuration for the synthesizer.
|
|
966
|
+
*/
|
|
967
|
+
constructor(context: BaseAudioContext, config?: Partial<SynthConfig>);
|
|
968
|
+
/**
|
|
969
|
+
* Starts an offline audio render.
|
|
970
|
+
* @param config The configuration to use.
|
|
971
|
+
* @remarks
|
|
972
|
+
* Call this method immediately after you've set up the synthesizer.
|
|
973
|
+
* Do NOT call any other methods after initializing before this one.
|
|
974
|
+
* Chromium seems to ignore worklet messages for OfflineAudioContext.
|
|
975
|
+
*/
|
|
976
|
+
startOfflineRender(config: OfflineRenderWorkletData): Promise<void>;
|
|
977
|
+
/**
|
|
978
|
+
* Destroys the synthesizer instance.
|
|
979
|
+
*/
|
|
980
|
+
destroy(): void;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
type WorkerSynthWriteOptions<K> = K & {
|
|
984
|
+
progressFunction?: (args: SynthesizerProgress["workerSynthWriteFile"]) => unknown;
|
|
985
|
+
};
|
|
986
|
+
/**
|
|
987
|
+
* This synthesizer uses a Worker containing the processor and an audio worklet node for playback.
|
|
988
|
+
*/
|
|
989
|
+
declare class WorkerSynthesizer extends BasicSynthesizer {
|
|
990
|
+
/**
|
|
991
|
+
* Time offset for syncing with the synth
|
|
992
|
+
* @private
|
|
993
|
+
*/
|
|
994
|
+
private timeOffset;
|
|
995
|
+
/**
|
|
996
|
+
* Creates a new instance of a Worker-based synthesizer.
|
|
997
|
+
* @param context The audio context.
|
|
998
|
+
* @param workerPostMessage The postMessage for the worker containing the synthesizer core.
|
|
999
|
+
* @param config Optional configuration for the synthesizer.
|
|
1000
|
+
*/
|
|
1001
|
+
constructor(context: BaseAudioContext, workerPostMessage: typeof Worker.prototype.postMessage, config?: Partial<SynthConfig>);
|
|
1002
|
+
get currentTime(): number;
|
|
1003
|
+
/**
|
|
1004
|
+
* Registers an audio worklet for the WorkerSynthesizer.
|
|
1005
|
+
* @param context The context to register the worklet for.
|
|
1006
|
+
* @param maxQueueSize The maximum amount of 128-sample chunks to store in the worklet. Higher values result in less breakups but higher latency.
|
|
1007
|
+
*/
|
|
1008
|
+
static registerPlaybackWorklet(context: BaseAudioContext, maxQueueSize?: number): Promise<void>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Handles a return message from the Worker.
|
|
1011
|
+
* @param e The event received from the Worker.
|
|
1012
|
+
*/
|
|
1013
|
+
handleWorkerMessage(e: BasicSynthesizerReturnMessage): void;
|
|
1014
|
+
/**
|
|
1015
|
+
* Writes a DLS file directly in the worker.
|
|
1016
|
+
* @param options Options for writing the file.
|
|
1017
|
+
* @returns The file array buffer and its corresponding name.
|
|
1018
|
+
*/
|
|
1019
|
+
writeDLS(options?: Partial<WorkerSynthWriteOptions<WorkerDLSWriteOptions>>): Promise<SynthesizerReturn["workerSynthWriteFile"]>;
|
|
1020
|
+
/**
|
|
1021
|
+
* Writes an SF2/SF3 file directly in the worker.
|
|
1022
|
+
* @param options Options for writing the file.
|
|
1023
|
+
* @returns The file array buffer and its corresponding name.
|
|
1024
|
+
*/
|
|
1025
|
+
writeSF2(options?: Partial<WorkerSynthWriteOptions<WorkerSoundFont2WriteOptions>>): Promise<SynthesizerReturn["workerSynthWriteFile"]>;
|
|
1026
|
+
/**
|
|
1027
|
+
* Writes an embedded MIDI (RMIDI) file directly in the worker.
|
|
1028
|
+
* @param options Options for writing the file.
|
|
1029
|
+
* @returns The file array buffer.
|
|
1030
|
+
*/
|
|
1031
|
+
writeRMIDI(options?: Partial<WorkerSynthWriteOptions<WorkerRMIDIWriteOptions>>): Promise<ArrayBuffer>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Renders the current song in the connected sequencer to Float32 buffers.
|
|
1034
|
+
* @param sampleRate The sample rate to use, in Hertz.
|
|
1035
|
+
* @param renderOptions Extra options for the render.
|
|
1036
|
+
* @returns A single audioBuffer if separate channels were not enabled, otherwise 16.
|
|
1037
|
+
* @remarks
|
|
1038
|
+
* This stops the synthesizer.
|
|
1039
|
+
*/
|
|
1040
|
+
renderAudio(sampleRate: number, renderOptions?: Partial<WorkerRenderAudioOptions>): Promise<AudioBuffer[]>;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
type SequencerEventCallback<T extends keyof WorkletSequencerEventType> = (callbackData: WorkletSequencerEventType[T]) => unknown;
|
|
1044
|
+
declare class SeqEventHandler {
|
|
1045
|
+
/**
|
|
1046
|
+
* The time delay before an event is called.
|
|
1047
|
+
* Set to 0 to disable it.
|
|
1048
|
+
*/
|
|
1049
|
+
timeDelay: number;
|
|
1050
|
+
private readonly events;
|
|
1051
|
+
/**
|
|
1052
|
+
* Adds a new event listener.
|
|
1053
|
+
* @param event The event to listen to.
|
|
1054
|
+
* @param id The unique identifier for the event. It can be used to overwrite existing callback with the same ID.
|
|
1055
|
+
* @param callback The callback for the event.
|
|
1056
|
+
*/
|
|
1057
|
+
addEvent<T extends keyof WorkletSequencerEventType>(event: T, id: string, callback: SequencerEventCallback<T>): void;
|
|
1058
|
+
/**
|
|
1059
|
+
* Removes an event listener
|
|
1060
|
+
* @param name The event to remove a listener from.
|
|
1061
|
+
* @param id The unique identifier for the event to remove.
|
|
1062
|
+
*/
|
|
1063
|
+
removeEvent<T extends keyof WorkletSequencerEventType>(name: T, id: string): void;
|
|
1064
|
+
/**
|
|
1065
|
+
* Calls the given event.
|
|
1066
|
+
* Internal use only.
|
|
1067
|
+
*/
|
|
1068
|
+
callEventInternal<T extends keyof WorkletSequencerEventType>(name: T, eventData: WorkletSequencerEventType[T]): void;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
declare class Sequencer {
|
|
1072
|
+
/**
|
|
1073
|
+
* The current MIDI data, with the exclusion of the embedded sound bank and event data.
|
|
1074
|
+
*/
|
|
1075
|
+
midiData?: MIDIData;
|
|
1076
|
+
/**
|
|
1077
|
+
* The current MIDI data for all songs, like the midiData property.
|
|
1078
|
+
*/
|
|
1079
|
+
songListData: MIDIData[];
|
|
1080
|
+
/**
|
|
1081
|
+
* Allows setting up custom event listeners for the sequencer.
|
|
1082
|
+
*/
|
|
1083
|
+
eventHandler: SeqEventHandler;
|
|
1084
|
+
/**
|
|
1085
|
+
* Indicates whether the sequencer has finished playing a sequence.
|
|
1086
|
+
*/
|
|
1087
|
+
isFinished: boolean;
|
|
1088
|
+
/**
|
|
1089
|
+
* The synthesizer attached to this sequencer.
|
|
1090
|
+
*/
|
|
1091
|
+
readonly synth: BasicSynthesizer;
|
|
1092
|
+
/**
|
|
1093
|
+
* The MIDI port to play to.
|
|
1094
|
+
*/
|
|
1095
|
+
private midiOut?;
|
|
1096
|
+
private isLoading;
|
|
1097
|
+
/**
|
|
1098
|
+
* Indicates if the sequencer is paused.
|
|
1099
|
+
* Paused if a number, undefined if playing.
|
|
1100
|
+
*/
|
|
1101
|
+
private pausedTime?;
|
|
1102
|
+
private getMIDICallback?;
|
|
1103
|
+
private highResTimeOffset;
|
|
1104
|
+
/**
|
|
1105
|
+
* Absolute playback startTime, bases on the synth's time.
|
|
1106
|
+
*/
|
|
1107
|
+
private absoluteStartTime;
|
|
1108
|
+
/**
|
|
1109
|
+
* Creates a new MIDI sequencer for playing back MIDI files.
|
|
1110
|
+
* @param synth synth to send events to.
|
|
1111
|
+
* @param options the sequencer's options.
|
|
1112
|
+
*/
|
|
1113
|
+
constructor(synth: BasicSynthesizer, options?: Partial<SequencerOptions>);
|
|
1114
|
+
private _songIndex;
|
|
1115
|
+
/**
|
|
1116
|
+
* The current song number in the playlist.
|
|
1117
|
+
*/
|
|
1118
|
+
get songIndex(): number;
|
|
1119
|
+
/**
|
|
1120
|
+
* The current song number in the playlist.
|
|
1121
|
+
*/
|
|
1122
|
+
set songIndex(value: number);
|
|
1123
|
+
protected _currentTempo: number;
|
|
1124
|
+
/**
|
|
1125
|
+
* Current song's tempo in BPM.
|
|
1126
|
+
*/
|
|
1127
|
+
get currentTempo(): number;
|
|
1128
|
+
/**
|
|
1129
|
+
* The current sequence's length, in seconds.
|
|
1130
|
+
*/
|
|
1131
|
+
get duration(): number;
|
|
1132
|
+
protected _songsAmount: number;
|
|
1133
|
+
get songsAmount(): number;
|
|
1134
|
+
protected _skipToFirstNoteOn: boolean;
|
|
1135
|
+
/**
|
|
1136
|
+
* Indicates if the sequencer should skip to first note on.
|
|
1137
|
+
*/
|
|
1138
|
+
get skipToFirstNoteOn(): boolean;
|
|
1139
|
+
/**
|
|
1140
|
+
* Indicates if the sequencer should skip to first note on.
|
|
1141
|
+
*/
|
|
1142
|
+
set skipToFirstNoteOn(val: boolean);
|
|
1143
|
+
/**
|
|
1144
|
+
* Internal loop count marker (-1 is infinite).
|
|
1145
|
+
*/
|
|
1146
|
+
protected _loopCount: number;
|
|
1147
|
+
/**
|
|
1148
|
+
* The current remaining number of loops. -1 means infinite looping.
|
|
1149
|
+
*/
|
|
1150
|
+
get loopCount(): number;
|
|
1151
|
+
/**
|
|
1152
|
+
* The current remaining number of loops. -1 means infinite looping.
|
|
1153
|
+
*/
|
|
1154
|
+
set loopCount(val: number);
|
|
1155
|
+
/**
|
|
1156
|
+
* Controls the playback's rate.
|
|
1157
|
+
*/
|
|
1158
|
+
protected _playbackRate: number;
|
|
1159
|
+
/**
|
|
1160
|
+
* Controls the playback's rate.
|
|
1161
|
+
*/
|
|
1162
|
+
get playbackRate(): number;
|
|
1163
|
+
/**
|
|
1164
|
+
* Controls the playback's rate.
|
|
1165
|
+
*/
|
|
1166
|
+
set playbackRate(value: number);
|
|
1167
|
+
protected _shuffleSongs: boolean;
|
|
1168
|
+
/**
|
|
1169
|
+
* Indicates if the song order is random.
|
|
1170
|
+
*/
|
|
1171
|
+
get shuffleSongs(): boolean;
|
|
1172
|
+
/**
|
|
1173
|
+
* Indicates if the song order is random.
|
|
1174
|
+
*/
|
|
1175
|
+
set shuffleSongs(value: boolean);
|
|
1176
|
+
/**
|
|
1177
|
+
* Current playback time, in seconds.
|
|
1178
|
+
*/
|
|
1179
|
+
get currentTime(): number;
|
|
1180
|
+
/**
|
|
1181
|
+
* Current playback time, in seconds.
|
|
1182
|
+
*/
|
|
1183
|
+
set currentTime(time: number);
|
|
1184
|
+
/**
|
|
1185
|
+
* A smoothed version of currentTime.
|
|
1186
|
+
* Use for visualization as it's not affected by the audioContext stutter.
|
|
1187
|
+
*/
|
|
1188
|
+
get currentHighResolutionTime(): number;
|
|
1189
|
+
/**
|
|
1190
|
+
* True if paused, false if playing or stopped.
|
|
1191
|
+
*/
|
|
1192
|
+
get paused(): boolean;
|
|
1193
|
+
/**
|
|
1194
|
+
* Gets the current MIDI File.
|
|
1195
|
+
*/
|
|
1196
|
+
getMIDI(): Promise<BasicMIDI>;
|
|
1197
|
+
/**
|
|
1198
|
+
* Loads a new song list.
|
|
1199
|
+
* @param midiBuffers The MIDI files to play.
|
|
1200
|
+
*/
|
|
1201
|
+
loadNewSongList(midiBuffers: SuppliedMIDIData[]): void;
|
|
1202
|
+
/**
|
|
1203
|
+
* Connects a given output to the sequencer.
|
|
1204
|
+
* @param output The output to connect. Pass undefined to use the connected synthesizer.
|
|
1205
|
+
*/
|
|
1206
|
+
connectMIDIOutput(output?: MIDIOutput): void;
|
|
1207
|
+
/**
|
|
1208
|
+
* Pauses the playback.
|
|
1209
|
+
*/
|
|
1210
|
+
pause(): void;
|
|
1211
|
+
/**
|
|
1212
|
+
* Starts or resumes the playback.
|
|
1213
|
+
*/
|
|
1214
|
+
play(): void;
|
|
1215
|
+
protected handleMessage(m: SequencerReturnMessage): void;
|
|
1216
|
+
protected callEventInternal<EventType extends keyof WorkletSequencerEventType>(type: EventType, data: WorkletSequencerEventType[EventType]): void;
|
|
1217
|
+
protected resetMIDIOutput(): void;
|
|
1218
|
+
private recalculateStartTime;
|
|
1219
|
+
private sendMessage;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
interface ExtraWaveOptions extends WaveWriteOptions {
|
|
1223
|
+
/**
|
|
1224
|
+
* The channel offset in the AudioBuffer. Defaults to 0.
|
|
1225
|
+
*/
|
|
1226
|
+
channelOffset: number;
|
|
1227
|
+
/**
|
|
1228
|
+
* The amount of channels from the AudioBuffer to write. Defaults to all.
|
|
1229
|
+
*/
|
|
1230
|
+
channelCount: number;
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Converts an audio buffer into a wave file.
|
|
1234
|
+
* @param audioBuffer The audio data channels.
|
|
1235
|
+
* @param options Additional options for writing the file.
|
|
1236
|
+
* @returns The binary file.
|
|
1237
|
+
*/
|
|
1238
|
+
declare function audioBufferToWav(audioBuffer: AudioBuffer, options?: Partial<ExtraWaveOptions>): Blob;
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* Midi_handler.js
|
|
1242
|
+
* purpose: handles the connection between MIDI devices and synthesizer/sequencer via Web MIDI API
|
|
1243
|
+
*/
|
|
1244
|
+
declare class LibMIDIPort {
|
|
1245
|
+
readonly port: MIDIPort;
|
|
1246
|
+
protected constructor(port: MIDIPort);
|
|
1247
|
+
/**
|
|
1248
|
+
*
|
|
1249
|
+
*/
|
|
1250
|
+
get id(): string;
|
|
1251
|
+
/**
|
|
1252
|
+
*
|
|
1253
|
+
*/
|
|
1254
|
+
get name(): string | null;
|
|
1255
|
+
/**
|
|
1256
|
+
*
|
|
1257
|
+
*/
|
|
1258
|
+
get manufacturer(): string | null;
|
|
1259
|
+
/**
|
|
1260
|
+
*
|
|
1261
|
+
*/
|
|
1262
|
+
get version(): string | null;
|
|
1263
|
+
}
|
|
1264
|
+
declare class LibMIDIInput extends LibMIDIPort {
|
|
1265
|
+
private readonly connectedSynths;
|
|
1266
|
+
constructor(input: MIDIInput);
|
|
1267
|
+
/**
|
|
1268
|
+
* Connects the input to a given synth, listening for all incoming events.
|
|
1269
|
+
* @param synth The synth to connect to.
|
|
1270
|
+
*/
|
|
1271
|
+
connect(synth: BasicSynthesizer): void;
|
|
1272
|
+
/**
|
|
1273
|
+
* Disconnects the input from a given synth.
|
|
1274
|
+
* @param synth The synth to disconnect from.
|
|
1275
|
+
*/
|
|
1276
|
+
disconnect(synth: BasicSynthesizer): void;
|
|
1277
|
+
}
|
|
1278
|
+
declare class LibMIDIOutput extends LibMIDIPort {
|
|
1279
|
+
readonly port: MIDIOutput;
|
|
1280
|
+
constructor(output: MIDIOutput);
|
|
1281
|
+
/**
|
|
1282
|
+
* Connects a given sequencer to the output, playing back the MIDI file to it.
|
|
1283
|
+
* @param seq The sequencer to connect.
|
|
1284
|
+
*/
|
|
1285
|
+
connect(seq: Sequencer): void;
|
|
1286
|
+
/**
|
|
1287
|
+
* Disconnects sequencer from the output, making it play to the attached Synthesizer instead.
|
|
1288
|
+
* @param seq The sequencer to disconnect.
|
|
1289
|
+
*/
|
|
1290
|
+
disconnect(seq: Sequencer): void;
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* A class for handling physical MIDI devices.
|
|
1294
|
+
*/
|
|
1295
|
+
declare class MIDIDeviceHandler {
|
|
1296
|
+
/**
|
|
1297
|
+
* The available MIDI inputs. ID maps to the input.
|
|
1298
|
+
*/
|
|
1299
|
+
readonly inputs: Map<string, LibMIDIInput>;
|
|
1300
|
+
/**
|
|
1301
|
+
* The available MIDI outputs. ID maps to the output.
|
|
1302
|
+
*/
|
|
1303
|
+
readonly outputs: Map<string, LibMIDIOutput>;
|
|
1304
|
+
private constructor();
|
|
1305
|
+
/**
|
|
1306
|
+
* Attempts to initialize the MIDI Device Handler.
|
|
1307
|
+
* @returns The handler.
|
|
1308
|
+
* @throws An error if the MIDI Devices fail to initialize.
|
|
1309
|
+
*/
|
|
1310
|
+
static createMIDIDeviceHandler(): Promise<MIDIDeviceHandler>;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
/**
|
|
1314
|
+
* Web_midi_link.js
|
|
1315
|
+
* purpose: handles the web midi link connection to the synthesizer
|
|
1316
|
+
* https://www.g200kg.com/en/docs/webmidilink/
|
|
1317
|
+
*/
|
|
1318
|
+
declare class WebMIDILinkHandler {
|
|
1319
|
+
/**
|
|
1320
|
+
* Initializes support for Web MIDI Link (https://www.g200kg.com/en/docs/webmidilink/)
|
|
1321
|
+
* @param synth The synthesizer to enable support with.
|
|
1322
|
+
*/
|
|
1323
|
+
constructor(synth: BasicSynthesizer);
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
declare const DEFAULT_SYNTH_CONFIG: SynthConfig;
|
|
1327
|
+
|
|
1328
|
+
export { ChorusProcessor, DEFAULT_SYNTH_CONFIG, MIDIDeviceHandler, ReverbProcessor, Sequencer, WebMIDILinkHandler, WorkerSynthesizer, WorkerSynthesizerCore, WorkletSynthesizer, audioBufferToWav };
|