spessasynth_lib 4.1.5 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { MIDIPatch, KeyModifier, SoundBankManagerListEntry, SynthProcessorEventData, BasicMIDI, MIDITrack, SequencerEvent, MIDIMessage, SpessaSynthProcessor, SpessaSynthSequencer, SynthProcessorOptions, BasicSoundBank, SoundFont2WriteOptions, DLSWriteOptions, RMIDIWriteOptions, SynthesizerSnapshot, SynthMethodOptions, CustomController, MIDIController, MasterParameterType, SynthProcessorEvent, ChannelSnapshot, ChannelProperty, PresetList, WaveWriteOptions } from 'spessasynth_core';
1
+ import { MIDIPatch, KeyModifier, SoundBankManagerListEntry, SynthProcessorEventData, BasicMIDI, MIDITrack, SequencerEvent, MIDIMessage, SpessaSynthProcessor, SpessaSynthSequencer, SynthProcessorOptions, BasicSoundBank, SoundFont2WriteOptions, DLSWriteOptions, RMIDIWriteOptions, SynthesizerSnapshot, SynthMethodOptions, CustomController, MIDIController, MasterParameterType, SynthProcessorEvent, ChannelProperty, PresetList, WaveWriteOptions } from 'spessasynth_core';
2
2
 
