smplr 0.16.1 → 0.16.2

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 CHANGED
@@ -148,6 +148,23 @@ const context = new StandardizedAudioContext() as unknown as AudioContext;
148
148
  const marimba = new Soundfont(context, { instrument: "marimba" });
149
149
  ```
150
150
 
151
+ In case you need to use the `Reverb` module (or any other module that needs `AudioWorkletNode`) you need to enforce to use the one from `standardized-audio-context` package. Here is how:
152
+
153
+ ```ts
154
+ import {
155
+ AudioWorkletNode,
156
+ IAudioContext,
157
+ AudioContext as StandardizedAudioContext,
158
+ } from "standardized-audio-context";
159
+
160
+ window.AudioWorkletNode = AudioWorkletNode as any;
161
+ const context = new StandardizedAudioContext() as unknown AudioContext;
162
+
163
+ // ... rest of the code
164
+ ```
165
+
166
+ You can read more about this issue [here](https://github.com/chrisguttandin/standardized-audio-context/issues/897)
167
+
151
168
  ### Play
152
169
 
153
170
  #### Start and stop notes
package/dist/index.d.mts CHANGED
@@ -400,15 +400,16 @@ declare class Versilian implements InternalPlayer {
400
400
  get output(): OutputChannel;
401
401
  get buffers(): AudioBuffers;
402
402
  get context(): BaseAudioContext;
403
- start(sample: SampleStart | string | number): (time?: number | undefined) => void;
403
+ start(sample: SampleStart | string | number): (time?: number) => void;
404
404
  stop(sample?: SampleStop | string | number): void;
405
405
  disconnect(): void;
406
406
  }
407
407
 
408
- declare function getMalletNames(): string[];
408
+ declare function getMalletNames(): MalletName[];
409
409
  declare class Mallet extends Versilian {
410
410
  constructor(context: AudioContext, options: VersilianOptions);
411
411
  }
412
+ type MalletName = keyof typeof NAME_TO_PATH;
412
413
  declare const NAME_TO_PATH: Record<string, string | undefined>;
413
414
 
414
415
  declare function getMellotronNames(): string[];
@@ -555,7 +556,7 @@ declare class Soundfont2Sampler {
555
556
  get instrumentNames(): string[];
556
557
  loadInstrument(instrumentName: string): (AudioBuffers | SamplerInstrument)[] | undefined;
557
558
  get output(): OutputChannel;
558
- start(sample: SampleStart | string | number): (time?: number | undefined) => void;
559
+ start(sample: SampleStart | string | number): (time?: number) => void;
559
560
  stop(sample?: SampleStop | string | number): void;
560
561
  disconnect(): void;
561
562
  }
package/dist/index.d.ts CHANGED
@@ -400,15 +400,16 @@ declare class Versilian implements InternalPlayer {
400
400
  get output(): OutputChannel;
401
401
  get buffers(): AudioBuffers;
402
402
  get context(): BaseAudioContext;
403
- start(sample: SampleStart | string | number): (time?: number | undefined) => void;
403
+ start(sample: SampleStart | string | number): (time?: number) => void;
404
404
  stop(sample?: SampleStop | string | number): void;
405
405
  disconnect(): void;
406
406
  }
407
407
 
408
- declare function getMalletNames(): string[];
408
+ declare function getMalletNames(): MalletName[];
409
409
  declare class Mallet extends Versilian {
410
410
  constructor(context: AudioContext, options: VersilianOptions);
411
411
  }
412
+ type MalletName = keyof typeof NAME_TO_PATH;
412
413
  declare const NAME_TO_PATH: Record<string, string | undefined>;
413
414
 
414
415
  declare function getMellotronNames(): string[];
@@ -555,7 +556,7 @@ declare class Soundfont2Sampler {
555
556
  get instrumentNames(): string[];
556
557
  loadInstrument(instrumentName: string): (AudioBuffers | SamplerInstrument)[] | undefined;
557
558
  get output(): OutputChannel;
558
- start(sample: SampleStart | string | number): (time?: number | undefined) => void;
559
+ start(sample: SampleStart | string | number): (time?: number) => void;
559
560
  stop(sample?: SampleStop | string | number): void;
560
561
  disconnect(): void;
561
562
  }
package/dist/index.js CHANGED
@@ -63,8 +63,8 @@ var __async = (__this, __arguments, generator) => {
63
63
  };
64
64
 
65
65
  // src/index.ts
66
- var src_exports = {};
67
- __export(src_exports, {
66
+ var index_exports = {};
67
+ __export(index_exports, {
68
68
  CacheStorage: () => CacheStorage,
69
69
  DrumMachine: () => DrumMachine,
70
70
  ElectricPiano: () => ElectricPiano,
@@ -90,7 +90,7 @@ __export(src_exports, {
90
90
  getSoundfontNames: () => getSoundfontNames,
91
91
  getVersilianInstruments: () => getVersilianInstruments
92
92
  });
93
- module.exports = __toCommonJS(src_exports);
93
+ module.exports = __toCommonJS(index_exports);
94
94
 
95
95
  // src/player/connect.ts
96
96
  function connectSerial(nodes) {
@@ -2105,8 +2105,20 @@ function getSoundfontConfig(options) {
2105
2105
  config.instrumentUrl = config.instrument;
2106
2106
  config.instrument = void 0;
2107
2107
  }
2108
- if (config.instrument && !config.instrumentUrl) {
2109
- config.instrumentUrl = gleitzKitUrl(config.instrument, config.kit);
2108
+ if (!config.instrumentUrl) {
2109
+ if (config.instrument) {
2110
+ config.instrumentUrl = gleitzKitUrl(config.instrument, config.kit);
2111
+ } else {
2112
+ throw Error(
2113
+ "Soundfont: 'instrument' or 'instrumentUrl' configuration parameter is required"
2114
+ );
2115
+ }
2116
+ } else {
2117
+ if (config.kit || config.instrument) {
2118
+ console.warn(
2119
+ "Soundfont: 'kit' and 'instrument' config parameters are ignored because 'instrumentUrl' is explicitly set."
2120
+ );
2121
+ }
2110
2122
  }
2111
2123
  if (config.loadLoopData && config.instrument && !config.loopDataUrl) {
2112
2124
  config.loopDataUrl = getGoldstSoundfontLoopsUrl(