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: No drum sounds #1842

Merged
merged 1 commit into from
Feb 8, 2025
Merged
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
17 changes: 12 additions & 5 deletions src/synth/synthesis/TinySoundFont.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1416,9 +1416,6 @@ export class TinySoundFont {
shdr.end,
true
);
// play whole sample
zoneRegion.offset = 0;
zoneRegion.end = zoneRegion.samples.length;
// loop points are already relative within the individual samples.
} else {
zoneRegion.samples = hydra.decodeSamples(
Expand All @@ -1431,16 +1428,26 @@ export class TinySoundFont {
false
);

// The DWORD dwStartloop contains the index, in sample data points, from the beginning of the sample data field to the first
// data point in the loop of this sample

// The DWORD dwEndloop contains the index, in sample data points, from the beginning of the sample data field to the first
// data point following the loop of this sample. Note that this is the data point “equivalent to” the first loop data point, and that
// to produce portable artifact free loops, the eight proximal data points surrounding both the Startloop and Endloop points
// should be identical.

// reset offsets relative to sub-buffer
if (zoneRegion.loopStart > 0) {
zoneRegion.loopStart -= zoneRegion.offset;
}
if (zoneRegion.loopEnd > 0) {
zoneRegion.loopEnd -= zoneRegion.offset;
}
zoneRegion.offset = 0;
zoneRegion.end -= zoneRegion.offset;
}

// play whole sample
zoneRegion.offset = 0;
zoneRegion.end = zoneRegion.samples.length - 1;
} else {
// unsupported
// 0x02: // Right Sample
Expand Down