diff --git a/src/spessasynth_lib/synthetizer/worklet_system/channel_processor.js b/src/spessasynth_lib/synthetizer/worklet_system/channel_processor.js index b75afe42..b57024fc 100644 --- a/src/spessasynth_lib/synthetizer/worklet_system/channel_processor.js +++ b/src/spessasynth_lib/synthetizer/worklet_system/channel_processor.js @@ -149,7 +149,7 @@ class ChannelProcessor extends AudioWorkletProcessor { { return; } - v.sample.end = data.sampleData.length + v.generators[generatorTypes.endAddrOffset] + (v.generators[generatorTypes.endAddrsCoarseOffset] * 32768); + v.sample.end = data.sampleData.length - 1 + v.generators[generatorTypes.endAddrOffset] + (v.generators[generatorTypes.endAddrsCoarseOffset] * 32768); }) break; diff --git a/src/spessasynth_lib/synthetizer/worklet_system/worklet_channel.js b/src/spessasynth_lib/synthetizer/worklet_system/worklet_channel.js index 47c03ed7..8d6e1a0e 100644 --- a/src/spessasynth_lib/synthetizer/worklet_system/worklet_channel.js +++ b/src/spessasynth_lib/synthetizer/worklet_system/worklet_channel.js @@ -357,7 +357,7 @@ export class WorkletChannel { rootKey: rootKey, loopStart: loopStart, loopEnd: loopEnd, - end: Math.floor( sampleAndGenerators.sample.sampleData.length) + (generators[generatorTypes.endAddrOffset] + (generators[generatorTypes.endAddrsCoarseOffset] * 32768)), + end: Math.floor( sampleAndGenerators.sample.sampleData.length) - 1 + (generators[generatorTypes.endAddrOffset] + (generators[generatorTypes.endAddrsCoarseOffset] * 32768)), loopingMode: loopingMode };