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