smplr 0.15.1 → 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 +9 -6
- package/dist/index.d.mts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.js +141 -196
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +141 -196
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# smplr
|
|
1
|
+
# [smplr](https://github.com/danigb/smplr)
|
|
2
2
|
|
|
3
3
|
[](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
|
|
471
|
-
|
|
472
|
-
drums.
|
|
473
|
-
|
|
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
|
@@ -245,9 +245,9 @@ type DrumMachineInstrument = {
|
|
|
245
245
|
baseUrl: string;
|
|
246
246
|
name: string;
|
|
247
247
|
samples: string[];
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
groupNames: string[];
|
|
249
|
+
nameToSampleName: Record<string, string | undefined>;
|
|
250
|
+
sampleGroupVariations: Record<string, string[]>;
|
|
251
251
|
};
|
|
252
252
|
|
|
253
253
|
declare function getDrumMachineNames(): string[];
|
|
@@ -263,11 +263,17 @@ declare class DrumMachine {
|
|
|
263
263
|
readonly load: Promise<this>;
|
|
264
264
|
readonly output: OutputChannel;
|
|
265
265
|
constructor(context: AudioContext, options?: DrumMachineOptions);
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
getSampleNames(): string[];
|
|
267
|
+
getGroupNames(): string[];
|
|
268
|
+
getSampleNamesForGroup(groupName: string): string[];
|
|
269
269
|
start(sample: SampleStart): StopFn;
|
|
270
270
|
stop(sample: SampleStop): void;
|
|
271
|
+
/** @deprecated */
|
|
272
|
+
loaded(): Promise<this>;
|
|
273
|
+
/** @deprecated */
|
|
274
|
+
get sampleNames(): string[];
|
|
275
|
+
/** @deprecated */
|
|
276
|
+
getVariations(groupName: string): string[];
|
|
271
277
|
}
|
|
272
278
|
|
|
273
279
|
type SfzInstrument = {
|
package/dist/index.d.ts
CHANGED
|
@@ -245,9 +245,9 @@ type DrumMachineInstrument = {
|
|
|
245
245
|
baseUrl: string;
|
|
246
246
|
name: string;
|
|
247
247
|
samples: string[];
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
groupNames: string[];
|
|
249
|
+
nameToSampleName: Record<string, string | undefined>;
|
|
250
|
+
sampleGroupVariations: Record<string, string[]>;
|
|
251
251
|
};
|
|
252
252
|
|
|
253
253
|
declare function getDrumMachineNames(): string[];
|
|
@@ -263,11 +263,17 @@ declare class DrumMachine {
|
|
|
263
263
|
readonly load: Promise<this>;
|
|
264
264
|
readonly output: OutputChannel;
|
|
265
265
|
constructor(context: AudioContext, options?: DrumMachineOptions);
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
getSampleNames(): string[];
|
|
267
|
+
getGroupNames(): string[];
|
|
268
|
+
getSampleNamesForGroup(groupName: string): string[];
|
|
269
269
|
start(sample: SampleStart): StopFn;
|
|
270
270
|
stop(sample: SampleStop): void;
|
|
271
|
+
/** @deprecated */
|
|
272
|
+
loaded(): Promise<this>;
|
|
273
|
+
/** @deprecated */
|
|
274
|
+
get sampleNames(): string[];
|
|
275
|
+
/** @deprecated */
|
|
276
|
+
getVariations(groupName: string): string[];
|
|
271
277
|
}
|
|
272
278
|
|
|
273
279
|
type SfzInstrument = {
|