smplr 0.15.0 → 0.16.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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # smplr
1
+ # [smplr](https://github.com/danigb/smplr)
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/smplr)](https://www.npmjs.com/package/smplr)
4
4
 
@@ -467,11 +467,14 @@ const context = new AudioContext();
467
467
  const drums = new DrumMachine(context, { instrument: "TR-808" });
468
468
  drums.start({ note: "kick" });
469
469
 
470
- // Drum samples could have variations:
471
- const now = context.currentTime;
472
- drums.getVariations("kick").forEach((variation, index) => {
473
- drums.start({ note: variation, time: now + index });
474
- });
470
+ // Drum samples are grouped and can have sample variations:
471
+ drums.getSampleNames(); // => ['kick-1', 'kick-2', 'snare-1', 'snare-2', ...]
472
+ drums.getGroupNames(); // => ['kick', 'snare']
473
+ drums.getSampleNamesForGroup("kick") => // => ['kick-1', 'kick-2']
474
+
475
+ // You can trigger samples by group name or specific sample
476
+ drums.start("kick"); // Play the first sample of the group
477
+ drums.start("kick-1"); // Play this specific sample
475
478
  ```
476
479
 
477
480
  ### Smolken double bass
package/dist/index.d.mts CHANGED
@@ -232,6 +232,7 @@ declare class Sampler {
232
232
  }
233
233
 
234
234
  type QueuedPlayerConfig = {
235
+ disableScheduler: boolean;
235
236
  scheduleLookaheadMs: number;
236
237
  scheduleIntervalMs: number;
237
238
  onStart?: (sample: SampleStart) => void;
@@ -244,9 +245,9 @@ type DrumMachineInstrument = {
244
245
  baseUrl: string;
245
246
  name: string;
246
247
  samples: string[];
247
- sampleNames: string[];
248
- nameToSample: Record<string, string | undefined>;
249
- sampleNameVariations: Record<string, string[]>;
248
+ groupNames: string[];
249
+ nameToSampleName: Record<string, string | undefined>;
250
+ sampleGroupVariations: Record<string, string[]>;
250
251
  };
251
252
 
252
253
  declare function getDrumMachineNames(): string[];
@@ -262,11 +263,17 @@ declare class DrumMachine {
262
263
  readonly load: Promise<this>;
263
264
  readonly output: OutputChannel;
264
265
  constructor(context: AudioContext, options?: DrumMachineOptions);
265
- loaded(): Promise<this>;
266
- get sampleNames(): string[];
267
- getVariations(name: string): string[];
266
+ getSampleNames(): string[];
267
+ getGroupNames(): string[];
268
+ getSampleNamesForGroup(groupName: string): string[];
268
269
  start(sample: SampleStart): StopFn;
269
270
  stop(sample: SampleStop): void;
271
+ /** @deprecated */
272
+ loaded(): Promise<this>;
273
+ /** @deprecated */
274
+ get sampleNames(): string[];
275
+ /** @deprecated */
276
+ getVariations(groupName: string): string[];
270
277
  }
271
278
 
272
279
  type SfzInstrument = {
package/dist/index.d.ts CHANGED
@@ -232,6 +232,7 @@ declare class Sampler {
232
232
  }
233
233
 
234
234
  type QueuedPlayerConfig = {
235
+ disableScheduler: boolean;
235
236
  scheduleLookaheadMs: number;
236
237
  scheduleIntervalMs: number;
237
238
  onStart?: (sample: SampleStart) => void;
@@ -244,9 +245,9 @@ type DrumMachineInstrument = {
244
245
  baseUrl: string;
245
246
  name: string;
246
247
  samples: string[];
247
- sampleNames: string[];
248
- nameToSample: Record<string, string | undefined>;
249
- sampleNameVariations: Record<string, string[]>;
248
+ groupNames: string[];
249
+ nameToSampleName: Record<string, string | undefined>;
250
+ sampleGroupVariations: Record<string, string[]>;
250
251
  };
251
252
 
252
253
  declare function getDrumMachineNames(): string[];
@@ -262,11 +263,17 @@ declare class DrumMachine {
262
263
  readonly load: Promise<this>;
263
264
  readonly output: OutputChannel;
264
265
  constructor(context: AudioContext, options?: DrumMachineOptions);
265
- loaded(): Promise<this>;
266
- get sampleNames(): string[];
267
- getVariations(name: string): string[];
266
+ getSampleNames(): string[];
267
+ getGroupNames(): string[];
268
+ getSampleNamesForGroup(groupName: string): string[];
268
269
  start(sample: SampleStart): StopFn;
269
270
  stop(sample: SampleStop): void;
271
+ /** @deprecated */
272
+ loaded(): Promise<this>;
273
+ /** @deprecated */
274
+ get sampleNames(): string[];
275
+ /** @deprecated */
276
+ getVariations(groupName: string): string[];
270
277
  }
271
278
 
272
279
  type SfzInstrument = {