Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/sample rate of loop font #79

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 0.13.x

- DrumMachines accept a DrumMachineInstrument as source
#### DrumMachines accept a DrumMachineInstrument as source

Previously you could use a instrument name or a instrument url to load a DrumMachine.

Expand All @@ -27,6 +27,7 @@ const drums = new DrumMachine(context, {
});
```

- Fix: sample rate used to calculate soundfont loop data
- DrumMachine uses https://github.com/smpldsnds/drum-machines as source of samples
- Fix: `detune` param on `start` method

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smplr",
"version": "0.13.3",
"version": "0.13.4",
"homepage": "https://github.com/danigb/smplr#readme",
"description": "A Sampled collection of instruments",
"main": "dist/index.js",
Expand Down
1 change: 1 addition & 0 deletions site/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ if (isDeploy) {
}
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
assetPrefix,
basePath,
reactStrictMode: true,
Expand Down
2 changes: 1 addition & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"devs": "next-dev-https --https --port 3001",
"deploy": "npm run deploy:build && npm run deploy:github",
"deploy:github": "npm run deploy:build && gh-pages -d out/ -t true",
"deploy:build": "DEPLOY=true next build && DEPLOY=true next export",
"deploy:build": "DEPLOY=true next build",
"start": "next start",
"lint": "next lint"
},
Expand Down
4 changes: 2 additions & 2 deletions src/soundfont/soundfont-loops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export function getGoldstSoundfontLoopsUrl(instrument: string, kit: string) {
* @see https://github.com/danigb/smplr/issues/23
*/
export async function fetchSoundfontLoopData(
url?: string
url?: string,
sampleRate = 44100
): Promise<LoopData | undefined> {
if (!url) return undefined;
try {
Expand All @@ -22,7 +23,6 @@ export async function fetchSoundfontLoopData(

const raw = await req.json();
const loopData: LoopData = {};
const sampleRate = 41000; // this is sample rate from the repository samples
Object.keys(raw).forEach((key) => {
const midi = toMidi(key);
if (midi) {
Expand Down
Loading