3
3
  declare class WorkletKeyModifierManagerWrapper {
4
4
  private keyModifiers;
@@ -245,7 +245,7 @@ declare abstract class BasicSynthesizerCore {
245
245
  * @protected
246
246
  */
247
247
  protected alive: boolean;
248
- protected constructor(sampleRate: number, options: SynthProcessorOptions, postMessage: PostMessageSynthCore);
248
+ protected constructor(sampleRate: number, options: Omit<SynthProcessorOptions, "reverbProcessor" | "chorusProcessor" | "delayProcessor">, postMessage: PostMessageSynthCore);
249
249
  protected createNewSequencer(): void;
250
250
  protected postReady<K extends keyof SynthesizerReturn>(type: K, data: SynthesizerReturn[K], transferable?: Transferable[]): void;
251
251
  protected postProgress<K extends keyof SynthesizerProgress>(type: K, data: SynthesizerProgress[K]): void;
@@ -431,11 +431,6 @@ interface BasicSynthesizerMessageData {
431
431
  options: SynthMethodOptions;
432
432
  };
433
433
  ccReset: null;
434
- setChannelVibrato: {
435
- rate: number;
436
- depth: number;
437
- delay: number;
438
- };
439
434
  stopAll: number;
440
435
  muteChannel: boolean;
441
436
  addNewChannel: null;
@@ -518,8 +513,7 @@ interface SynthesizerReturn {
518
513
  startOfflineRender: null;
519
514
  synthesizerSnapshot: SynthesizerSnapshot;
520
515
  renderAudio: {
521
- reverb: [Float32Array, Float32Array];
522
- chorus: [Float32Array, Float32Array];
516
+ effects: [Float32Array, Float32Array];
523
517
  dry: [Float32Array, Float32Array][];
524
518
  };
525
519
  workerSynthWriteFile: {
@@ -540,17 +534,13 @@ interface SynthConfig {
540
534
  */
541
535
  oneOutput: boolean;
542
536
  /**
543
- * If the chorus processor should be initialized during creation.
544
- * Note that setting this to false will not allow it to be used later.
545
- * If you want to enable it at some point, set this to true and set the chorus gain to 0.
537
+ * @deprecated Deprecated parameter, does nothing.
546
538
  */
547
- initializeChorusProcessor: boolean;
539
+ initializeChorusProcessor?: boolean;
548
540
  /**
549
- * If the reverb processor should be initialized during creation.
550
- * Note that setting this to false will not allow it to be used later.
551
- * If you want to enable it at some point, set this to true and set the reverb gain to 0.
541
+ * @deprecated Deprecated parameter, does nothing.
552
542
  */
553
- initializeReverbProcessor: boolean;
543
+ initializeReverbProcessor?: boolean;
554
544
  /**
555
545
  * Custom audio node creation functions for Web Audio wrappers, such as standardized-audio-context.
556
546
  * Pass undefined to use the Web Audio API.
@@ -561,9 +551,6 @@ interface SynthConfig {
561
551
  */
562
552
  enableEventSystem: boolean;
563
553
  }
564
- interface BasicEffectConfig {
565
- null?: null;
566
- }
567
554
  interface AudioNodeCreators {
568
555
  /**
569
556
  * A custom creator for an AudioWorkletNode.
@@ -575,133 +562,6 @@ interface AudioNodeCreators {
575
562
  processorOptions: PassedProcessorParameters;
576
563
  }) => AudioWorkletNode;
577
564
  }
578
- interface ReverbConfig extends BasicEffectConfig {
579
- /**
580
- * The impulse response for the reverb. Pass undefined to use default one.
581
- */
582
- impulseResponse?: AudioBuffer;
583
- }
584
- interface ChorusConfig extends BasicEffectConfig {
585
- /**
586
- * The amount of delay nodes (for each channel) and the corresponding oscillators.
587
- */
588
- nodesAmount: number;
589
- /**
590
- * The initial delay, in seconds.
591
- */
592
- defaultDelay: number;
593
- /**
594
- * The difference between delays in the delay nodes.
595
- */
596
- delayVariation: number;
597
- /**
598
- * The difference of delays between two channels (added to the right channel).
599
- */
600
- stereoDifference: number;
601
- /**
602
- * The initial delay time oscillator frequency, in Hz.
603
- */
604
- oscillatorFrequency: number;
605
- /**
606
- * The difference between frequencies of oscillators, in Hz.
607
- */
608
- oscillatorFrequencyVariation: number;
609
- /**
610
- * How much will oscillator alter the delay in delay nodes, in seconds.
611
- */
612
- oscillatorGain: number;
613
- }
614
-
615
- declare abstract class BasicEffectsProcessor {
616
- readonly input: AudioNode;
617
- protected readonly output: AudioNode;
618
- protected constructor(input: AudioNode, output: AudioNode);
619
- abstract get config(): BasicEffectConfig;
620
- abstract update(config: BasicEffectConfig): void;
621
- /**
622
- * Connects the processor to a given node.
623
- * @param destinationNode The node to connect to.
624
- */
625
- connect(destinationNode: AudioNode): AudioNode;
626
- /**
627
- * Disconnects the processor from a given node.
628
- * @param destinationNode The node to disconnect from.
629
- */
630
- disconnect(destinationNode?: AudioNode): void;
631
- /**
632
- * Disconnects the effect processor.
633
- */
634
- delete(): void;
635
- }
636
-
637
- /**
638
- * Fancy_chorus.js
639
- * purpose: creates a simple chorus effect node
640
- */
641
-
642
- declare class ChorusProcessor extends BasicEffectsProcessor {
643
- private readonly chorusLeft;
644
- private readonly chorusRight;
645
- /**
646
- * Creates a fancy chorus effect.
647
- * @param context The audio context.
648
- * @param config The configuration for the chorus.
649
- */
650
- constructor(context: BaseAudioContext, config?: Partial<ChorusConfig>);
651
- private _config;
652
- get config(): ChorusConfig;
653
- /**
654
- * Updates the chorus with a given config.
655
- * @param chorusConfig The config to use.
656
- */
657
- update(chorusConfig: Partial<ChorusConfig>): void;
658
- /**
659
- * Disconnects and deletes the chorus effect.
660
- */
661
- delete(): void;
662
- private deleteNodes;
663
- private createChorusNode;
664
- }
665
-
666
- declare class ReverbProcessor extends BasicEffectsProcessor {
667
- /**
668
- * Indicates that the reverb is ready.
669
- */
670
- readonly isReady: Promise<AudioBuffer>;
671
- private conv;
672
- /**
673
- * Creates a new reverb processor.
674
- * @param context The context to use.
675
- * @param config The reverb configuration.
676
- */
677
- constructor(context: BaseAudioContext, config?: Partial<ReverbConfig>);
678
- private _config;
679
- get config(): ReverbConfig;
680
- /**
681
- * Updates the reverb with a given config.
682
- * @param config The config to use.
683
- */
684
- update(config: Partial<ReverbConfig>): void;
685
- }
686
-
687
- /**
688
- * Extended synthesizer snapshot to contain effects
689
- */
690
- declare class LibSynthesizerSnapshot extends SynthesizerSnapshot {
691
- /**
692
- * Chorus configuration of this synthesizer.
693
- */
694
- chorusConfig: ChorusConfig;
695
- /**
696
- * Reverb configuration of this synthesizer.
697
- */
698
- reverbConfig: ReverbConfig;
699
- constructor(channelSnapshots: ChannelSnapshot[], masterParameters: MasterParameterType, keyMappings: (KeyModifier | undefined)[][], chorusConfig?: ChorusConfig, reverbConfig?: ReverbConfig);
700
- /**
701
- * Retrieves the SynthesizerSnapshot from the lib snapshot.
702
- */
703
- getCoreSnapshot(): SynthesizerSnapshot;
704
- }
705
565
 
706
566
  declare abstract class BasicSynthesizer {
707
567
  /**
@@ -739,15 +599,15 @@ declare abstract class BasicSynthesizer {
739
599
  */
740
600
  readonly isReady: Promise<unknown>;
741
601
  /**
742
- * Synthesizer's reverb processor.
743
- * Undefined if reverb is disabled.
602
+ * Legacy parameter.
603
+ * @deprecated
744
604
  */
745
- readonly reverbProcessor?: ReverbProcessor;
605
+ readonly reverbProcessor: undefined;
746
606
  /**
747
- * Synthesizer's chorus processor.
748
- * Undefined if chorus is disabled.
607
+ * Legacy parameter.
608
+ * @deprecated
749
609
  */
750
- readonly chorusProcessor?: ChorusProcessor;
610
+ readonly chorusProcessor: undefined;
751
611
  /**
752
612
  * INTERNAL USE ONLY!
753
613
  * @internal
@@ -822,15 +682,14 @@ declare abstract class BasicSynthesizer {
822
682
  /**
823
683
  * Gets a complete snapshot of the synthesizer, effects.
824
684
  */
825
- getSnapshot(): Promise<LibSynthesizerSnapshot>;
685
+ getSnapshot(): Promise<SynthesizerSnapshot>;
826
686
  /**
827
687
  * Adds a new channel to the synthesizer.
828
688
  */
829
689
  addNewChannel(): void;
830
690
  /**
831
- * Sets custom vibrato for the channel.
832
- * @param channel The channel number.
833
- * @param value The vibrato parameters.
691
+ * DEPRECATED, please don't use it!
692
+ * @deprecated
834
693
  */
835
694
  setVibrato(channel: number, value: {
836
695
  delay: number;
@@ -849,6 +708,7 @@ declare abstract class BasicSynthesizer {
849
708
  disconnectIndividualOutputs(audioNodes: AudioNode[]): void;
850
709
  /**
851
710
  * Disables the GS NRPN parameters like vibrato or drum key tuning.
711
+ * @deprecated Deprecated! Please use master parameters
852
712
  */
853
713
  disableGSNPRNParams(): void;
854
714
  /**
@@ -1377,4 +1237,4 @@ declare class WebMIDILinkHandler {
1377
1237
 
1378
1238
  declare const DEFAULT_SYNTH_CONFIG: SynthConfig;
1379
1239
 
1380
- export { BasicSynthesizer, ChorusProcessor, DEFAULT_SYNTH_CONFIG, MIDIDeviceHandler, ReverbProcessor, Sequencer, WebMIDILinkHandler, WorkerSynthesizer, WorkerSynthesizerCore, WorkletSynthesizer, audioBufferToWav };
1240
+ export { BasicSynthesizer, DEFAULT_SYNTH_CONFIG, MIDIDeviceHandler, Sequencer, WebMIDILinkHandler, WorkerSynthesizer, WorkerSynthesizerCore, WorkletSynthesizer, audioBufferToWav };