spessasynth_lib 4.2.15 → 4.3.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 +6 -0
- package/dist/index.d.ts +165 -182
- package/dist/index.js +388 -297
- package/dist/index.js.map +1 -1
- package/dist/spessasynth_processor.min.js +9 -11
- package/dist/spessasynth_processor.min.js.map +4 -4
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -18,11 +18,17 @@ It allows you to:
|
|
|
18
18
|
>
|
|
19
19
|
> Looking for a bare JS version that works without WebAudioAPI? Try [spessasynth_core](https://github.com/spessasus/spessasynth_core)!
|
|
20
20
|
|
|
21
|
+
### v4.3.0 The General Update is here!
|
|
22
|
+
|
|
23
|
+
Featuring robust MIDI analysis and editing, broadened MIDI exclusive support,
|
|
24
|
+
and reworked, more powerful API!
|
|
25
|
+
|
|
21
26
|
### [Project site (consider giving it a star!)](https://github.com/spessasus/spessasynth_lib)
|
|
22
27
|
|
|
23
28
|
### Made with spessasynth_lib
|
|
24
29
|
|
|
25
30
|
- [SpessaSynth - Online SF2/DLS MIDI Player](https://spessasus.github.io/SpessaSynth)
|
|
31
|
+
- [signal - Online MIDI Editor](https://signalmidi.app/)
|
|
26
32
|
|
|
27
33
|
### [Documentation](https://spessasus.github.io/spessasynth_lib)
|
|
28
34
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BasicMIDI, BasicSoundBank,
|
|
1
|
+
import { BasicMIDI, BasicSoundBank, ChannelMIDIParameter, ChannelSystemParameter, DLSWriteOptions, GlobalMIDIParameter, GlobalSystemParameter, KeyModifier, MIDIController, MIDIMessage, MIDIPatch, MIDIPatchFull, MIDITrack, RMIDIWriteOptions, SequencerEvent, SoundBankManagerListEntry, SoundFont2WriteOptions, SpessaSynthProcessor, SpessaSynthSequencer, SynthMethodOptions, SynthProcessorEventData, SynthProcessorOptions, SynthesizerSnapshot, WaveWriteOptions } from "spessasynth_core";
|
|
2
2
|
|
|
3
3
|
//#region src/synthesizer/basic/key_modifier_manager.d.ts
|
|
4
4
|
declare class WorkletKeyModifierManagerWrapper {
|
|
@@ -74,40 +74,6 @@ declare class SoundBankManager {
|
|
|
74
74
|
private sendToWorklet;
|
|
75
75
|
}
|
|
76
76
|
//#endregion
|
|
77
|
-
//#region src/synthesizer/basic/synth_event_handler.d.ts
|
|
78
|
-
type ProcessorEventCallback<T extends keyof SynthProcessorEventData> = (callbackData: SynthProcessorEventData[T]) => unknown;
|
|
79
|
-
declare class SynthEventHandler {
|
|
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;
|
|
109
|
-
}
|
|
110
|
-
//#endregion
|
|
111
77
|
//#region src/sequencer/enums.d.ts
|
|
112
78
|
declare const songChangeType: {
|
|
113
79
|
readonly shuffleOn: 1;
|
|
@@ -127,10 +93,14 @@ declare class MIDIDataTrack extends MIDITrack {
|
|
|
127
93
|
/**
|
|
128
94
|
* A simplified version of the MIDI, accessible at all times from the Sequencer.
|
|
129
95
|
* Use getMIDI() to get the actual sequence.
|
|
130
|
-
* This class contains all properties that MIDI does, except for tracks and the embedded sound bank.
|
|
96
|
+
* This class contains all properties that MIDI does, except for tracks, timeline and the embedded sound bank.
|
|
131
97
|
*/
|
|
132
98
|
declare class MIDIData extends BasicMIDI {
|
|
133
99
|
tracks: MIDIDataTrack[];
|
|
100
|
+
/**
|
|
101
|
+
* THIS DATA WILL BE EMPTY! USE sequencer.getMIDI() TO GET THE ACTUAL DATA!
|
|
102
|
+
*/
|
|
103
|
+
timeline: never[];
|
|
134
104
|
/**
|
|
135
105
|
* THIS DATA WILL BE EMPTY! USE sequencer.getMIDI() TO GET THE ACTUAL DATA!
|
|
136
106
|
*/
|
|
@@ -254,12 +224,17 @@ declare abstract class BasicSynthesizerCore {
|
|
|
254
224
|
readonly sequencers: SpessaSynthSequencer[];
|
|
255
225
|
protected readonly post: PostMessageSynthCore;
|
|
256
226
|
protected lastSequencerSync: number;
|
|
227
|
+
/**
|
|
228
|
+
* For syncing voice counts, implemented separately in the `process()` method.
|
|
229
|
+
* @protected
|
|
230
|
+
*/
|
|
231
|
+
protected readonly voiceCounts: number[];
|
|
257
232
|
/**
|
|
258
233
|
* Indicates if the processor is alive.
|
|
259
234
|
* @protected
|
|
260
235
|
*/
|
|
261
236
|
protected alive: boolean;
|
|
262
|
-
protected readonly
|
|
237
|
+
protected readonly eventsEnabled: boolean;
|
|
263
238
|
protected constructor(sampleRate: number, options: Partial<SynthProcessorOptions>, postMessage: PostMessageSynthCore);
|
|
264
239
|
protected createNewSequencer(): void;
|
|
265
240
|
protected postReady<K extends keyof SynthesizerReturn>(type: K, data: SynthesizerReturn[K], transferable?: Transferable[]): void;
|
|
@@ -339,7 +314,7 @@ interface PassedProcessorParameters {
|
|
|
339
314
|
/**
|
|
340
315
|
* If the synthesizer should send events.
|
|
341
316
|
*/
|
|
342
|
-
|
|
317
|
+
eventsEnabled: boolean;
|
|
343
318
|
/**
|
|
344
319
|
* If the synth should use one output with 32 channels (2 audio channels for each midi channel).
|
|
345
320
|
*/
|
|
@@ -368,7 +343,7 @@ interface OfflineRenderWorkletData {
|
|
|
368
343
|
/**
|
|
369
344
|
* The options to pass to the sequencer.
|
|
370
345
|
*/
|
|
371
|
-
sequencerOptions
|
|
346
|
+
sequencerOptions?: Partial<SequencerOptions>;
|
|
372
347
|
}
|
|
373
348
|
interface WorkletSBKManagerData {
|
|
374
349
|
addSoundBank: {
|
|
@@ -396,6 +371,7 @@ type BasicSynthesizerMessage = { [K in keyof BasicSynthesizerMessageData]: {
|
|
|
396
371
|
type: K;
|
|
397
372
|
data: BasicSynthesizerMessageData[K];
|
|
398
373
|
} }[keyof BasicSynthesizerMessageData];
|
|
374
|
+
type CompressionActionType = "keep" | "compress" | "decompress";
|
|
399
375
|
interface WorkerBankWriteOptions {
|
|
400
376
|
/**
|
|
401
377
|
* Trim the sound bank to only include samples used in the current MIDI file.
|
|
@@ -415,14 +391,26 @@ interface WorkerBankWriteOptions {
|
|
|
415
391
|
writeEmbeddedSoundBank: boolean;
|
|
416
392
|
}
|
|
417
393
|
type WorkerDLSWriteOptions = Omit<DLSWriteOptions, "progressFunction"> & WorkerBankWriteOptions;
|
|
418
|
-
type WorkerSoundFont2WriteOptions = Omit<SoundFont2WriteOptions, "
|
|
394
|
+
type WorkerSoundFont2WriteOptions = Omit<SoundFont2WriteOptions, "progressFunction"> & WorkerBankWriteOptions & {
|
|
395
|
+
/**
|
|
396
|
+
* If the samples should be changed. The values are:
|
|
397
|
+
* - `keep` - keep samples as-is.
|
|
398
|
+
* - `compress` - compress the samples with your compression function provided to the `WorkerSynthesizer` and change SF2 to SF3.
|
|
399
|
+
* - `decompress` - decompress the compressed samples and change SF3 to SF2.
|
|
400
|
+
*/
|
|
401
|
+
compressionAction: CompressionActionType;
|
|
419
402
|
/**
|
|
420
403
|
* The compression quality to call your provided compressionFunction with, if compressing.
|
|
421
404
|
*/
|
|
422
405
|
compressionQuality: number;
|
|
423
406
|
};
|
|
424
407
|
type WorkerSampleEncodingFunction = (audioData: Float32Array, sampleRate: number, quality: number) => Promise<Uint8Array>;
|
|
425
|
-
type WorkerRMIDIWriteOptions = Omit<RMIDIWriteOptions, "soundBank"> &
|
|
408
|
+
type WorkerRMIDIWriteOptions = Omit<RMIDIWriteOptions, "soundBank"> & {
|
|
409
|
+
/**
|
|
410
|
+
* If a snapshot of the current `SpessaSynthProcessor` should be applied to the MIDI file.
|
|
411
|
+
*/
|
|
412
|
+
applySnapshot: boolean;
|
|
413
|
+
} & (({
|
|
426
414
|
format: "sf2";
|
|
427
415
|
} & WorkerSoundFont2WriteOptions) | ({
|
|
428
416
|
format: "dls";
|
|
@@ -447,19 +435,10 @@ interface BasicSynthesizerMessageData {
|
|
|
447
435
|
};
|
|
448
436
|
ccReset: null;
|
|
449
437
|
stopAll: number;
|
|
450
|
-
muteChannel: boolean;
|
|
451
438
|
addNewChannel: null;
|
|
452
|
-
customCcChange: {
|
|
453
|
-
ccNumber: CustomController;
|
|
454
|
-
ccValue: number;
|
|
455
|
-
};
|
|
456
|
-
transposeChannel: {
|
|
457
|
-
semitones: number;
|
|
458
|
-
force: boolean;
|
|
459
|
-
};
|
|
460
439
|
setDrums: boolean;
|
|
461
440
|
lockController: {
|
|
462
|
-
|
|
441
|
+
controller: MIDIController;
|
|
463
442
|
isLocked: boolean;
|
|
464
443
|
};
|
|
465
444
|
sequencerSpecific: SequencerMessage;
|
|
@@ -470,10 +449,14 @@ interface BasicSynthesizerMessageData {
|
|
|
470
449
|
enableWarning: boolean;
|
|
471
450
|
enableGroup: boolean;
|
|
472
451
|
};
|
|
473
|
-
|
|
452
|
+
setChannelSystemParameter: { [K in keyof ChannelSystemParameter]: {
|
|
474
453
|
type: K;
|
|
475
|
-
data:
|
|
476
|
-
} }[keyof
|
|
454
|
+
data: ChannelSystemParameter[K];
|
|
455
|
+
} }[keyof ChannelSystemParameter];
|
|
456
|
+
setGlobalSystemParameter: { [K in keyof GlobalSystemParameter]: {
|
|
457
|
+
type: K;
|
|
458
|
+
data: GlobalSystemParameter[K];
|
|
459
|
+
} }[keyof GlobalSystemParameter];
|
|
477
460
|
soundBankManager: { [K in keyof WorkletSBKManagerData]: {
|
|
478
461
|
type: K;
|
|
479
462
|
data: WorkletSBKManagerData[K];
|
|
@@ -484,14 +467,25 @@ interface BasicSynthesizerMessageData {
|
|
|
484
467
|
} }[keyof WorkletKMManagerData];
|
|
485
468
|
destroyWorklet: null;
|
|
486
469
|
}
|
|
470
|
+
interface SynthesizerEventData extends SynthProcessorEventData {
|
|
471
|
+
/**
|
|
472
|
+
* This event gets called when an error occurs while parsing the sound bank.
|
|
473
|
+
*/
|
|
474
|
+
soundBankError: Error;
|
|
475
|
+
}
|
|
476
|
+
type SynthesizerEvent = { [K in keyof SynthesizerEventData]: {
|
|
477
|
+
type: K;
|
|
478
|
+
data: SynthesizerEventData[K];
|
|
479
|
+
} }[keyof SynthesizerEventData];
|
|
487
480
|
interface BasicSynthesizerReturnMessageData {
|
|
488
|
-
eventCall:
|
|
481
|
+
eventCall: SynthesizerEvent;
|
|
489
482
|
sequencerReturn: SequencerReturnMessage;
|
|
490
483
|
isFullyInitialized: { [K in keyof SynthesizerReturn]: {
|
|
491
484
|
type: K;
|
|
492
485
|
data: SynthesizerReturn[K];
|
|
493
486
|
} }[keyof SynthesizerReturn];
|
|
494
487
|
soundBankError: Error;
|
|
488
|
+
voiceCountChange: number[];
|
|
495
489
|
renderingProgress: { [K in keyof SynthesizerProgress]: {
|
|
496
490
|
type: K;
|
|
497
491
|
data: SynthesizerProgress[K];
|
|
@@ -504,11 +498,10 @@ type BasicSynthesizerReturnMessage = { [K in keyof BasicSynthesizerReturnMessage
|
|
|
504
498
|
} }[keyof BasicSynthesizerReturnMessageData];
|
|
505
499
|
interface SynthesizerProgress {
|
|
506
500
|
renderAudio: number;
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
};
|
|
501
|
+
/**
|
|
502
|
+
* Progress amount (0-1)
|
|
503
|
+
*/
|
|
504
|
+
workerSynthWriteFile: number;
|
|
512
505
|
}
|
|
513
506
|
interface SynthesizerReturn {
|
|
514
507
|
sf3Decoder: null;
|
|
@@ -531,20 +524,40 @@ interface SynthesizerReturn {
|
|
|
531
524
|
};
|
|
532
525
|
}
|
|
533
526
|
//#endregion
|
|
534
|
-
//#region src/synthesizer/basic/
|
|
535
|
-
|
|
527
|
+
//#region src/synthesizer/basic/synth_event_handler.d.ts
|
|
528
|
+
type ProcessorEventCallback<T extends keyof SynthesizerEventData> = (callbackData: SynthesizerEventData[T]) => unknown;
|
|
529
|
+
declare class SynthEventHandler {
|
|
536
530
|
/**
|
|
537
|
-
*
|
|
531
|
+
* The time delay before an event is called.
|
|
532
|
+
* Set to 0 to disable it.
|
|
538
533
|
*/
|
|
539
|
-
|
|
534
|
+
timeDelay: number;
|
|
540
535
|
/**
|
|
541
|
-
*
|
|
536
|
+
* The main list of events.
|
|
537
|
+
* @private
|
|
542
538
|
*/
|
|
543
|
-
|
|
539
|
+
private readonly events;
|
|
544
540
|
/**
|
|
545
|
-
*
|
|
541
|
+
* Adds a new event listener.
|
|
542
|
+
* @param event The event to listen to.
|
|
543
|
+
* @param id The unique identifier for the event. It can be used to overwrite existing callback with the same ID.
|
|
544
|
+
* @param callback The callback for the event.
|
|
546
545
|
*/
|
|
547
|
-
|
|
546
|
+
addEvent<T extends keyof SynthesizerEventData>(event: T, id: string, callback: ProcessorEventCallback<T>): void;
|
|
547
|
+
/**
|
|
548
|
+
* Removes an event listener
|
|
549
|
+
* @param name The event to remove a listener from.
|
|
550
|
+
* @param id The unique identifier for the event to remove.
|
|
551
|
+
*/
|
|
552
|
+
removeEvent<T extends keyof SynthesizerEventData>(name: T, id: string): void;
|
|
553
|
+
}
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region src/synthesizer/basic/types.d.ts
|
|
556
|
+
interface SynthConfig {
|
|
557
|
+
/**
|
|
558
|
+
* If the synth should use one output with 32 channels (2 audio channels for each midi channel).
|
|
559
|
+
*/
|
|
560
|
+
oneOutput: boolean;
|
|
548
561
|
/**
|
|
549
562
|
* Custom audio node creation functions for Web Audio wrappers, such as standardized-audio-context.
|
|
550
563
|
* Pass undefined to use the Web Audio API.
|
|
@@ -553,7 +566,7 @@ interface SynthConfig {
|
|
|
553
566
|
/**
|
|
554
567
|
* If the event system should be enabled. This can only be set once.
|
|
555
568
|
*/
|
|
556
|
-
|
|
569
|
+
eventsEnabled: boolean;
|
|
557
570
|
}
|
|
558
571
|
interface AudioNodeCreators {
|
|
559
572
|
/**
|
|
@@ -567,6 +580,56 @@ interface AudioNodeCreators {
|
|
|
567
580
|
}) => AudioWorkletNode;
|
|
568
581
|
}
|
|
569
582
|
//#endregion
|
|
583
|
+
//#region src/synthesizer/basic/lib_midi_channel.d.ts
|
|
584
|
+
declare class LibMIDIChannel {
|
|
585
|
+
/**
|
|
586
|
+
* This channel number.
|
|
587
|
+
* @private
|
|
588
|
+
*/
|
|
589
|
+
private readonly channel;
|
|
590
|
+
private readonly synth;
|
|
591
|
+
private readonly _systemParameters;
|
|
592
|
+
private _patch;
|
|
593
|
+
/**
|
|
594
|
+
* The currently selected MIDI patch of the channel.
|
|
595
|
+
* Note that the exact matching preset may not be available, but this represents exactly what MIDI asks for.
|
|
596
|
+
*/
|
|
597
|
+
get patch(): Readonly<MIDIPatchFull>;
|
|
598
|
+
private _midiParameters;
|
|
599
|
+
/**
|
|
600
|
+
* The channel MIDI parameters of this channel.
|
|
601
|
+
* These are only editable via MIDI messages.
|
|
602
|
+
*/
|
|
603
|
+
get midiParameters(): Readonly<ChannelMIDIParameter>;
|
|
604
|
+
/**
|
|
605
|
+
* The channel system parameters of this channel.
|
|
606
|
+
* These are only editable via the API.
|
|
607
|
+
*/
|
|
608
|
+
get systemParameters(): Readonly<ChannelSystemParameter>;
|
|
609
|
+
private _voiceCount;
|
|
610
|
+
/**
|
|
611
|
+
* The channel's current voice count.
|
|
612
|
+
*/
|
|
613
|
+
get voiceCount(): number;
|
|
614
|
+
/**
|
|
615
|
+
* Toggles drums on a given channel.
|
|
616
|
+
* @param isDrum If the channel should be drums.
|
|
617
|
+
*/
|
|
618
|
+
setDrums(isDrum: boolean): void;
|
|
619
|
+
/**
|
|
620
|
+
* Causes the given midi channel to ignore controller messages for the given controller number.
|
|
621
|
+
* @param controller 0-127 MIDI CC number.
|
|
622
|
+
* @param isLocked True if locked, false if unlocked.
|
|
623
|
+
*/
|
|
624
|
+
lockController(controller: MIDIController, isLocked: boolean): void;
|
|
625
|
+
/**
|
|
626
|
+
* Sets a system parameter of the channel.
|
|
627
|
+
* @param parameter The type of the parameter to set.
|
|
628
|
+
* @param value The value to set for the parameter.
|
|
629
|
+
*/
|
|
630
|
+
setSystemParameter<P extends keyof ChannelSystemParameter>(parameter: P, value: ChannelSystemParameter[P]): void;
|
|
631
|
+
}
|
|
632
|
+
//#endregion
|
|
570
633
|
//#region src/synthesizer/basic/basic_synthesizer.d.ts
|
|
571
634
|
declare abstract class BasicSynthesizer {
|
|
572
635
|
/**
|
|
@@ -588,54 +651,25 @@ declare abstract class BasicSynthesizer {
|
|
|
588
651
|
/**
|
|
589
652
|
* Synth's current channel properties.
|
|
590
653
|
*/
|
|
591
|
-
readonly
|
|
654
|
+
readonly midiChannels: LibMIDIChannel[];
|
|
592
655
|
/**
|
|
593
656
|
* The current preset list.
|
|
594
657
|
*/
|
|
595
|
-
presetList:
|
|
596
|
-
/**
|
|
597
|
-
* INTERNAL USE ONLY!
|
|
598
|
-
* @internal
|
|
599
|
-
* All sequencer callbacks
|
|
600
|
-
*/
|
|
601
|
-
sequencers: ((m: SequencerReturnMessage) => unknown)[];
|
|
658
|
+
presetList: MIDIPatchFull[];
|
|
602
659
|
/**
|
|
603
660
|
* Resolves when the synthesizer is ready.
|
|
604
661
|
*/
|
|
605
662
|
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
663
|
protected readonly worklet: AudioWorkletNode;
|
|
622
664
|
/**
|
|
623
665
|
* The new channels will have their audio sent to the modulated output by this constant.
|
|
624
666
|
* what does that mean?
|
|
625
667
|
* e.g., if outputsAmount is 16, then channel's 16 audio data will be sent to channel 0
|
|
626
668
|
*/
|
|
627
|
-
protected readonly
|
|
628
|
-
|
|
629
|
-
* The current amount of MIDI channels the synthesizer has.
|
|
630
|
-
*/
|
|
631
|
-
channelsAmount: number;
|
|
632
|
-
protected readonly masterParameters: MasterParameterType;
|
|
669
|
+
protected readonly _outputCount = 16;
|
|
670
|
+
protected readonly _systemParameters: GlobalSystemParameter;
|
|
633
671
|
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)>;
|
|
672
|
+
protected renderingProgressTracker: Map<keyof SynthesizerProgress, ((args: number) => unknown) | ((args: number) => unknown)>;
|
|
639
673
|
/**
|
|
640
674
|
* Creates a new instance of a synthesizer.
|
|
641
675
|
* @param worklet The AudioWorkletNode to use.
|
|
@@ -643,18 +677,33 @@ declare abstract class BasicSynthesizer {
|
|
|
643
677
|
* @param config Optional configuration for the synthesizer.
|
|
644
678
|
*/
|
|
645
679
|
protected constructor(worklet: AudioWorkletNode, postFunction: (data: BasicSynthesizerMessage, transfer?: Transferable[]) => unknown, config: SynthConfig);
|
|
680
|
+
protected _midiParameters: GlobalMIDIParameter;
|
|
681
|
+
/**
|
|
682
|
+
* The global MIDI parameters of the synthesizer.
|
|
683
|
+
* These are only editable via MIDI messages.
|
|
684
|
+
*/
|
|
685
|
+
get midiParameters(): Readonly<GlobalMIDIParameter>;
|
|
686
|
+
/**
|
|
687
|
+
* The current channel count of the synthesizer.
|
|
688
|
+
*/
|
|
689
|
+
get channelCount(): number;
|
|
646
690
|
/**
|
|
647
691
|
* Current voice amount
|
|
648
692
|
*/
|
|
649
|
-
protected
|
|
693
|
+
protected _voiceCount: number;
|
|
650
694
|
/**
|
|
651
695
|
* The current number of voices playing.
|
|
652
696
|
*/
|
|
653
|
-
get
|
|
697
|
+
get voiceCount(): number;
|
|
654
698
|
/**
|
|
655
699
|
* The audioContext's current time.
|
|
656
700
|
*/
|
|
657
701
|
get currentTime(): number;
|
|
702
|
+
/**
|
|
703
|
+
* The global system parameters of the synthesizer.
|
|
704
|
+
* These are only editable via the API.
|
|
705
|
+
*/
|
|
706
|
+
get systemParameters(): Readonly<GlobalSystemParameter>;
|
|
658
707
|
/**
|
|
659
708
|
* Connects from a given node.
|
|
660
709
|
* @param destinationNode The node to connect to.
|
|
@@ -673,34 +722,19 @@ declare abstract class BasicSynthesizer {
|
|
|
673
722
|
*/
|
|
674
723
|
setLogLevel(enableInfo: boolean, enableWarning: boolean, enableGroup: boolean): void;
|
|
675
724
|
/**
|
|
676
|
-
*
|
|
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.
|
|
725
|
+
* Sets a system parameter to a given value.
|
|
683
726
|
* @param type The parameter to set.
|
|
684
727
|
* @param value The value to set.
|
|
685
728
|
*/
|
|
686
|
-
|
|
729
|
+
setSystemParameter<K extends keyof GlobalSystemParameter>(type: K, value: GlobalSystemParameter[K]): void;
|
|
687
730
|
/**
|
|
688
731
|
* Gets a complete snapshot of the synthesizer, effects.
|
|
689
732
|
*/
|
|
690
|
-
getSnapshot(): Promise<
|
|
733
|
+
getSnapshot(): Promise<SynthesizerSnapshot>;
|
|
691
734
|
/**
|
|
692
735
|
* Adds a new channel to the synthesizer.
|
|
693
736
|
*/
|
|
694
737
|
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
738
|
/**
|
|
705
739
|
* Connects a given channel output to the given audio node.
|
|
706
740
|
* Note that this output is only meant for visualization and may be silent when Insertion Effect for this channel is enabled.
|
|
@@ -726,11 +760,6 @@ declare abstract class BasicSynthesizer {
|
|
|
726
760
|
* @param audioNodes Exactly 16 outputs.
|
|
727
761
|
*/
|
|
728
762
|
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
763
|
/**
|
|
735
764
|
* Sends a raw MIDI message to the synthesizer.
|
|
736
765
|
* @param message the midi message, each number is a byte.
|
|
@@ -761,24 +790,15 @@ declare abstract class BasicSynthesizer {
|
|
|
761
790
|
/**
|
|
762
791
|
* Changes the given controller
|
|
763
792
|
* @param channel Usually 0-15: the channel to change the controller.
|
|
764
|
-
* @param
|
|
765
|
-
* @param
|
|
793
|
+
* @param controller 0-127 the MIDI CC number.
|
|
794
|
+
* @param value 0-127 the controller value.
|
|
766
795
|
* @param eventOptions Additional options for this command.
|
|
767
796
|
*/
|
|
768
|
-
controllerChange(channel: number,
|
|
797
|
+
controllerChange(channel: number, controller: MIDIController, value: number, eventOptions?: SynthMethodOptions): void;
|
|
769
798
|
/**
|
|
770
|
-
*
|
|
799
|
+
* Fully resets the synthesizer.
|
|
771
800
|
*/
|
|
772
|
-
|
|
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;
|
|
801
|
+
reset(): void;
|
|
782
802
|
/**
|
|
783
803
|
* Applies pressure to a given channel.
|
|
784
804
|
* @param channel Usually 0-15: the channel to change the controller.
|
|
@@ -815,19 +835,6 @@ declare abstract class BasicSynthesizer {
|
|
|
815
835
|
* @param eventOptions Additional options for this command.
|
|
816
836
|
*/
|
|
817
837
|
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
838
|
/**
|
|
832
839
|
* Sends a MIDI Sysex message to the synthesizer.
|
|
833
840
|
* @param messageData The message's data, excluding the F0 byte, but including the F7 at the end.
|
|
@@ -845,29 +852,10 @@ declare abstract class BasicSynthesizer {
|
|
|
845
852
|
sourceKey: number;
|
|
846
853
|
targetPitch: number;
|
|
847
854
|
}[]): 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
|
/**
|
|
855
856
|
* Yes please!
|
|
856
857
|
*/
|
|
857
858
|
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
859
|
protected assignProgressTracker<K extends keyof SynthesizerProgress>(type: K, progressFunction: (args: SynthesizerProgress[K]) => unknown): void;
|
|
872
860
|
protected revokeProgressTracker<K extends keyof SynthesizerProgress>(type: K): void;
|
|
873
861
|
protected _sendInternal(message: Iterable<number>, channelOffset: number, eventOptions: Partial<SynthMethodOptions>): void;
|
|
@@ -877,6 +865,7 @@ declare abstract class BasicSynthesizer {
|
|
|
877
865
|
protected handleMessage(m: BasicSynthesizerReturnMessage): void;
|
|
878
866
|
protected addNewChannelInternal(post: boolean): void;
|
|
879
867
|
protected workletResponds<K extends keyof SynthesizerReturn>(type: K, data: SynthesizerReturn[K]): void;
|
|
868
|
+
private registerInternalEvent;
|
|
880
869
|
}
|
|
881
870
|
//#endregion
|
|
882
871
|
//#region src/synthesizer/worklet/worklet_synthesizer.d.ts
|
|
@@ -988,12 +977,6 @@ declare class SeqEventHandler {
|
|
|
988
977
|
* @param id The unique identifier for the event to remove.
|
|
989
978
|
*/
|
|
990
979
|
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;
|
|
997
980
|
}
|
|
998
981
|
//#endregion
|
|
999
982
|
//#region src/sequencer/sequencer.d.ts
|
|
@@ -1070,8 +1053,8 @@ declare class Sequencer {
|
|
|
1070
1053
|
* The current sequence's length, in seconds.
|
|
1071
1054
|
*/
|
|
1072
1055
|
get duration(): number;
|
|
1073
|
-
private
|
|
1074
|
-
get
|
|
1056
|
+
private _songCount;
|
|
1057
|
+
get songCount(): number;
|
|
1075
1058
|
private _skipToFirstNoteOn;
|
|
1076
1059
|
/**
|
|
1077
1060
|
* Indicates if the sequencer should skip to first note on.
|