spessasynth_core 4.4.6 → 4.4.8
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 +367 -48
- package/dist/index.js +612 -194
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,35 @@ export interface WaveWriteOptions {
|
|
|
31
31
|
*/
|
|
32
32
|
metadata: Partial<WaveMetadata>;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* The result of reading a WAVE file with {@link wavToAudio}.
|
|
36
|
+
*
|
|
37
|
+
* @group Utilities
|
|
38
|
+
*/
|
|
39
|
+
export interface WaveReadResult {
|
|
40
|
+
/**
|
|
41
|
+
* The PCM audio data, one array per channel.
|
|
42
|
+
*/
|
|
43
|
+
audioData: Float32Array[];
|
|
44
|
+
/**
|
|
45
|
+
* The sample rate, in Hertz.
|
|
46
|
+
*/
|
|
47
|
+
sampleRate: number;
|
|
48
|
+
/**
|
|
49
|
+
* The loop of the file, undefined if it has none.
|
|
50
|
+
* The points are in sample frames, not seconds.
|
|
51
|
+
*/
|
|
52
|
+
loop?: {
|
|
53
|
+
/**
|
|
54
|
+
* The loop start, in sample frames.
|
|
55
|
+
*/
|
|
56
|
+
start: number;
|
|
57
|
+
/**
|
|
58
|
+
* The loop end, in sample frames.
|
|
59
|
+
*/
|
|
60
|
+
end: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
34
63
|
/**
|
|
35
64
|
* Metadata to write into a WAVE file.
|
|
36
65
|
*
|
|
@@ -148,6 +177,25 @@ declare function readVariableLengthQuantity(midiByteArray: IndexedByteArray): nu
|
|
|
148
177
|
* @group Utilities
|
|
149
178
|
*/
|
|
150
179
|
export declare function audioToWav(audioData: Float32Array[], sampleRate: number, options?: Partial<WaveWriteOptions>): ArrayBuffer;
|
|
180
|
+
/**
|
|
181
|
+
* Reads a WAVE file into PCM audio data, the counterpart of {@link audioToWav}.
|
|
182
|
+
*
|
|
183
|
+
* It reads 8, 16, 24 and 32-bit integer PCM and 32 and 64-bit float files (including `WAVE_FORMAT_EXTENSIBLE`).
|
|
184
|
+
* The loop is read from the first loop of the `smpl` chunk. Without one, the first two points of the `cue ` chunk
|
|
185
|
+
* are taken as the loop start and end, which is how {@link audioToWav} writes it.
|
|
186
|
+
* Other files may use cue points as plain markers, so such a loop is only reliable for files written by core.
|
|
187
|
+
*
|
|
188
|
+
* > **Note**
|
|
189
|
+
* >
|
|
190
|
+
* > The returned loop end is exclusive, like the SoundFont loop end.
|
|
191
|
+
*
|
|
192
|
+
* @param buffer The binary WAVE file.
|
|
193
|
+
* @returns The audio data (one array per channel), the sample rate and the loop, if the file has one.
|
|
194
|
+
* @throws Error if the file is not a valid or supported WAVE file.
|
|
195
|
+
*
|
|
196
|
+
* @group Utilities
|
|
197
|
+
*/
|
|
198
|
+
export declare function wavToAudio(buffer: ArrayBuffer): WaveReadResult;
|
|
151
199
|
/**
|
|
152
200
|
* SpessaSynth can print out additional info to the console or print nothing at all.
|
|
153
201
|
*
|
|
@@ -353,17 +401,6 @@ export interface GeneratorLimit {
|
|
|
353
401
|
* SoundFont2 NRPN scale factor for this generator type.
|
|
354
402
|
*/
|
|
355
403
|
nrpn: number;
|
|
356
|
-
/**
|
|
357
|
-
* Minimum value of this generator in a preset zone.
|
|
358
|
-
* Preset generators are offsets added to the instrument, so they can go below the instrument range.
|
|
359
|
-
* If not set, it is the same as `min`.
|
|
360
|
-
*/
|
|
361
|
-
presetMin?: number;
|
|
362
|
-
/**
|
|
363
|
-
* Maximum value of this generator in a preset zone.
|
|
364
|
-
* If not set, it is the same as `max`.
|
|
365
|
-
*/
|
|
366
|
-
presetMax?: number;
|
|
367
404
|
}
|
|
368
405
|
/**
|
|
369
406
|
* Limits and defaults for all the {@link BasicSoundBank} generator types.
|
|
@@ -524,6 +561,15 @@ export declare class ModulatorSource {
|
|
|
524
561
|
* This field specifies how the minimum value approaches the maximum value.
|
|
525
562
|
*/
|
|
526
563
|
curveType: ModulatorCurveType;
|
|
564
|
+
/**
|
|
565
|
+
* Creates a new modulator source.
|
|
566
|
+
* @param index The controller or MIDI CC number, see `isCC`.
|
|
567
|
+
* @param curveType How the minimum value approaches the maximum value.
|
|
568
|
+
* @param isCC If the index is a MIDI CC instead of a general controller.
|
|
569
|
+
* @param isBipolar If the source is bipolar (-1 to 1) instead of unipolar (0 to 1).
|
|
570
|
+
* @param isNegative If the direction of the source is flipped.
|
|
571
|
+
*/
|
|
572
|
+
constructor(index?: ModulatorSourceIndex, curveType?: ModulatorCurveType, isCC?: boolean, isBipolar?: boolean, isNegative?: boolean);
|
|
527
573
|
private get sourceName();
|
|
528
574
|
private get curveTypeName();
|
|
529
575
|
toString(): string;
|
|
@@ -1090,6 +1136,7 @@ export declare class BasicSoundBank {
|
|
|
1090
1136
|
* @param options Options associated with setting the sample format.
|
|
1091
1137
|
* @returns The samples whose sample rate or loop points changed.
|
|
1092
1138
|
* Compressing resamples samples outside 8000 to 96000 Hz.
|
|
1139
|
+
* @throws Error if `rejectOnFailure` is set and one of the samples has failed to compress.
|
|
1093
1140
|
*/
|
|
1094
1141
|
setSampleFormat(options: SetSampleFormatOptions): Promise<BasicSample[]>;
|
|
1095
1142
|
/**
|
|
@@ -1187,8 +1234,10 @@ export declare class BasicSoundBank {
|
|
|
1187
1234
|
clonePreset(preset: BasicPreset, options?: Partial<SoundBankCloneOptions>): BasicPreset;
|
|
1188
1235
|
/**
|
|
1189
1236
|
* Updates internal values. Call after updating the preset list.
|
|
1237
|
+
* @param sort If the presets should be sorted. Set it to `false` to keep a custom order,
|
|
1238
|
+
* only the internal values (like {@link isXGBank}) are then recomputed.
|
|
1190
1239
|
*/
|
|
1191
|
-
flush(): void;
|
|
1240
|
+
flush(sort?: boolean): void;
|
|
1192
1241
|
/**
|
|
1193
1242
|
* Trims the sound bank _in-place_ to only contain samples in a given MIDI file.
|
|
1194
1243
|
*
|
|
@@ -1236,6 +1285,7 @@ export declare class BasicSoundBank {
|
|
|
1236
1285
|
* Deletes everything irreversibly.
|
|
1237
1286
|
*/
|
|
1238
1287
|
destroySoundBank(): void;
|
|
1288
|
+
protected addElements<T>(list: T[], elements: readonly T[]): void;
|
|
1239
1289
|
protected parsingError(error: string): never;
|
|
1240
1290
|
/**
|
|
1241
1291
|
* Parses the bank after loading is done
|
|
@@ -1254,16 +1304,6 @@ interface LinkableZoneChild<P> {
|
|
|
1254
1304
|
* The element's name.
|
|
1255
1305
|
*/
|
|
1256
1306
|
name: string;
|
|
1257
|
-
/**
|
|
1258
|
-
* Links the element to a parent.
|
|
1259
|
-
* @param parent The parent that uses the element.
|
|
1260
|
-
*/
|
|
1261
|
-
linkTo(parent: P): void;
|
|
1262
|
-
/**
|
|
1263
|
-
* Unlinks the element from a parent.
|
|
1264
|
-
* @param parent The parent that no longer uses the element.
|
|
1265
|
-
*/
|
|
1266
|
-
unlinkFrom(parent: P): void;
|
|
1267
1307
|
}
|
|
1268
1308
|
/**
|
|
1269
1309
|
* A zone that belongs to a parent and uses a child: a preset zone with its instrument,
|
|
@@ -1297,6 +1337,15 @@ export declare abstract class BasicLinkedZone<P, C extends LinkableZoneChild<P>>
|
|
|
1297
1337
|
* @param link If the child should be linked to the parent.
|
|
1298
1338
|
*/
|
|
1299
1339
|
protected constructor(parent: P, child: C, link: boolean);
|
|
1340
|
+
/**
|
|
1341
|
+
* Links the child to the parent, unless this zone was created without linking.
|
|
1342
|
+
* Use it to put a zone back after {@link unlinkChild}, for example when undoing a zone deletion.
|
|
1343
|
+
*/
|
|
1344
|
+
linkChild(): void;
|
|
1345
|
+
/**
|
|
1346
|
+
* Unlinks the child from the parent, unless this zone was created without linking.
|
|
1347
|
+
*/
|
|
1348
|
+
unlinkChild(): void;
|
|
1300
1349
|
/**
|
|
1301
1350
|
* Replaces the child, moving the link from the previous one to the new one.
|
|
1302
1351
|
* @param child The new child.
|
|
@@ -1378,11 +1427,6 @@ export declare class BasicInstrument {
|
|
|
1378
1427
|
* > An instrument with unlinked zones must not be added to a sound bank!
|
|
1379
1428
|
*/
|
|
1380
1429
|
createZone(sample: BasicSample, link?: boolean): BasicInstrumentZone;
|
|
1381
|
-
/**
|
|
1382
|
-
* Unlinks the instrument from a given preset.
|
|
1383
|
-
* @param preset The preset to unlink from.
|
|
1384
|
-
*/
|
|
1385
|
-
unlinkFrom(preset: BasicPreset): void;
|
|
1386
1430
|
/**
|
|
1387
1431
|
* Unlinks everything from this instrument.
|
|
1388
1432
|
* This is what {@link BasicSoundBank.deleteInstrument} calls, the instrument itself stays intact.
|
|
@@ -1549,6 +1593,12 @@ export declare class BasicSample {
|
|
|
1549
1593
|
* How many instruments is this sample used by.
|
|
1550
1594
|
*/
|
|
1551
1595
|
get useCount(): number;
|
|
1596
|
+
/**
|
|
1597
|
+
* If the decoded float data is currently held in memory.
|
|
1598
|
+
* Check it before {@link getAudioData} to know if the call has to decode,
|
|
1599
|
+
* then use {@link releaseDecoded} to drop the copy again.
|
|
1600
|
+
*/
|
|
1601
|
+
get isDecoded(): boolean;
|
|
1552
1602
|
/**
|
|
1553
1603
|
* Get raw data for writing the file, either a compressed bit stream or signed 16-bit little endian PCM data.
|
|
1554
1604
|
* @param allowVorbis if vorbis file data is allowed.
|
|
@@ -1603,11 +1653,6 @@ export declare class BasicSample {
|
|
|
1603
1653
|
* @param type Either left, right or linked. The linked sample will be set appropriately as well.
|
|
1604
1654
|
*/
|
|
1605
1655
|
setLinkedSample(sample: BasicSample, type: SampleType): void;
|
|
1606
|
-
/**
|
|
1607
|
-
* Unlinks the sample from a given instrument
|
|
1608
|
-
* @param instrument the instrument to unlink from
|
|
1609
|
-
*/
|
|
1610
|
-
unlinkFrom(instrument: BasicInstrument): void;
|
|
1611
1656
|
/**
|
|
1612
1657
|
* Get the PCM Float32 audio data of this sample.
|
|
1613
1658
|
* This either decodes the compressed data or passes the ready sampleData.
|
|
@@ -2216,6 +2261,13 @@ export type SetSampleFormatOptions = {
|
|
|
2216
2261
|
* It must be provided if `compressed` format is chosen.
|
|
2217
2262
|
*/
|
|
2218
2263
|
compressionFunction: SampleEncodingFunction;
|
|
2264
|
+
/**
|
|
2265
|
+
* If the returned promise should reject when a sample fails to compress.
|
|
2266
|
+
* By default, such a sample is left uncompressed (and a warning is logged),
|
|
2267
|
+
* but the bank is still set to version 3.0.
|
|
2268
|
+
* With this on, the method throws after trying every sample and the bank's version stays the same.
|
|
2269
|
+
*/
|
|
2270
|
+
rejectOnFailure?: boolean;
|
|
2219
2271
|
});
|
|
2220
2272
|
/**
|
|
2221
2273
|
* Options for writing a sound bank file.
|
|
@@ -2361,11 +2413,15 @@ export interface SoundBankCloneOptions {
|
|
|
2361
2413
|
*/
|
|
2362
2414
|
reuseByName: boolean;
|
|
2363
2415
|
/**
|
|
2364
|
-
*
|
|
2365
|
-
*
|
|
2416
|
+
* How the instruments and samples used by a cloned element are reused instead of copied.
|
|
2417
|
+
* - `name` - reuse the first element in the bank with the same name.
|
|
2418
|
+
* - `identity` - reuse the element itself if it is already in the bank.
|
|
2419
|
+
* Use it to duplicate elements within one bank, as names often repeat in real banks.
|
|
2420
|
+
* - `none` - always copy them, under a free name if needed.
|
|
2421
|
+
*
|
|
2366
2422
|
* A stereo partner of a copied sample is always copied with it.
|
|
2367
2423
|
*/
|
|
2368
|
-
|
|
2424
|
+
reuseChildren: "name" | "identity" | "none";
|
|
2369
2425
|
/**
|
|
2370
2426
|
* If the new elements are added to the bank.
|
|
2371
2427
|
* When false, they are only listed in {@link SoundBankCloner.created}.
|
|
@@ -2877,6 +2933,14 @@ export interface GSInsertionParameter {
|
|
|
2877
2933
|
* Higher values result in more sound being sent.
|
|
2878
2934
|
*/
|
|
2879
2935
|
sendLevelToDelay: number;
|
|
2936
|
+
/**
|
|
2937
|
+
* EFX send EQ switch: routes the insertion output through the equalizer (see {@link GSEqualizerProcessor})
|
|
2938
|
+
* when on, or straight to the output when off.
|
|
2939
|
+
* Default is `true` (on).
|
|
2940
|
+
*
|
|
2941
|
+
* In the SysEx message, `0` is off and any other value is on.
|
|
2942
|
+
*/
|
|
2943
|
+
sendEQSwitch: boolean;
|
|
2880
2944
|
/**
|
|
2881
2945
|
* `0-127`
|
|
2882
2946
|
*
|
|
@@ -2937,7 +3001,8 @@ export interface GSInsertionBlockSnapshot extends GSInsertionParameter {
|
|
|
2937
3001
|
}
|
|
2938
3002
|
/**
|
|
2939
3003
|
* The Insertion effect (EFX) processes the parts (channels) that have EFX assigned
|
|
2940
|
-
* (see {@link ChannelMIDIParameter.efxAssign}) and is routed
|
|
3004
|
+
* (see {@link ChannelMIDIParameter.efxAssign}) and is routed to the output,
|
|
3005
|
+
* through the equalizer unless {@link GSInsertionParameter.sendEQSwitch} is off.
|
|
2941
3006
|
* It can additionally send its output to the reverb, chorus and delay.
|
|
2942
3007
|
*
|
|
2943
3008
|
* This is a Roland GS-compatible insertion interface.
|
|
@@ -2962,7 +3027,7 @@ export interface GSInsertionBlock extends GSInsertionParameter {
|
|
|
2962
3027
|
/**
|
|
2963
3028
|
* Sets the EFX type of the block.
|
|
2964
3029
|
*
|
|
2965
|
-
* Type change resets the parameters and the send
|
|
3030
|
+
* Type change resets the parameters, the send levels and the send EQ switch to their defaults.
|
|
2966
3031
|
* The EFX control sources and depths are kept.
|
|
2967
3032
|
* Behavior for unsupported types is up to the implementation.
|
|
2968
3033
|
*
|
|
@@ -3015,6 +3080,93 @@ export interface GSInsertionBlock extends GSInsertionParameter {
|
|
|
3015
3080
|
*/
|
|
3016
3081
|
applySnapshot(snapshot: GSInsertionBlockSnapshot): void;
|
|
3017
3082
|
}
|
|
3083
|
+
/**
|
|
3084
|
+
* GS-compatible equalizer parameters.
|
|
3085
|
+
*
|
|
3086
|
+
* Also see {@link GSEqualizerProcessor} to see how to implement a custom GS-compatible equalizer processor.
|
|
3087
|
+
*
|
|
3088
|
+
* @group Synthesizer.GS Effects
|
|
3089
|
+
*/
|
|
3090
|
+
export interface GSEqualizerParameter {
|
|
3091
|
+
/**
|
|
3092
|
+
* 0-1
|
|
3093
|
+
* 200 Hz, 400 Hz
|
|
3094
|
+
* This parameter sets the frequency of the low range shelf.
|
|
3095
|
+
*/
|
|
3096
|
+
lowFrequency: number;
|
|
3097
|
+
/**
|
|
3098
|
+
* 52-76 (`0x34`-`0x4C`)
|
|
3099
|
+
* -12 dB - 0 dB - +12 dB
|
|
3100
|
+
* This parameter sets the amount of boost or cut for the low frequency range.
|
|
3101
|
+
* 64 is 0 dB, each step is 1 dB.
|
|
3102
|
+
*/
|
|
3103
|
+
lowGain: number;
|
|
3104
|
+
/**
|
|
3105
|
+
* 0-1
|
|
3106
|
+
* 3 kHz, 6 kHz
|
|
3107
|
+
* This parameter sets the frequency of the high range shelf.
|
|
3108
|
+
*/
|
|
3109
|
+
highFrequency: number;
|
|
3110
|
+
/**
|
|
3111
|
+
* 52-76 (`0x34`-`0x4C`)
|
|
3112
|
+
* -12 dB - 0 dB - +12 dB
|
|
3113
|
+
* This parameter sets the amount of boost or cut for the high frequency range.
|
|
3114
|
+
* 64 is 0 dB, each step is 1 dB.
|
|
3115
|
+
*/
|
|
3116
|
+
highGain: number;
|
|
3117
|
+
}
|
|
3118
|
+
/**
|
|
3119
|
+
* The equalizer is a two-band (low and high) shelving equalizer which boosts or cuts specified frequency
|
|
3120
|
+
* ranges of the sound. An equalizer lets you
|
|
3121
|
+
* boost or cut specified frequency ranges of a sound to adjust the tone. For each range,
|
|
3122
|
+
* high and low, you can specify the frequency and the amount of boost or cut (gain).
|
|
3123
|
+
*
|
|
3124
|
+
* Only the parts with EQ enabled (see {@link ChannelMIDIParameter.eqEnabled}) pass through it,
|
|
3125
|
+
* and the insertion effect passes through it when {@link GSInsertionParameter.sendEQSwitch} is on.
|
|
3126
|
+
* The reverb, chorus and delay outputs do not.
|
|
3127
|
+
*
|
|
3128
|
+
* This is a Roland GS-compatible equalizer interface.
|
|
3129
|
+
*
|
|
3130
|
+
* It is used when {@link GlobalMIDIParameter.system} is `gm` `gm2` or `gs`.
|
|
3131
|
+
*
|
|
3132
|
+
* > **Note**
|
|
3133
|
+
* >
|
|
3134
|
+
* > The equalizer is disabled in XG mode.
|
|
3135
|
+
*
|
|
3136
|
+
* {@link SpessaSynthProcessor} allows you to supply a custom equalizer processor.
|
|
3137
|
+
* A custom equalizer processor must implement this interface.
|
|
3138
|
+
*
|
|
3139
|
+
* ### Editing the parameters
|
|
3140
|
+
*
|
|
3141
|
+
* Editing the parameters can be done via GS system exclusive messages.
|
|
3142
|
+
*
|
|
3143
|
+
* > **Tip**
|
|
3144
|
+
* >
|
|
3145
|
+
* > Refer to [SC-8850 Owner's Manual](https://cdn.roland.com/assets/media/pdf/SC-8850_OM.pdf) (p.78, 86, 236) for more information.
|
|
3146
|
+
*
|
|
3147
|
+
* @group Synthesizer.GS Effects
|
|
3148
|
+
*/
|
|
3149
|
+
export interface GSEqualizerProcessor extends GSEqualizerParameter {
|
|
3150
|
+
/**
|
|
3151
|
+
* Process the effect and **adds** it to the output.
|
|
3152
|
+
* @param inputLeft The left input buffer to process. It always starts at index 0.
|
|
3153
|
+
* @param inputRight The right input buffer to process. It always starts at index 0.
|
|
3154
|
+
* @param outputLeft The left output buffer.
|
|
3155
|
+
* @param outputRight The right output buffer.
|
|
3156
|
+
* @param startIndex The index to start mixing at into the output buffers.
|
|
3157
|
+
* @param sampleCount The amount of samples to mix. This will never be larger than {@link SynthProcessorOptions.maxBufferSize} of the parent {@link SpessaSynthProcessor} instance.
|
|
3158
|
+
*/
|
|
3159
|
+
process(inputLeft: Float32Array, inputRight: Float32Array, outputLeft: Float32Array, outputRight: Float32Array, startIndex: number, sampleCount: number): void;
|
|
3160
|
+
/**
|
|
3161
|
+
* Gets a snapshot of this effect processor instance.
|
|
3162
|
+
*/
|
|
3163
|
+
getSnapshot(): GSEqualizerParameter;
|
|
3164
|
+
/**
|
|
3165
|
+
* Restores this effect processor instance from a snapshot.
|
|
3166
|
+
* @param snapshot The snapshot to restore.
|
|
3167
|
+
*/
|
|
3168
|
+
applySnapshot(snapshot: GSEqualizerParameter): void;
|
|
3169
|
+
}
|
|
3018
3170
|
/**
|
|
3019
3171
|
* A snapshot of a {@link XGEffectBlock}.
|
|
3020
3172
|
*
|
|
@@ -3482,6 +3634,17 @@ interface GlobalSystemParameter {
|
|
|
3482
3634
|
* the delay parameters then locking it to prevent changes by MIDI files.
|
|
3483
3635
|
*/
|
|
3484
3636
|
gsDelayLock: boolean;
|
|
3637
|
+
/**
|
|
3638
|
+
* If the synthesizer should prevent editing of the GS equalizer parameters.
|
|
3639
|
+
* This effect is modified using MIDI system exclusive messages, so
|
|
3640
|
+
* the recommended use case would be setting
|
|
3641
|
+
* the equalizer parameters then locking it to prevent changes by MIDI files.
|
|
3642
|
+
*
|
|
3643
|
+
* > **Warning**
|
|
3644
|
+
* >
|
|
3645
|
+
* > To lock the channel equalizer switch, lock the {@link ChannelMIDIParameter.eqEnabled `eqEnabled`} parameter instead.
|
|
3646
|
+
*/
|
|
3647
|
+
gsEqualizerLock: boolean;
|
|
3485
3648
|
/**
|
|
3486
3649
|
* The XG variation gain when in system mode. {@link XGVariationConnection}
|
|
3487
3650
|
* From 0 to any number. 1 is 100% variation.
|
|
@@ -3624,6 +3787,7 @@ export declare class SoundBankManager {
|
|
|
3624
3787
|
*/
|
|
3625
3788
|
soundBankList: SoundBankManagerListEntry[];
|
|
3626
3789
|
private readonly presetListChangeCallback;
|
|
3790
|
+
private readonly bankRemovedCallback?;
|
|
3627
3791
|
private selectablePresetList;
|
|
3628
3792
|
private _presetList;
|
|
3629
3793
|
/**
|
|
@@ -3653,17 +3817,21 @@ export declare class SoundBankManager {
|
|
|
3653
3817
|
/**
|
|
3654
3818
|
* This method removes a sound bank with a given ID from the sound bank list.
|
|
3655
3819
|
* @param id The ID of the sound bank to delete.
|
|
3820
|
+
* @param reset If the synthesizer should reset (put every channel's controllers back to defaults) after the change.
|
|
3821
|
+
* Set it to `false` to keep a song playing, the channels then only update to the new presets.
|
|
3656
3822
|
* @throws Error An error if there's no sound bank with the given ID.
|
|
3657
3823
|
*/
|
|
3658
|
-
deleteSoundBank(id: string): void;
|
|
3824
|
+
deleteSoundBank(id: string, reset?: boolean): void;
|
|
3659
3825
|
/**
|
|
3660
3826
|
* Adds a new sound bank with a given ID, or replaces an existing one.
|
|
3661
3827
|
* @param bank The sound bank to add.
|
|
3662
3828
|
* @param id The unique ID to assign to the sound bank.
|
|
3663
3829
|
* If a sound bank with this ID already exists, it will be replaced.
|
|
3664
3830
|
* @param bankOffset The bank offset of the sound bank. Offsets the bank MSB value of all presets in this sound bank.
|
|
3831
|
+
* @param reset If the synthesizer should reset (put every channel's controllers back to defaults) after the change.
|
|
3832
|
+
* Set it to `false` to keep a song playing, the channels then only update to the new presets.
|
|
3665
3833
|
*/
|
|
3666
|
-
addSoundBank(bank: BasicSoundBank, id: string, bankOffset?: number): void;
|
|
3834
|
+
addSoundBank(bank: BasicSoundBank, id: string, bankOffset?: number, reset?: boolean): void;
|
|
3667
3835
|
/**
|
|
3668
3836
|
* Rebuilds the preset list from the current sound banks.
|
|
3669
3837
|
* Call it after editing a sound bank that is already added,
|
|
@@ -3673,6 +3841,7 @@ export declare class SoundBankManager {
|
|
|
3673
3841
|
* see {@link SpessaSynthProcessor.refreshPresets}.
|
|
3674
3842
|
*/
|
|
3675
3843
|
refresh(): void;
|
|
3844
|
+
private bankRemoved;
|
|
3676
3845
|
private generatePresetList;
|
|
3677
3846
|
}
|
|
3678
3847
|
/**
|
|
@@ -3934,6 +4103,10 @@ interface SynthesizerSnapshot {
|
|
|
3934
4103
|
* A snapshot of the delay processor.
|
|
3935
4104
|
*/
|
|
3936
4105
|
gsDelayProcessor: GSDelayParameter;
|
|
4106
|
+
/**
|
|
4107
|
+
* A snapshot of the equalizer processor.
|
|
4108
|
+
*/
|
|
4109
|
+
gsEqualizerProcessor: GSEqualizerParameter;
|
|
3937
4110
|
/**
|
|
3938
4111
|
* A snapshot of the GS insertion block.
|
|
3939
4112
|
*/
|
|
@@ -4004,10 +4177,6 @@ export declare class SpessaSynthProcessor {
|
|
|
4004
4177
|
* All MIDI channels of the synthesizer.
|
|
4005
4178
|
*/
|
|
4006
4179
|
readonly midiChannels: MIDIChannel[];
|
|
4007
|
-
/**
|
|
4008
|
-
* The sound bank manager, which manages all sound banks and presets.
|
|
4009
|
-
*/
|
|
4010
|
-
readonly soundBankManager: SoundBankManager;
|
|
4011
4180
|
/**
|
|
4012
4181
|
* The sample rate, in Hertz.
|
|
4013
4182
|
*/
|
|
@@ -4036,6 +4205,10 @@ export declare class SpessaSynthProcessor {
|
|
|
4036
4205
|
* @param event The event that occurred.
|
|
4037
4206
|
*/
|
|
4038
4207
|
onEventCall?: (event: SynthesizerEventCallback) => unknown;
|
|
4208
|
+
/**
|
|
4209
|
+
* The sound bank manager, which manages all sound banks and presets.
|
|
4210
|
+
*/
|
|
4211
|
+
readonly soundBankManager: SoundBankManager;
|
|
4039
4212
|
/**
|
|
4040
4213
|
* Left float32 buffer for processing XG insertion effects in-place.
|
|
4041
4214
|
* (channel outputs are double precision)
|
|
@@ -4509,6 +4682,25 @@ export type GSDelayParameterMessage = { [P in keyof GSDelayParameter]: {
|
|
|
4509
4682
|
*/
|
|
4510
4683
|
value: number;
|
|
4511
4684
|
};
|
|
4685
|
+
/**
|
|
4686
|
+
* Represents an analyzed GS Equalizer Processor change.
|
|
4687
|
+
*
|
|
4688
|
+
* @group MIDI.Protocol
|
|
4689
|
+
*/
|
|
4690
|
+
export type GSEqualizerParameterMessage = { [P in keyof GSEqualizerParameter]: {
|
|
4691
|
+
/**
|
|
4692
|
+
* The message type identifier.
|
|
4693
|
+
*/
|
|
4694
|
+
type: "GS Equalizer Param";
|
|
4695
|
+
/**
|
|
4696
|
+
* The GS equalizer parameter being modified.
|
|
4697
|
+
*/
|
|
4698
|
+
parameter: P;
|
|
4699
|
+
/**
|
|
4700
|
+
* The new value of the GS equalizer parameter.
|
|
4701
|
+
*/
|
|
4702
|
+
value: GSEqualizerParameter[P];
|
|
4703
|
+
}; }[keyof GSEqualizerParameter];
|
|
4512
4704
|
/**
|
|
4513
4705
|
* Represents an analyzed GS Insertion Processor change.
|
|
4514
4706
|
*
|
|
@@ -4535,11 +4727,24 @@ export type GSInsertionParameterMessage = {
|
|
|
4535
4727
|
/**
|
|
4536
4728
|
* The parameter name that was modified in the processor: a send level or an EFX control setting.
|
|
4537
4729
|
*/
|
|
4538
|
-
parameter: keyof GSInsertionParameter
|
|
4730
|
+
parameter: Exclude<keyof GSInsertionParameter, "sendEQSwitch">;
|
|
4539
4731
|
/**
|
|
4540
4732
|
* The new value of the parameter.
|
|
4541
4733
|
*/
|
|
4542
4734
|
value: number;
|
|
4735
|
+
} | {
|
|
4736
|
+
/**
|
|
4737
|
+
* An insertion effect processor parameter message (Roland GS).
|
|
4738
|
+
*/
|
|
4739
|
+
type: "GS Insertion Param";
|
|
4740
|
+
/**
|
|
4741
|
+
* The send EQ switch, see {@link GSInsertionParameter.sendEQSwitch}.
|
|
4742
|
+
*/
|
|
4743
|
+
parameter: "sendEQSwitch";
|
|
4744
|
+
/**
|
|
4745
|
+
* If the insertion output goes through the equalizer.
|
|
4746
|
+
*/
|
|
4747
|
+
value: boolean;
|
|
4543
4748
|
} | {
|
|
4544
4749
|
/**
|
|
4545
4750
|
* An insertion effect processor parameter message (Roland GS).
|
|
@@ -4884,7 +5089,7 @@ export type AnalyzedParameter = {
|
|
|
4884
5089
|
*
|
|
4885
5090
|
* @group MIDI.Protocol
|
|
4886
5091
|
*/
|
|
4887
|
-
export type AnalyzedMIDIMessage = AnalyzedParameter | GSReverbParameterMessage | GSChorusParameterMessage | GSDelayParameterMessage | GSInsertionParameterMessage | XGReverbParameterMessage | XGChorusParameterMessage | XGVariationParameterMessage | XGInsertionParameterMessage | {
|
|
5092
|
+
export type AnalyzedMIDIMessage = AnalyzedParameter | GSReverbParameterMessage | GSChorusParameterMessage | GSDelayParameterMessage | GSEqualizerParameterMessage | GSInsertionParameterMessage | XGReverbParameterMessage | XGChorusParameterMessage | XGVariationParameterMessage | XGInsertionParameterMessage | {
|
|
4888
5093
|
/**
|
|
4889
5094
|
* A MIDI program change message configured via System Exclusive.
|
|
4890
5095
|
*/
|
|
@@ -5111,6 +5316,7 @@ export type FXType<K> = Exclude<keyof K, "process" | "getSnapshot" | "applySnaps
|
|
|
5111
5316
|
* - {@link GSReverbProcessor} (`effect: "gsReverb"`)
|
|
5112
5317
|
* - {@link GSChorusProcessor} (`effect: "gsChorus"`)
|
|
5113
5318
|
* - {@link GSDelayProcessor} (`effect: "gsDelay"`)
|
|
5319
|
+
* - {@link GSEqualizerProcessor} (`effect: "gsEqualizer"`)
|
|
5114
5320
|
* - {@link GSInsertionBlock} (`effect: "gsInsertion"`)
|
|
5115
5321
|
* - {@link XGReverbBlock} (`effect: "xgReverb"`)
|
|
5116
5322
|
* - {@link XGChorusBlock} (`effect: "xgChorus"`)
|
|
@@ -5159,6 +5365,19 @@ export type EffectChangeEvent = {
|
|
|
5159
5365
|
* The new 7-bit value.
|
|
5160
5366
|
*/
|
|
5161
5367
|
value: number;
|
|
5368
|
+
} | {
|
|
5369
|
+
/**
|
|
5370
|
+
* The effect that was changed: Roland GS equalizer.
|
|
5371
|
+
*/
|
|
5372
|
+
effect: "gsEqualizer";
|
|
5373
|
+
/**
|
|
5374
|
+
* The parameter, see {@link GSEqualizerParameter}.
|
|
5375
|
+
*/
|
|
5376
|
+
parameter: keyof GSEqualizerParameter;
|
|
5377
|
+
/**
|
|
5378
|
+
* The new 7-bit value.
|
|
5379
|
+
*/
|
|
5380
|
+
value: number;
|
|
5162
5381
|
} | {
|
|
5163
5382
|
/**
|
|
5164
5383
|
* The effect that was changed: Roland GS insertion.
|
|
@@ -5171,11 +5390,24 @@ export type EffectChangeEvent = {
|
|
|
5171
5390
|
* - `"controlSource1" | "controlDepth1" | "controlSource2" | "controlDepth2"` - EFX control (7-bit), see {@link GSInsertionParameter}.
|
|
5172
5391
|
* - `number` - 0-based type-specific EFX parameter index (0-19). EFX parameter 1 is 0. Value is 7-bit.
|
|
5173
5392
|
*/
|
|
5174
|
-
parameter: "type" | keyof GSInsertionParameter | number;
|
|
5393
|
+
parameter: "type" | Exclude<keyof GSInsertionParameter, "sendEQSwitch"> | number;
|
|
5175
5394
|
/**
|
|
5176
5395
|
* The new value for the parameter.
|
|
5177
5396
|
*/
|
|
5178
5397
|
value: number;
|
|
5398
|
+
} | {
|
|
5399
|
+
/**
|
|
5400
|
+
* The effect that was changed: Roland GS insertion.
|
|
5401
|
+
*/
|
|
5402
|
+
effect: "gsInsertion";
|
|
5403
|
+
/**
|
|
5404
|
+
* The send EQ switch, see {@link GSInsertionParameter.sendEQSwitch}.
|
|
5405
|
+
*/
|
|
5406
|
+
parameter: "sendEQSwitch";
|
|
5407
|
+
/**
|
|
5408
|
+
* If the insertion output goes through the equalizer.
|
|
5409
|
+
*/
|
|
5410
|
+
value: boolean;
|
|
5179
5411
|
} | {
|
|
5180
5412
|
/**
|
|
5181
5413
|
* The effect that was changed: Yamaha XG reverb block.
|
|
@@ -5820,6 +6052,10 @@ export interface SynthProcessorOptions {
|
|
|
5820
6052
|
* Optional custom GS delay processor for the synthesizer. Leave undefined to use {@link DefaultGSDelay}.
|
|
5821
6053
|
*/
|
|
5822
6054
|
gsDelayProcessor?: GSDelayProcessor;
|
|
6055
|
+
/**
|
|
6056
|
+
* Optional custom GS equalizer processor for the synthesizer. Leave undefined to use {@link DefaultGSEqualizer}.
|
|
6057
|
+
*/
|
|
6058
|
+
gsEqualizerProcessor?: GSEqualizerProcessor;
|
|
5823
6059
|
/**
|
|
5824
6060
|
* Optional custom GS insertion block for the synthesizer. Leave undefined to use {@link DefaultGSInsertion}.
|
|
5825
6061
|
*/
|
|
@@ -6082,6 +6318,16 @@ interface ChannelMIDIParameter {
|
|
|
6082
6318
|
* Indicates whether this channel uses the GS insertion EFX processor.
|
|
6083
6319
|
*/
|
|
6084
6320
|
efxAssign: boolean;
|
|
6321
|
+
/**
|
|
6322
|
+
* Indicates whether this channel passes through the GS equalizer (see {@link GSEqualizerProcessor}).
|
|
6323
|
+
* Default is `true`, like on the Sound Canvas.
|
|
6324
|
+
*
|
|
6325
|
+
* > **Note**
|
|
6326
|
+
* >
|
|
6327
|
+
* > Channels with {@link efxAssign} enabled ignore this.
|
|
6328
|
+
* > Their equalizer routing is set by {@link GSInsertionParameter.sendEQSwitch} instead.
|
|
6329
|
+
*/
|
|
6330
|
+
eqEnabled: boolean;
|
|
6085
6331
|
/**
|
|
6086
6332
|
* CC1 for GS controller matrix.
|
|
6087
6333
|
* An arbitrary MIDI controller, which can be bound to any synthesis parameter.
|
|
@@ -6350,6 +6596,12 @@ interface ModifyMIDIOptions {
|
|
|
6350
6596
|
* - {@link GSDelayParameter} - clear + the new parameters are set via System Exclusive messages.
|
|
6351
6597
|
*/
|
|
6352
6598
|
gsDelayParams?: ClearableParameter<GSDelayParameter>;
|
|
6599
|
+
/**
|
|
6600
|
+
* The GS equalizer parameters.
|
|
6601
|
+
* - `"clear"` - all existing parameter change MIDI messages are cleared.
|
|
6602
|
+
* - {@link GSEqualizerParameter} - clear + the new parameters are set via System Exclusive messages.
|
|
6603
|
+
*/
|
|
6604
|
+
gsEqualizerParams?: ClearableParameter<GSEqualizerParameter>;
|
|
6353
6605
|
/**
|
|
6354
6606
|
* The GS Insertion Effect parameters.
|
|
6355
6607
|
* - `"clear"` - all existing parameter change MIDI messages are cleared.
|
|
@@ -7515,15 +7767,23 @@ export declare class MIDIUtils {
|
|
|
7515
7767
|
static setGSDelayParameter<P extends GSDelayParameterMessage["parameter"]>(ticks: number, parameter: P, value: Extract<GSDelayParameterMessage, {
|
|
7516
7768
|
parameter: P;
|
|
7517
7769
|
}>["value"]): MIDIMessage;
|
|
7770
|
+
/**
|
|
7771
|
+
* Returns a MIDI event needed to set the given GS Equalizer Parameter.
|
|
7772
|
+
* @param ticks The MIDI tick time for the output event.
|
|
7773
|
+
* @param parameter The parameter to set.
|
|
7774
|
+
* @param value The value to set it to.
|
|
7775
|
+
* @returns The {@link MIDIMessage} needed to set this GS Equalizer Parameter.
|
|
7776
|
+
*/
|
|
7777
|
+
static setGSEqualizerParameter(ticks: number, parameter: GSEqualizerParameterMessage["parameter"], value: number): MIDIMessage;
|
|
7518
7778
|
/**
|
|
7519
7779
|
* Returns a MIDI event needed to set the given GS Insertion Parameter.
|
|
7520
7780
|
* @param ticks The MIDI tick time for the output event.
|
|
7521
7781
|
* @param parameter The parameter to set: `"type"`, a send level or EFX control name (see {@link GSInsertionParameter}),
|
|
7522
7782
|
* or a 0-based effect-specific parameter number (0-19).
|
|
7523
|
-
* @param value The value to set it to.
|
|
7783
|
+
* @param value The value to set it to. A boolean for `"sendEQSwitch"`.
|
|
7524
7784
|
* @returns The {@link MIDIMessage} needed to set this GS Insertion Parameter.
|
|
7525
7785
|
*/
|
|
7526
|
-
static setGSInsertionParameter(ticks: number, parameter: GSInsertionParameterMessage["parameter"], value: number): MIDIMessage;
|
|
7786
|
+
static setGSInsertionParameter(ticks: number, parameter: GSInsertionParameterMessage["parameter"], value: number | boolean): MIDIMessage;
|
|
7527
7787
|
/**
|
|
7528
7788
|
* Returns a MIDI event needed to set the given XG Reverb Parameter.
|
|
7529
7789
|
* @param ticks The MIDI tick time for the output event.
|
|
@@ -8325,6 +8585,47 @@ export declare class DefaultGSDelay implements GSDelayProcessor {
|
|
|
8325
8585
|
private updateDelayTimes;
|
|
8326
8586
|
private updateGain;
|
|
8327
8587
|
}
|
|
8588
|
+
/**
|
|
8589
|
+
* The default GS Equalizer implementation for {@link SpessaSynthProcessor}.
|
|
8590
|
+
*
|
|
8591
|
+
* @group Synthesizer.GS Effects
|
|
8592
|
+
*/
|
|
8593
|
+
export declare class DefaultGSEqualizer implements GSEqualizerProcessor {
|
|
8594
|
+
private readonly sampleRate;
|
|
8595
|
+
private lowB0;
|
|
8596
|
+
private lowB1;
|
|
8597
|
+
private lowA1;
|
|
8598
|
+
private highB0;
|
|
8599
|
+
private highB1;
|
|
8600
|
+
private highA1;
|
|
8601
|
+
private lowZL;
|
|
8602
|
+
private lowZR;
|
|
8603
|
+
private highZL;
|
|
8604
|
+
private highZR;
|
|
8605
|
+
/**
|
|
8606
|
+
* Constructs a new default GS equalizer processor.
|
|
8607
|
+
* @param sampleRate The sample rate, in Hertz.
|
|
8608
|
+
*/
|
|
8609
|
+
constructor(sampleRate: number);
|
|
8610
|
+
private _lowFrequency;
|
|
8611
|
+
get lowFrequency(): number;
|
|
8612
|
+
set lowFrequency(value: number);
|
|
8613
|
+
private _lowGain;
|
|
8614
|
+
get lowGain(): number;
|
|
8615
|
+
set lowGain(value: number);
|
|
8616
|
+
private _highFrequency;
|
|
8617
|
+
get highFrequency(): number;
|
|
8618
|
+
set highFrequency(value: number);
|
|
8619
|
+
private _highGain;
|
|
8620
|
+
get highGain(): number;
|
|
8621
|
+
set highGain(value: number);
|
|
8622
|
+
process(inputLeft: Float32Array, inputRight: Float32Array, outputLeft: Float32Array, outputRight: Float32Array, startIndex: number, sampleCount: number): void;
|
|
8623
|
+
getSnapshot(): GSEqualizerParameter;
|
|
8624
|
+
applySnapshot(snapshot: GSEqualizerParameter): void;
|
|
8625
|
+
private getBand;
|
|
8626
|
+
private updateLow;
|
|
8627
|
+
private updateHigh;
|
|
8628
|
+
}
|
|
8328
8629
|
/**
|
|
8329
8630
|
* The default implementation for {@link GSInsertionBlock}.
|
|
8330
8631
|
*
|
|
@@ -8335,6 +8636,7 @@ export declare class DefaultGSInsertion implements GSInsertionBlock {
|
|
|
8335
8636
|
sendLevelToReverb: number;
|
|
8336
8637
|
sendLevelToChorus: number;
|
|
8337
8638
|
sendLevelToDelay: number;
|
|
8639
|
+
sendEQSwitch: boolean;
|
|
8338
8640
|
controlSource1: number;
|
|
8339
8641
|
controlDepth1: number;
|
|
8340
8642
|
controlSource2: number;
|
|
@@ -8484,6 +8786,19 @@ export declare class SoundBankCloner {
|
|
|
8484
8786
|
* @param options The options for this session.
|
|
8485
8787
|
*/
|
|
8486
8788
|
constructor(bank: BasicSoundBank, options?: Partial<SoundBankCloneOptions>);
|
|
8789
|
+
private get ownReuse();
|
|
8790
|
+
/**
|
|
8791
|
+
* Gets the clone this session made of an element.
|
|
8792
|
+
* @param source The sample or instrument that was cloned.
|
|
8793
|
+
* @returns The clone, or undefined if the session has not cloned the element.
|
|
8794
|
+
*/
|
|
8795
|
+
getClone(source: BasicSample): BasicSample | undefined;
|
|
8796
|
+
/**
|
|
8797
|
+
* Gets the clone this session made of an element.
|
|
8798
|
+
* @param source The sample or instrument that was cloned.
|
|
8799
|
+
* @returns The clone, or undefined if the session has not cloned the element.
|
|
8800
|
+
*/
|
|
8801
|
+
getClone(source: BasicInstrument): BasicInstrument | undefined;
|
|
8487
8802
|
/**
|
|
8488
8803
|
* Clones a sample and its stereo partner.
|
|
8489
8804
|
* The data is shared with the original, not copied.
|
|
@@ -8505,6 +8820,10 @@ export declare class SoundBankCloner {
|
|
|
8505
8820
|
clonePreset(preset: BasicPreset): BasicPreset;
|
|
8506
8821
|
private copyInstrument;
|
|
8507
8822
|
private copySample;
|
|
8823
|
+
/**
|
|
8824
|
+
* Finds the element to use instead of a copy, if the options allow one.
|
|
8825
|
+
*/
|
|
8826
|
+
private findReused;
|
|
8508
8827
|
private getFreeName;
|
|
8509
8828
|
}
|
|
8510
8829
|
/**
|