Skip to content

Commit

Permalink
Fix ear-ripping sounds and LFO start
Browse files Browse the repository at this point in the history
fixed GeneralUserGS toms too!!!
  • Loading branch information
spessasus committed Aug 31, 2024
1 parent db3933d commit 0ff28ce
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SpessaSynth",
"version": "3.20.3",
"version": "3.20.4",
"type": "module",
"scripts": {
"start": "node src/website/server/server.js"
Expand Down
12 changes: 6 additions & 6 deletions src/spessasynth_lib/synthetizer/worklet_processor.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
}
});

totalCurrentVoices += tempV.length;
totalCurrentVoices += channel.voices.length;
});

// if voice count changed, update voice amount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function getLFOValue(startTime, frequency, currentTime) {
return 0;
}

const xVal = (currentTime - startTime) / (1 / frequency) - 0.25;
const xVal = (currentTime - startTime) / (1 / frequency) + 0.25;
// offset by -0.25, otherwise we start at -1 and can have unexpected jump in pitch or lowpass (happened with Synth Strings 2)

// triangle, not sine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export class WorkletModulationEnvelope
}

/**
* FIXME: GeneralUserGS 808 toms sound incorrect
* Calculates the current modulation envelope value for the given time and voice
* @param voice {WorkletVoice} the voice we're working on
* @param currentTime {number} in seconds
Expand All @@ -134,7 +133,7 @@ export class WorkletModulationEnvelope
const env = voice.modulationEnvelope;
if(voice.isInRelease)
{
if(voice.modulatedGenerators[generatorTypes.releaseModEnv] < -7199)
if(env.releaseDuration < 0.001)
{
// prevent lowpass bugs if release is instant
return env.releaseStartLevel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { generatorTypes } from '../../../soundfont/read_sf2/generators.js'
export const VOLUME_ENVELOPE_SMOOTHING_FACTOR = 0.001;

const DB_SILENCE = 100;
const PERCEIVED_DB_SILENCE = 80;
const PERCEIVED_DB_SILENCE = 70;

/**
* VOL ENV STATES:
Expand Down Expand Up @@ -208,6 +208,11 @@ export class WorkletVolumeEnvelope
default:
env.releaseStartDb = env.currentAttenuationDb;
}
env.releaseStartDb = Math.min(env.releaseStartDb, DB_SILENCE);
if(env.releaseStartDb >= PERCEIVED_DB_SILENCE)
{
voice.finished = true;
}
}
}

Expand Down

0 comments on commit 0ff28ce

Please sign in to comment.