Skip to content

Commit

Permalink
feat: fix tests and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
danigb committed Apr 11, 2024
1 parent e80766b commit 11ebf30
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Now you can pass the DrumMachineInstrument object directly to the constructor:
const context = new AudioContext();
const drums = new DrumMachine(context, {
instrument: {
baseUrl: "https://danigb.github.io/samples/drum-machines/roland-cr-8000/",
baseUrl: "https://smpldsnds.github.io/drum-machines/roland-cr-8000/",
name: "roland-cr-8000",
samples: [
"Cr8kbass",
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ An audio buffer sampler. Pass a `buffers` object with the files to be load:
import { Sampler } from "smplr";

const buffers = {
kick: "https://danigb.github.io/samples/drum-machines/808-mini/kick.m4a",
snare: "https://danigb.github.io/samples/drum-machines/808-mini/snare-1.m4a",
kick: "https://smpldsnds.github.io/drum-machines/808-mini/kick.m4a",
snare: "https://smpldsnds.github.io/drum-machines/808-mini/snare-1.m4a",
};
const sampler = new Sampler(new AudioContext(), { buffers });
```
Expand Down
13 changes: 8 additions & 5 deletions site/src/SamplerExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ export function SamplerExample({ className }: { className?: string }) {
setStatus("loading");
const context = getAudioContext();
reverb ??= new Reverb(context);
const buffers = samples.reduce((samples, name) => {
const url = `https://danigb.github.io/samples/drum-machines/808-mini/${name}.m4a`;
samples[name] = url;
return samples;
}, {} as Record<string, string>);
const buffers = samples.reduce(
(samples, name) => {
const url = `https://smpldsnds.github.io/drum-machines/808-mini/${name}.m4a`;
samples[name] = url;
return samples;
},
{} as Record<string, string>
);
const sampler = new Sampler(context, { buffers });
sampler.output.addEffect("reverb", reverb, reverbMix);

Expand Down
5 changes: 2 additions & 3 deletions src/drum-machine/drum-machine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ import { DrumMachine } from "./drum-machine";

function setup() {
createFetchMock({
"https://danigb.github.io/samples/drum-machines/TR-808/dm.json": {
"https://smpldsnds.github.io/drum-machines/TR-808/dm.json": {
baseUrl: "",
name: "",
samples: ["kick/low"],
sampleNames: [],
nameToSample: { kick: "kick/low" },
sampleNameVariations: {},
},
"https://danigb.github.io/samples/drum-machines/TR-808/kick/low.ogg":
"kick",
"https://smpldsnds.github.io/drum-machines/TR-808/kick/low.ogg": "kick",
});
const mock = createAudioContextMock();
const context = mock.context;
Expand Down

0 comments on commit 11ebf30

Please # to comment.