spessasynth_core 4.2.4 → 4.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +62 -26
- package/dist/index.js +2607 -2547
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -135,8 +135,12 @@ declare const generatorTypes: Readonly<{
|
|
|
135
135
|
readonly overridingRootKey: 58;
|
|
136
136
|
readonly unused5: 59;
|
|
137
137
|
readonly endOper: 60;
|
|
138
|
-
readonly
|
|
139
|
-
readonly
|
|
138
|
+
readonly amplitude: 61;
|
|
139
|
+
readonly vibLfoRate: 62;
|
|
140
|
+
readonly vibLfoAmplitudeDepth: 63;
|
|
141
|
+
readonly vibLfoToFilterFc: 64;
|
|
142
|
+
readonly modLfoRate: 65;
|
|
143
|
+
readonly modLfoAmplitudeDepth: 66;
|
|
140
144
|
}>;
|
|
141
145
|
type GeneratorType = (typeof generatorTypes)[keyof typeof generatorTypes];
|
|
142
146
|
declare const GENERATORS_AMOUNT: number;
|
|
@@ -422,10 +426,9 @@ declare class VolumeEnvelope {
|
|
|
422
426
|
* @param sampleCount the amount of samples to write
|
|
423
427
|
* @param buffer the audio buffer to modify
|
|
424
428
|
* @param gainTarget the gain target to smooth.
|
|
425
|
-
* @param centibelOffset the centibel offset to apply.
|
|
426
429
|
* @returns if the voice is still active
|
|
427
430
|
*/
|
|
428
|
-
process(sampleCount: number, buffer: Float32Array, gainTarget: number
|
|
431
|
+
process(sampleCount: number, buffer: Float32Array, gainTarget: number): boolean;
|
|
429
432
|
/**
|
|
430
433
|
* Starts the release phase in the envelope.
|
|
431
434
|
* @param voice the voice this envelope belongs to.
|
|
@@ -1088,7 +1091,7 @@ interface InsertionProcessorSnapshot {
|
|
|
1088
1091
|
*/
|
|
1089
1092
|
channels: boolean[];
|
|
1090
1093
|
}
|
|
1091
|
-
type InsertionProcessorConstructor = new (sampleRate: number) => InsertionProcessor;
|
|
1094
|
+
type InsertionProcessorConstructor = new (sampleRate: number, maxBufferSize: number) => InsertionProcessor;
|
|
1092
1095
|
|
|
1093
1096
|
type SynthSystem = "gm" | "gm2" | "gs" | "xg";
|
|
1094
1097
|
interface NoteOnCallback {
|
|
@@ -1400,6 +1403,12 @@ interface ChannelProperty {
|
|
|
1400
1403
|
transposition: number;
|
|
1401
1404
|
}
|
|
1402
1405
|
interface SynthProcessorOptions {
|
|
1406
|
+
/**
|
|
1407
|
+
* The maximum buffer size the synthesizer can render at once.
|
|
1408
|
+
* Attempting to `.process()` more samples than this will result in an error.
|
|
1409
|
+
* Defaults to 128.
|
|
1410
|
+
*/
|
|
1411
|
+
maxBufferSize: number;
|
|
1403
1412
|
/**
|
|
1404
1413
|
* Indicates if the event system is enabled. This can be changed later.
|
|
1405
1414
|
*/
|
|
@@ -1415,15 +1424,15 @@ interface SynthProcessorOptions {
|
|
|
1415
1424
|
/**
|
|
1416
1425
|
* Reverb processor for the synthesizer. Leave undefined to use the default.
|
|
1417
1426
|
*/
|
|
1418
|
-
reverbProcessor
|
|
1427
|
+
reverbProcessor?: ReverbProcessor;
|
|
1419
1428
|
/**
|
|
1420
1429
|
* Chorus processor for the synthesizer. Leave undefined to use the default.
|
|
1421
1430
|
*/
|
|
1422
|
-
chorusProcessor
|
|
1431
|
+
chorusProcessor?: ChorusProcessor;
|
|
1423
1432
|
/**
|
|
1424
1433
|
* Delay processor for the synthesizer. Leave undefined to use the default.
|
|
1425
1434
|
*/
|
|
1426
|
-
delayProcessor
|
|
1435
|
+
delayProcessor?: DelayProcessor;
|
|
1427
1436
|
}
|
|
1428
1437
|
/**
|
|
1429
1438
|
* The master parameters of the synthesizer.
|
|
@@ -1642,11 +1651,6 @@ declare class Voice {
|
|
|
1642
1651
|
* Volume envelope.
|
|
1643
1652
|
*/
|
|
1644
1653
|
readonly volEnv: VolumeEnvelope;
|
|
1645
|
-
/**
|
|
1646
|
-
* The buffer to use when rendering the voice (to avoid memory allocations)
|
|
1647
|
-
* If the user supplied a larger one, it must be resized.
|
|
1648
|
-
*/
|
|
1649
|
-
buffer: Float32Array<ArrayBuffer>;
|
|
1650
1654
|
/**
|
|
1651
1655
|
* Resonance offset, it is affected by the default resonant modulator
|
|
1652
1656
|
*/
|
|
@@ -1773,6 +1777,10 @@ declare class Voice {
|
|
|
1773
1777
|
* Used for exclusive notes and killing notes.
|
|
1774
1778
|
*/
|
|
1775
1779
|
overrideReleaseVolEnv: number;
|
|
1780
|
+
vibLfoPhase: number;
|
|
1781
|
+
vibLfoStartTime: number;
|
|
1782
|
+
modLfoPhase: number;
|
|
1783
|
+
modLfoStartTime: number;
|
|
1776
1784
|
constructor(sampleRate: number);
|
|
1777
1785
|
/**
|
|
1778
1786
|
* Computes a given modulator
|
|
@@ -1960,7 +1968,7 @@ declare class Generator {
|
|
|
1960
1968
|
* Constructs a new generator
|
|
1961
1969
|
* @param type generator type
|
|
1962
1970
|
* @param value generator value
|
|
1963
|
-
* @param validate if the limits should be validated
|
|
1971
|
+
* @param validate if the limits should be validated and clamped.
|
|
1964
1972
|
*/
|
|
1965
1973
|
constructor(type: GeneratorType, value: number, validate?: boolean);
|
|
1966
1974
|
write(genData: IndexedByteArray): void;
|
|
@@ -1998,18 +2006,34 @@ declare class BasicZone {
|
|
|
1998
2006
|
set fineTuning(tuningCents: number);
|
|
1999
2007
|
/**
|
|
2000
2008
|
* Adds to a given generator, or its default value.
|
|
2009
|
+
* @param type the generator type.
|
|
2010
|
+
* @param value the value to add.
|
|
2011
|
+
* @param validate if the value should be clamped to allowed limits.
|
|
2001
2012
|
*/
|
|
2002
2013
|
addToGenerator(type: GeneratorType, value: number, validate?: boolean): void;
|
|
2003
2014
|
/**
|
|
2004
2015
|
* Sets a generator to a given value if preset, otherwise adds a new one.
|
|
2016
|
+
* @param type the generator type.
|
|
2017
|
+
* @param value the value to set. Set to null to remove this generator (set as "unset").
|
|
2018
|
+
* @param validate if the value should be clamped to allowed limits.
|
|
2005
2019
|
*/
|
|
2006
2020
|
setGenerator(type: GeneratorType, value: number | null, validate?: boolean): void;
|
|
2007
2021
|
/**
|
|
2008
2022
|
* Adds generators to the zone.
|
|
2009
|
-
* @param generators
|
|
2023
|
+
* @param generators the generators to add.
|
|
2010
2024
|
*/
|
|
2011
2025
|
addGenerators(...generators: Generator[]): void;
|
|
2026
|
+
/**
|
|
2027
|
+
* Adds modulators to the zone.
|
|
2028
|
+
* @param modulators the modulators to add.
|
|
2029
|
+
*/
|
|
2012
2030
|
addModulators(...modulators: Modulator[]): void;
|
|
2031
|
+
/**
|
|
2032
|
+
* Gets a generator value.
|
|
2033
|
+
* @param generatorType the generator type.
|
|
2034
|
+
* @param notFoundValue if the generator is not found, this value is returned. A default value can be passed here, or null for example,
|
|
2035
|
+
* to check if the generator is set.
|
|
2036
|
+
*/
|
|
2013
2037
|
getGenerator<K>(generatorType: GeneratorType, notFoundValue: number | K): number | K;
|
|
2014
2038
|
copyFrom(zone: BasicZone): void;
|
|
2015
2039
|
/**
|
|
@@ -2784,7 +2808,11 @@ declare class DynamicModulatorSystem {
|
|
|
2784
2808
|
mod: Modulator;
|
|
2785
2809
|
id: string;
|
|
2786
2810
|
}[];
|
|
2811
|
+
active: boolean;
|
|
2812
|
+
private readonly channelNumber;
|
|
2813
|
+
constructor(channelNumber: number);
|
|
2787
2814
|
resetModulators(): void;
|
|
2815
|
+
setupReceiver(addr3: number, data: number, source: number, sourceName: string, bipolar?: boolean): void;
|
|
2788
2816
|
/**
|
|
2789
2817
|
* @param source Like in midiControllers: values below NON_CC_INDEX_OFFSET are CCs,
|
|
2790
2818
|
* above are regular modulator sources.
|
|
@@ -2793,7 +2821,7 @@ declare class DynamicModulatorSystem {
|
|
|
2793
2821
|
* @param isBipolar If true, the modulation is bipolar (ranges from -1 to 1 instead of from 0 to 1).
|
|
2794
2822
|
* @param isNegative If true, the modulation is negative (goes from 1 to 0 instead of from 0 to 1).
|
|
2795
2823
|
*/
|
|
2796
|
-
setModulator
|
|
2824
|
+
private setModulator;
|
|
2797
2825
|
private getModulatorID;
|
|
2798
2826
|
private deleteModulator;
|
|
2799
2827
|
}
|
|
@@ -2869,26 +2897,34 @@ declare class SynthesizerCore {
|
|
|
2869
2897
|
* All MIDI channels of the synthesizer.
|
|
2870
2898
|
*/
|
|
2871
2899
|
readonly midiChannels: MIDIChannel[];
|
|
2900
|
+
/**
|
|
2901
|
+
* The maximum allowed buffer size to render.
|
|
2902
|
+
*/
|
|
2903
|
+
readonly maxBufferSize: number;
|
|
2904
|
+
/**
|
|
2905
|
+
* The buffer to use when rendering a voice.
|
|
2906
|
+
*/
|
|
2907
|
+
readonly voiceBuffer: Float32Array<ArrayBuffer>;
|
|
2872
2908
|
/**
|
|
2873
2909
|
* The insertion processor's left input buffer.
|
|
2874
2910
|
*/
|
|
2875
|
-
insertionInputL: Float32Array<ArrayBuffer>;
|
|
2911
|
+
readonly insertionInputL: Float32Array<ArrayBuffer>;
|
|
2876
2912
|
/**
|
|
2877
2913
|
* The insertion processor's right input buffer.
|
|
2878
2914
|
*/
|
|
2879
|
-
insertionInputR: Float32Array<ArrayBuffer>;
|
|
2915
|
+
readonly insertionInputR: Float32Array<ArrayBuffer>;
|
|
2880
2916
|
/**
|
|
2881
2917
|
* The reverb processor's input buffer.
|
|
2882
2918
|
*/
|
|
2883
|
-
reverbInput: Float32Array<ArrayBuffer>;
|
|
2919
|
+
readonly reverbInput: Float32Array<ArrayBuffer>;
|
|
2884
2920
|
/**
|
|
2885
2921
|
* The chorus processor's input buffer.
|
|
2886
2922
|
*/
|
|
2887
|
-
chorusInput: Float32Array<ArrayBuffer>;
|
|
2923
|
+
readonly chorusInput: Float32Array<ArrayBuffer>;
|
|
2888
2924
|
/**
|
|
2889
2925
|
* The delay processor's input buffer.
|
|
2890
2926
|
*/
|
|
2891
|
-
delayInput: Float32Array<ArrayBuffer>;
|
|
2927
|
+
readonly delayInput: Float32Array<ArrayBuffer>;
|
|
2892
2928
|
/**
|
|
2893
2929
|
* Delay is not used outside SC-88+ MIDIs, this is an optimization.
|
|
2894
2930
|
*/
|
|
@@ -3286,7 +3322,7 @@ declare class MIDIChannel {
|
|
|
3286
3322
|
/**
|
|
3287
3323
|
* A system for dynamic modulator assignment for advanced system exclusives.
|
|
3288
3324
|
*/
|
|
3289
|
-
sysExModulators: DynamicModulatorSystem;
|
|
3325
|
+
readonly sysExModulators: DynamicModulatorSystem;
|
|
3290
3326
|
/**
|
|
3291
3327
|
* The key shift of the channel (in semitones).
|
|
3292
3328
|
*/
|
|
@@ -3304,12 +3340,12 @@ declare class MIDIChannel {
|
|
|
3304
3340
|
*/
|
|
3305
3341
|
insertionEnabled: boolean;
|
|
3306
3342
|
/**
|
|
3307
|
-
* CC1 for GS
|
|
3343
|
+
* CC1 for GS controller matrix.
|
|
3308
3344
|
* An arbitrary MIDI controller, which can be bound to any synthesis parameter.
|
|
3309
3345
|
*/
|
|
3310
3346
|
cc1: number;
|
|
3311
3347
|
/**
|
|
3312
|
-
* CC2 for GS
|
|
3348
|
+
* CC2 for GS controller matrix.
|
|
3313
3349
|
* An arbitrary MIDI controller, which can be bound to any synthesis parameter.
|
|
3314
3350
|
*/
|
|
3315
3351
|
cc2: number;
|
|
@@ -3602,7 +3638,7 @@ declare class SpessaSynthProcessor {
|
|
|
3602
3638
|
*/
|
|
3603
3639
|
onEventCall?: (event: SynthProcessorEvent) => unknown;
|
|
3604
3640
|
/**
|
|
3605
|
-
* Renders float32 audio data to stereo outputs; buffer size
|
|
3641
|
+
* Renders float32 audio data to stereo outputs; buffer size must be equal or smaller than `maxBufferSize`
|
|
3606
3642
|
* All float arrays must have the same length.
|
|
3607
3643
|
* @param left the left output channel.
|
|
3608
3644
|
* @param right the right output channel.
|
|
@@ -3611,7 +3647,7 @@ declare class SpessaSynthProcessor {
|
|
|
3611
3647
|
*/
|
|
3612
3648
|
readonly process: (left: Float32Array, right: Float32Array, startIndex?: number, sampleCount?: number) => void;
|
|
3613
3649
|
/**
|
|
3614
|
-
* Renders float32 audio data to stereo outputs; buffer size
|
|
3650
|
+
* Renders float32 audio data to stereo outputs; buffer size must be equal or smaller than `maxBufferSize
|
|
3615
3651
|
* All float arrays must have the same length.
|
|
3616
3652
|
* @param outputs any number stereo pairs (L, R) to render channels separately into.
|
|
3617
3653
|
* @param effectsLeft the left stereo effect output buffer.
|