smplr 0.11.1 → 0.11.3
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 +21 -0
- package/dist/index.d.mts +52 -83
- package/dist/index.d.ts +52 -83
- package/dist/index.js +42 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -126,6 +126,27 @@ All instruments share some configuration options that are passed as second argum
|
|
|
126
126
|
- `onStart`: a function that is called when starting a note. It receives the note started as parameter. Bear in mind that the time this function is called is not precise, and it's determined by lookahead.
|
|
127
127
|
- `onEnded`: a function that is called when the note ends. It receives the started note as parameter.
|
|
128
128
|
|
|
129
|
+
#### Usage with standardized-audio-context
|
|
130
|
+
|
|
131
|
+
This package should be compatible with [standardized-audio-context](https://github.com/chrisguttandin/standardized-audio-context):
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
import { AudioContext } from "standardized-audio-context";
|
|
135
|
+
|
|
136
|
+
const context = new AudioContext();
|
|
137
|
+
const piano = new SplendidGrandPiano(context);
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
However, if you are using Typescript, you might need to "force cast" the types:
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
import { Soundfont } from "smplr";
|
|
144
|
+
import { AudioContext as StandardizedAudioContext } from "standardized-audio-context";
|
|
145
|
+
|
|
146
|
+
const context = new StandardizedAudioContext() as unknown as AudioContext;
|
|
147
|
+
const marimba = new Soundfont(context, { instrument: "marimba" });
|
|
148
|
+
```
|
|
149
|
+
|
|
129
150
|
### Play
|
|
130
151
|
|
|
131
152
|
#### Start and stop notes
|
package/dist/index.d.mts
CHANGED
|
@@ -27,28 +27,6 @@ declare class Channel {
|
|
|
27
27
|
disconnect(): void;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
type StorageResponse$1 = {
|
|
31
|
-
readonly status: number;
|
|
32
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
33
|
-
json(): Promise<any>;
|
|
34
|
-
text(): Promise<string>;
|
|
35
|
-
};
|
|
36
|
-
type Storage$1 = {
|
|
37
|
-
fetch: (url: string) => Promise<StorageResponse$1>;
|
|
38
|
-
};
|
|
39
|
-
declare const HttpStorage: Storage$1;
|
|
40
|
-
declare class CacheStorage implements Storage$1 {
|
|
41
|
-
#private;
|
|
42
|
-
constructor(name?: string);
|
|
43
|
-
fetch(url: string): Promise<StorageResponse$1>;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
type AudioBuffers$1 = Record<string | number, AudioBuffer | undefined>;
|
|
47
|
-
/**
|
|
48
|
-
* A function that downloads audio into a AudioBuffers
|
|
49
|
-
*/
|
|
50
|
-
type AudioBuffersLoader$1 = (context: BaseAudioContext, buffers: AudioBuffers$1) => Promise<void>;
|
|
51
|
-
|
|
52
30
|
type StorageResponse = {
|
|
53
31
|
readonly status: number;
|
|
54
32
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
@@ -58,6 +36,12 @@ type StorageResponse = {
|
|
|
58
36
|
type Storage = {
|
|
59
37
|
fetch: (url: string) => Promise<StorageResponse>;
|
|
60
38
|
};
|
|
39
|
+
declare const HttpStorage: Storage;
|
|
40
|
+
declare class CacheStorage implements Storage {
|
|
41
|
+
#private;
|
|
42
|
+
constructor(name?: string);
|
|
43
|
+
fetch(url: string): Promise<StorageResponse>;
|
|
44
|
+
}
|
|
61
45
|
|
|
62
46
|
type AudioBuffers = Record<string | number, AudioBuffer | undefined>;
|
|
63
47
|
/**
|
|
@@ -65,18 +49,6 @@ type AudioBuffers = Record<string | number, AudioBuffer | undefined>;
|
|
|
65
49
|
*/
|
|
66
50
|
type AudioBuffersLoader = (context: BaseAudioContext, buffers: AudioBuffers) => Promise<void>;
|
|
67
51
|
|
|
68
|
-
type SamplerConfig$1 = {
|
|
69
|
-
storage?: Storage;
|
|
70
|
-
detune: number;
|
|
71
|
-
volume: number;
|
|
72
|
-
velocity: number;
|
|
73
|
-
decayTime?: number;
|
|
74
|
-
lpfCutoffHz?: number;
|
|
75
|
-
destination: AudioNode;
|
|
76
|
-
buffers: Record<string | number, string | AudioBuffers> | AudioBuffersLoader;
|
|
77
|
-
volumeToGain: (volume: number) => number;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
52
|
/**
|
|
81
53
|
* A function to unsubscribe from an event or control
|
|
82
54
|
*/
|
|
@@ -94,7 +66,7 @@ type Subscribe<T> = (listener: Listener<T>) => Unsubscribe;
|
|
|
94
66
|
* @private
|
|
95
67
|
*/
|
|
96
68
|
type InternalPlayer = {
|
|
97
|
-
readonly buffers: AudioBuffers
|
|
69
|
+
readonly buffers: AudioBuffers;
|
|
98
70
|
readonly context: BaseAudioContext;
|
|
99
71
|
start(sample: SampleStart): (time?: number) => void;
|
|
100
72
|
stop(sample?: SampleStop): void;
|
|
@@ -214,6 +186,35 @@ type RegionGroup = {
|
|
|
214
186
|
sample: Partial<SampleOptions>;
|
|
215
187
|
};
|
|
216
188
|
|
|
189
|
+
type SamplerConfig = {
|
|
190
|
+
storage?: Storage;
|
|
191
|
+
detune: number;
|
|
192
|
+
volume: number;
|
|
193
|
+
velocity: number;
|
|
194
|
+
decayTime?: number;
|
|
195
|
+
lpfCutoffHz?: number;
|
|
196
|
+
destination: AudioNode;
|
|
197
|
+
buffers: Record<string | number, string | AudioBuffers> | AudioBuffersLoader;
|
|
198
|
+
volumeToGain: (volume: number) => number;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* A Sampler instrument
|
|
202
|
+
*
|
|
203
|
+
* @private
|
|
204
|
+
*/
|
|
205
|
+
declare class Sampler {
|
|
206
|
+
#private;
|
|
207
|
+
readonly context: AudioContext;
|
|
208
|
+
private readonly player;
|
|
209
|
+
readonly load: Promise<this>;
|
|
210
|
+
constructor(context: AudioContext, options?: Partial<SamplerConfig>);
|
|
211
|
+
loaded(): Promise<this>;
|
|
212
|
+
get output(): OutputChannel;
|
|
213
|
+
start(sample: SampleStart | string | number): (time?: number | undefined) => void;
|
|
214
|
+
stop(sample?: SampleStop | string | number): void;
|
|
215
|
+
disconnect(): void;
|
|
216
|
+
}
|
|
217
|
+
|
|
217
218
|
type QueuedPlayerConfig = {
|
|
218
219
|
scheduleLookaheadMs: number;
|
|
219
220
|
scheduleIntervalMs: number;
|
|
@@ -221,13 +222,13 @@ type QueuedPlayerConfig = {
|
|
|
221
222
|
onEnded?: (sample: SampleStart) => void;
|
|
222
223
|
};
|
|
223
224
|
|
|
224
|
-
type DefaultPlayerConfig = ChannelConfig & SamplerConfig
|
|
225
|
+
type DefaultPlayerConfig = ChannelConfig & SamplerConfig & QueuedPlayerConfig;
|
|
225
226
|
|
|
226
227
|
declare function getDrumMachineNames(): string[];
|
|
227
228
|
type DrumMachineConfig = {
|
|
228
229
|
instrument: string;
|
|
229
230
|
url: string;
|
|
230
|
-
storage: Storage
|
|
231
|
+
storage: Storage;
|
|
231
232
|
};
|
|
232
233
|
type DrumMachineOptions = Partial<DrumMachineConfig & DefaultPlayerConfig>;
|
|
233
234
|
declare class DrumMachine {
|
|
@@ -312,23 +313,20 @@ type WebsfzRegion = {
|
|
|
312
313
|
tune_oncc123?: number;
|
|
313
314
|
};
|
|
314
315
|
|
|
315
|
-
/**
|
|
316
|
-
* Splendid Grand Piano options
|
|
317
|
-
*/
|
|
318
316
|
type SfzSamplerConfig = {
|
|
319
317
|
instrument: SfzInstrument | Websfz | string;
|
|
320
|
-
storage
|
|
318
|
+
storage: Storage;
|
|
321
319
|
destination: AudioNode;
|
|
322
320
|
volume: number;
|
|
323
321
|
velocity: number;
|
|
324
322
|
detune: number;
|
|
325
|
-
decayTime
|
|
323
|
+
decayTime?: number;
|
|
326
324
|
lpfCutoffHz?: number;
|
|
327
325
|
};
|
|
328
326
|
declare class SfzSampler {
|
|
329
327
|
#private;
|
|
330
328
|
readonly context: AudioContext;
|
|
331
|
-
readonly options: Readonly<
|
|
329
|
+
readonly options: Readonly<SfzSamplerConfig>;
|
|
332
330
|
private readonly player;
|
|
333
331
|
readonly load: Promise<this>;
|
|
334
332
|
constructor(context: AudioContext, options: Partial<SfzSamplerConfig & DefaultPlayerConfig> & Pick<SfzSamplerConfig, "instrument">);
|
|
@@ -350,10 +348,10 @@ declare class ElectricPiano extends SfzSampler {
|
|
|
350
348
|
}
|
|
351
349
|
|
|
352
350
|
declare function getVersilianInstruments(): Promise<string[]>;
|
|
353
|
-
declare function VcslInstrumentLoader(instrument: string, buffers: AudioBuffers
|
|
351
|
+
declare function VcslInstrumentLoader(instrument: string, buffers: AudioBuffers, group: RegionGroup): (context: BaseAudioContext, storage: Storage) => Promise<void[]>;
|
|
354
352
|
type VersilianConfig = {
|
|
355
353
|
instrument: string;
|
|
356
|
-
storage: Storage
|
|
354
|
+
storage: Storage;
|
|
357
355
|
};
|
|
358
356
|
type VersilianOptions = Partial<VersilianConfig & DefaultPlayerConfig>;
|
|
359
357
|
/**
|
|
@@ -368,7 +366,7 @@ declare class Versilian implements InternalPlayer {
|
|
|
368
366
|
private config;
|
|
369
367
|
constructor(context: BaseAudioContext, options?: VersilianOptions);
|
|
370
368
|
get output(): OutputChannel;
|
|
371
|
-
get buffers(): AudioBuffers
|
|
369
|
+
get buffers(): AudioBuffers;
|
|
372
370
|
get context(): BaseAudioContext;
|
|
373
371
|
start(sample: SampleStart | string | number): (time?: number | undefined) => void;
|
|
374
372
|
stop(sample?: SampleStop | string | number): void;
|
|
@@ -384,7 +382,7 @@ declare const NAME_TO_PATH: Record<string, string | undefined>;
|
|
|
384
382
|
declare function getMellotronNames(): string[];
|
|
385
383
|
type MellotronConfig = {
|
|
386
384
|
instrument: string;
|
|
387
|
-
storage: Storage
|
|
385
|
+
storage: Storage;
|
|
388
386
|
};
|
|
389
387
|
type MellotronOptions = Partial<MellotronConfig & DefaultPlayerConfig>;
|
|
390
388
|
declare class Mellotron implements InternalPlayer {
|
|
@@ -394,7 +392,7 @@ declare class Mellotron implements InternalPlayer {
|
|
|
394
392
|
private readonly group;
|
|
395
393
|
readonly load: Promise<this>;
|
|
396
394
|
constructor(context: BaseAudioContext, options: MellotronOptions);
|
|
397
|
-
get buffers(): AudioBuffers
|
|
395
|
+
get buffers(): AudioBuffers;
|
|
398
396
|
get output(): OutputChannel;
|
|
399
397
|
start(sample: SampleStart | string | number): (time?: number | undefined) => void;
|
|
400
398
|
stop(sample?: SampleStop | string | number): void;
|
|
@@ -413,39 +411,10 @@ declare class Reverb {
|
|
|
413
411
|
connect(output: AudioNode): void;
|
|
414
412
|
}
|
|
415
413
|
|
|
416
|
-
type SamplerConfig = {
|
|
417
|
-
storage?: Storage$1;
|
|
418
|
-
detune: number;
|
|
419
|
-
volume: number;
|
|
420
|
-
velocity: number;
|
|
421
|
-
decayTime?: number;
|
|
422
|
-
lpfCutoffHz?: number;
|
|
423
|
-
destination: AudioNode;
|
|
424
|
-
buffers: Record<string | number, string | AudioBuffers$1> | AudioBuffersLoader$1;
|
|
425
|
-
volumeToGain: (volume: number) => number;
|
|
426
|
-
};
|
|
427
|
-
/**
|
|
428
|
-
* A Sampler instrument
|
|
429
|
-
*
|
|
430
|
-
* @private
|
|
431
|
-
*/
|
|
432
|
-
declare class Sampler {
|
|
433
|
-
#private;
|
|
434
|
-
readonly context: AudioContext;
|
|
435
|
-
private readonly player;
|
|
436
|
-
readonly load: Promise<this>;
|
|
437
|
-
constructor(context: AudioContext, options?: Partial<SamplerConfig>);
|
|
438
|
-
loaded(): Promise<this>;
|
|
439
|
-
get output(): OutputChannel;
|
|
440
|
-
start(sample: SampleStart | string | number): (time?: number | undefined) => void;
|
|
441
|
-
stop(sample?: SampleStop | string | number): void;
|
|
442
|
-
disconnect(): void;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
414
|
declare function getSmolkenNames(): string[];
|
|
446
415
|
type SmolkenConfig = {
|
|
447
416
|
instrument: string;
|
|
448
|
-
storage: Storage
|
|
417
|
+
storage: Storage;
|
|
449
418
|
};
|
|
450
419
|
type SmolkenOptions = Partial<SmolkenConfig & DefaultPlayerConfig>;
|
|
451
420
|
declare class Smolken implements InternalPlayer {
|
|
@@ -456,7 +425,7 @@ declare class Smolken implements InternalPlayer {
|
|
|
456
425
|
private seqNum;
|
|
457
426
|
constructor(context: BaseAudioContext, options?: SmolkenOptions);
|
|
458
427
|
get output(): OutputChannel;
|
|
459
|
-
get buffers(): AudioBuffers
|
|
428
|
+
get buffers(): AudioBuffers;
|
|
460
429
|
get context(): BaseAudioContext;
|
|
461
430
|
start(sample: SampleStart | string | number): (time?: number) => void;
|
|
462
431
|
stop(sample?: SampleStop | string | number): void;
|
|
@@ -469,7 +438,7 @@ type SoundfontConfig = {
|
|
|
469
438
|
kit: "FluidR3_GM" | "MusyngKite" | string;
|
|
470
439
|
instrument?: string;
|
|
471
440
|
instrumentUrl: string;
|
|
472
|
-
storage: Storage
|
|
441
|
+
storage: Storage;
|
|
473
442
|
extraGain: number;
|
|
474
443
|
loadLoopData: boolean;
|
|
475
444
|
loopDataUrl?: string;
|
|
@@ -496,7 +465,7 @@ declare class Soundfont {
|
|
|
496
465
|
*/
|
|
497
466
|
type SplendidGrandPianoConfig = {
|
|
498
467
|
baseUrl: string;
|
|
499
|
-
storage: Storage
|
|
468
|
+
storage: Storage;
|
|
500
469
|
detune: number;
|
|
501
470
|
velocity: number;
|
|
502
471
|
decayTime: number;
|
|
@@ -509,7 +478,7 @@ declare class SplendidGrandPiano {
|
|
|
509
478
|
readonly load: Promise<this>;
|
|
510
479
|
constructor(context: AudioContext, options?: Partial<SplendidGrandPianoConfig>);
|
|
511
480
|
get output(): OutputChannel;
|
|
512
|
-
get buffers(): AudioBuffers
|
|
481
|
+
get buffers(): AudioBuffers;
|
|
513
482
|
loaded(): Promise<this>;
|
|
514
483
|
start(sampleOrNote: SampleStart | number | string): (time?: number | undefined) => void;
|
|
515
484
|
stop(sample?: SampleStop | number | string): void;
|
|
@@ -526,4 +495,4 @@ declare const LAYERS: ({
|
|
|
526
495
|
cutoff?: undefined;
|
|
527
496
|
})[];
|
|
528
497
|
|
|
529
|
-
export { CacheStorage, DrumMachine, DrumMachineOptions, ElectricPiano, HttpStorage, LAYERS, Mallet, Mellotron, MellotronConfig, MellotronOptions, NAME_TO_PATH, Reverb, Sampler, SamplerConfig, Smolken, SmolkenConfig, SmolkenOptions, Soundfont, SoundfontOptions, SplendidGrandPiano, SplendidGrandPianoConfig,
|
|
498
|
+
export { CacheStorage, DrumMachine, type DrumMachineOptions, ElectricPiano, HttpStorage, LAYERS, Mallet, Mellotron, type MellotronConfig, type MellotronOptions, NAME_TO_PATH, Reverb, Sampler, type SamplerConfig, Smolken, type SmolkenConfig, type SmolkenOptions, Soundfont, type SoundfontOptions, SplendidGrandPiano, type SplendidGrandPianoConfig, type Storage, type StorageResponse, VcslInstrumentLoader, Versilian, type VersilianConfig, type VersilianOptions, getDrumMachineNames, getElectricPianoNames, getMalletNames, getMellotronNames, getSmolkenNames, getSoundfontKits, getSoundfontNames, getVersilianInstruments };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,28 +27,6 @@ declare class Channel {
|
|
|
27
27
|
disconnect(): void;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
type StorageResponse$1 = {
|
|
31
|
-
readonly status: number;
|
|
32
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
33
|
-
json(): Promise<any>;
|
|
34
|
-
text(): Promise<string>;
|
|
35
|
-
};
|
|
36
|
-
type Storage$1 = {
|
|
37
|
-
fetch: (url: string) => Promise<StorageResponse$1>;
|
|
38
|
-
};
|
|
39
|
-
declare const HttpStorage: Storage$1;
|
|
40
|
-
declare class CacheStorage implements Storage$1 {
|
|
41
|
-
#private;
|
|
42
|
-
constructor(name?: string);
|
|
43
|
-
fetch(url: string): Promise<StorageResponse$1>;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
type AudioBuffers$1 = Record<string | number, AudioBuffer | undefined>;
|
|
47
|
-
/**
|
|
48
|
-
* A function that downloads audio into a AudioBuffers
|
|
49
|
-
*/
|
|
50
|
-
type AudioBuffersLoader$1 = (context: BaseAudioContext, buffers: AudioBuffers$1) => Promise<void>;
|
|
51
|
-
|
|
52
30
|
type StorageResponse = {
|
|
53
31
|
readonly status: number;
|
|
54
32
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
@@ -58,6 +36,12 @@ type StorageResponse = {
|
|
|
58
36
|
type Storage = {
|
|
59
37
|
fetch: (url: string) => Promise<StorageResponse>;
|
|
60
38
|
};
|
|
39
|
+
declare const HttpStorage: Storage;
|
|
40
|
+
declare class CacheStorage implements Storage {
|
|
41
|
+
#private;
|
|
42
|
+
constructor(name?: string);
|
|
43
|
+
fetch(url: string): Promise<StorageResponse>;
|
|
44
|
+
}
|
|
61
45
|
|
|
62
46
|
type AudioBuffers = Record<string | number, AudioBuffer | undefined>;
|
|
63
47
|
/**
|
|
@@ -65,18 +49,6 @@ type AudioBuffers = Record<string | number, AudioBuffer | undefined>;
|
|
|
65
49
|
*/
|
|
66
50
|
type AudioBuffersLoader = (context: BaseAudioContext, buffers: AudioBuffers) => Promise<void>;
|
|
67
51
|
|
|
68
|
-
type SamplerConfig$1 = {
|
|
69
|
-
storage?: Storage;
|
|
70
|
-
detune: number;
|
|
71
|
-
volume: number;
|
|
72
|
-
velocity: number;
|
|
73
|
-
decayTime?: number;
|
|
74
|
-
lpfCutoffHz?: number;
|
|
75
|
-
destination: AudioNode;
|
|
76
|
-
buffers: Record<string | number, string | AudioBuffers> | AudioBuffersLoader;
|
|
77
|
-
volumeToGain: (volume: number) => number;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
52
|
/**
|
|
81
53
|
* A function to unsubscribe from an event or control
|
|
82
54
|
*/
|
|
@@ -94,7 +66,7 @@ type Subscribe<T> = (listener: Listener<T>) => Unsubscribe;
|
|
|
94
66
|
* @private
|
|
95
67
|
*/
|
|
96
68
|
type InternalPlayer = {
|
|
97
|
-
readonly buffers: AudioBuffers
|
|
69
|
+
readonly buffers: AudioBuffers;
|
|
98
70
|
readonly context: BaseAudioContext;
|
|
99
71
|
start(sample: SampleStart): (time?: number) => void;
|
|
100
72
|
stop(sample?: SampleStop): void;
|
|
@@ -214,6 +186,35 @@ type RegionGroup = {
|
|
|
214
186
|
sample: Partial<SampleOptions>;
|
|
215
187
|
};
|
|
216
188
|
|
|
189
|
+
type SamplerConfig = {
|
|
190
|
+
storage?: Storage;
|
|
191
|
+
detune: number;
|
|
192
|
+
volume: number;
|
|
193
|
+
velocity: number;
|
|
194
|
+
decayTime?: number;
|
|
195
|
+
lpfCutoffHz?: number;
|
|
196
|
+
destination: AudioNode;
|
|
197
|
+
buffers: Record<string | number, string | AudioBuffers> | AudioBuffersLoader;
|
|
198
|
+
volumeToGain: (volume: number) => number;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* A Sampler instrument
|
|
202
|
+
*
|
|
203
|
+
* @private
|
|
204
|
+
*/
|
|
205
|
+
declare class Sampler {
|
|
206
|
+
#private;
|
|
207
|
+
readonly context: AudioContext;
|
|
208
|
+
private readonly player;
|
|
209
|
+
readonly load: Promise<this>;
|
|
210
|
+
constructor(context: AudioContext, options?: Partial<SamplerConfig>);
|
|
211
|
+
loaded(): Promise<this>;
|
|
212
|
+
get output(): OutputChannel;
|
|
213
|
+
start(sample: SampleStart | string | number): (time?: number | undefined) => void;
|
|
214
|
+
stop(sample?: SampleStop | string | number): void;
|
|
215
|
+
disconnect(): void;
|
|
216
|
+
}
|
|
217
|
+
|
|
217
218
|
type QueuedPlayerConfig = {
|
|
218
219
|
scheduleLookaheadMs: number;
|
|
219
220
|
scheduleIntervalMs: number;
|
|
@@ -221,13 +222,13 @@ type QueuedPlayerConfig = {
|
|
|
221
222
|
onEnded?: (sample: SampleStart) => void;
|
|
222
223
|
};
|
|
223
224
|
|
|
224
|
-
type DefaultPlayerConfig = ChannelConfig & SamplerConfig
|
|
225
|
+
type DefaultPlayerConfig = ChannelConfig & SamplerConfig & QueuedPlayerConfig;
|
|
225
226
|
|
|
226
227
|
declare function getDrumMachineNames(): string[];
|
|
227
228
|
type DrumMachineConfig = {
|
|
228
229
|
instrument: string;
|
|
229
230
|
url: string;
|
|
230
|
-
storage: Storage
|
|
231
|
+
storage: Storage;
|
|
231
232
|
};
|
|
232
233
|
type DrumMachineOptions = Partial<DrumMachineConfig & DefaultPlayerConfig>;
|
|
233
234
|
declare class DrumMachine {
|
|
@@ -312,23 +313,20 @@ type WebsfzRegion = {
|
|
|
312
313
|
tune_oncc123?: number;
|
|
313
314
|
};
|
|
314
315
|
|
|
315
|
-
/**
|
|
316
|
-
* Splendid Grand Piano options
|
|
317
|
-
*/
|
|
318
316
|
type SfzSamplerConfig = {
|
|
319
317
|
instrument: SfzInstrument | Websfz | string;
|
|
320
|
-
storage
|
|
318
|
+
storage: Storage;
|
|
321
319
|
destination: AudioNode;
|
|
322
320
|
volume: number;
|
|
323
321
|
velocity: number;
|
|
324
322
|
detune: number;
|
|
325
|
-
decayTime
|
|
323
|
+
decayTime?: number;
|
|
326
324
|
lpfCutoffHz?: number;
|
|
327
325
|
};
|
|
328
326
|
declare class SfzSampler {
|
|
329
327
|
#private;
|
|
330
328
|
readonly context: AudioContext;
|
|
331
|
-
readonly options: Readonly<
|
|
329
|
+
readonly options: Readonly<SfzSamplerConfig>;
|
|
332
330
|
private readonly player;
|
|
333
331
|
readonly load: Promise<this>;
|
|
334
332
|
constructor(context: AudioContext, options: Partial<SfzSamplerConfig & DefaultPlayerConfig> & Pick<SfzSamplerConfig, "instrument">);
|
|
@@ -350,10 +348,10 @@ declare class ElectricPiano extends SfzSampler {
|
|
|
350
348
|
}
|
|
351
349
|
|
|
352
350
|
declare function getVersilianInstruments(): Promise<string[]>;
|
|
353
|
-
declare function VcslInstrumentLoader(instrument: string, buffers: AudioBuffers
|
|
351
|
+
declare function VcslInstrumentLoader(instrument: string, buffers: AudioBuffers, group: RegionGroup): (context: BaseAudioContext, storage: Storage) => Promise<void[]>;
|
|
354
352
|
type VersilianConfig = {
|
|
355
353
|
instrument: string;
|
|
356
|
-
storage: Storage
|
|
354
|
+
storage: Storage;
|
|
357
355
|
};
|
|
358
356
|
type VersilianOptions = Partial<VersilianConfig & DefaultPlayerConfig>;
|
|
359
357
|
/**
|
|
@@ -368,7 +366,7 @@ declare class Versilian implements InternalPlayer {
|
|
|
368
366
|
private config;
|
|
369
367
|
constructor(context: BaseAudioContext, options?: VersilianOptions);
|
|
370
368
|
get output(): OutputChannel;
|
|
371
|
-
get buffers(): AudioBuffers
|
|
369
|
+
get buffers(): AudioBuffers;
|
|
372
370
|
get context(): BaseAudioContext;
|
|
373
371
|
start(sample: SampleStart | string | number): (time?: number | undefined) => void;
|
|
374
372
|
stop(sample?: SampleStop | string | number): void;
|
|
@@ -384,7 +382,7 @@ declare const NAME_TO_PATH: Record<string, string | undefined>;
|
|
|
384
382
|
declare function getMellotronNames(): string[];
|
|
385
383
|
type MellotronConfig = {
|
|
386
384
|
instrument: string;
|
|
387
|
-
storage: Storage
|
|
385
|
+
storage: Storage;
|
|
388
386
|
};
|
|
389
387
|
type MellotronOptions = Partial<MellotronConfig & DefaultPlayerConfig>;
|
|
390
388
|
declare class Mellotron implements InternalPlayer {
|
|
@@ -394,7 +392,7 @@ declare class Mellotron implements InternalPlayer {
|
|
|
394
392
|
private readonly group;
|
|
395
393
|
readonly load: Promise<this>;
|
|
396
394
|
constructor(context: BaseAudioContext, options: MellotronOptions);
|
|
397
|
-
get buffers(): AudioBuffers
|
|
395
|
+
get buffers(): AudioBuffers;
|
|
398
396
|
get output(): OutputChannel;
|
|
399
397
|
start(sample: SampleStart | string | number): (time?: number | undefined) => void;
|
|
400
398
|
stop(sample?: SampleStop | string | number): void;
|
|
@@ -413,39 +411,10 @@ declare class Reverb {
|
|
|
413
411
|
connect(output: AudioNode): void;
|
|
414
412
|
}
|
|
415
413
|
|
|
416
|
-
type SamplerConfig = {
|
|
417
|
-
storage?: Storage$1;
|
|
418
|
-
detune: number;
|
|
419
|
-
volume: number;
|
|
420
|
-
velocity: number;
|
|
421
|
-
decayTime?: number;
|
|
422
|
-
lpfCutoffHz?: number;
|
|
423
|
-
destination: AudioNode;
|
|
424
|
-
buffers: Record<string | number, string | AudioBuffers$1> | AudioBuffersLoader$1;
|
|
425
|
-
volumeToGain: (volume: number) => number;
|
|
426
|
-
};
|
|
427
|
-
/**
|
|
428
|
-
* A Sampler instrument
|
|
429
|
-
*
|
|
430
|
-
* @private
|
|
431
|
-
*/
|
|
432
|
-
declare class Sampler {
|
|
433
|
-
#private;
|
|
434
|
-
readonly context: AudioContext;
|
|
435
|
-
private readonly player;
|
|
436
|
-
readonly load: Promise<this>;
|
|
437
|
-
constructor(context: AudioContext, options?: Partial<SamplerConfig>);
|
|
438
|
-
loaded(): Promise<this>;
|
|
439
|
-
get output(): OutputChannel;
|
|
440
|
-
start(sample: SampleStart | string | number): (time?: number | undefined) => void;
|
|
441
|
-
stop(sample?: SampleStop | string | number): void;
|
|
442
|
-
disconnect(): void;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
414
|
declare function getSmolkenNames(): string[];
|
|
446
415
|
type SmolkenConfig = {
|
|
447
416
|
instrument: string;
|
|
448
|
-
storage: Storage
|
|
417
|
+
storage: Storage;
|
|
449
418
|
};
|
|
450
419
|
type SmolkenOptions = Partial<SmolkenConfig & DefaultPlayerConfig>;
|
|
451
420
|
declare class Smolken implements InternalPlayer {
|
|
@@ -456,7 +425,7 @@ declare class Smolken implements InternalPlayer {
|
|
|
456
425
|
private seqNum;
|
|
457
426
|
constructor(context: BaseAudioContext, options?: SmolkenOptions);
|
|
458
427
|
get output(): OutputChannel;
|
|
459
|
-
get buffers(): AudioBuffers
|
|
428
|
+
get buffers(): AudioBuffers;
|
|
460
429
|
get context(): BaseAudioContext;
|
|
461
430
|
start(sample: SampleStart | string | number): (time?: number) => void;
|
|
462
431
|
stop(sample?: SampleStop | string | number): void;
|
|
@@ -469,7 +438,7 @@ type SoundfontConfig = {
|
|
|
469
438
|
kit: "FluidR3_GM" | "MusyngKite" | string;
|
|
470
439
|
instrument?: string;
|
|
471
440
|
instrumentUrl: string;
|
|
472
|
-
storage: Storage
|
|
441
|
+
storage: Storage;
|
|
473
442
|
extraGain: number;
|
|
474
443
|
loadLoopData: boolean;
|
|
475
444
|
loopDataUrl?: string;
|
|
@@ -496,7 +465,7 @@ declare class Soundfont {
|
|
|
496
465
|
*/
|
|
497
466
|
type SplendidGrandPianoConfig = {
|
|
498
467
|
baseUrl: string;
|
|
499
|
-
storage: Storage
|
|
468
|
+
storage: Storage;
|
|
500
469
|
detune: number;
|
|
501
470
|
velocity: number;
|
|
502
471
|
decayTime: number;
|
|
@@ -509,7 +478,7 @@ declare class SplendidGrandPiano {
|
|
|
509
478
|
readonly load: Promise<this>;
|
|
510
479
|
constructor(context: AudioContext, options?: Partial<SplendidGrandPianoConfig>);
|
|
511
480
|
get output(): OutputChannel;
|
|
512
|
-
get buffers(): AudioBuffers
|
|
481
|
+
get buffers(): AudioBuffers;
|
|
513
482
|
loaded(): Promise<this>;
|
|
514
483
|
start(sampleOrNote: SampleStart | number | string): (time?: number | undefined) => void;
|
|
515
484
|
stop(sample?: SampleStop | number | string): void;
|
|
@@ -526,4 +495,4 @@ declare const LAYERS: ({
|
|
|
526
495
|
cutoff?: undefined;
|
|
527
496
|
})[];
|
|
528
497
|
|
|
529
|
-
export { CacheStorage, DrumMachine, DrumMachineOptions, ElectricPiano, HttpStorage, LAYERS, Mallet, Mellotron, MellotronConfig, MellotronOptions, NAME_TO_PATH, Reverb, Sampler, SamplerConfig, Smolken, SmolkenConfig, SmolkenOptions, Soundfont, SoundfontOptions, SplendidGrandPiano, SplendidGrandPianoConfig,
|
|
498
|
+
export { CacheStorage, DrumMachine, type DrumMachineOptions, ElectricPiano, HttpStorage, LAYERS, Mallet, Mellotron, type MellotronConfig, type MellotronOptions, NAME_TO_PATH, Reverb, Sampler, type SamplerConfig, Smolken, type SmolkenConfig, type SmolkenOptions, Soundfont, type SoundfontOptions, SplendidGrandPiano, type SplendidGrandPianoConfig, type Storage, type StorageResponse, VcslInstrumentLoader, Versilian, type VersilianConfig, type VersilianOptions, getDrumMachineNames, getElectricPianoNames, getMalletNames, getMellotronNames, getSmolkenNames, getSoundfontKits, getSoundfontNames, getVersilianInstruments };
|