spessasynth_lib 3.20.3 → 3.20.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -330,7 +330,7 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
330
330
  }
331
331
  });
332
332
 
333
- totalCurrentVoices += tempV.length;
333
+ totalCurrentVoices += channel.voices.length;
334
334
  });
335
335
 
336
336
  // if voice count changed, update voice amount
@@ -15,7 +15,7 @@ export function getLFOValue(startTime, frequency, currentTime) {
15
15
  return 0;
16
16
  }
17
17
 
18
- const xVal = (currentTime - startTime) / (1 / frequency) - 0.25;
18
+ const xVal = (currentTime - startTime) / (1 / frequency) + 0.25;
19
19
  // offset by -0.25, otherwise we start at -1 and can have unexpected jump in pitch or lowpass (happened with Synth Strings 2)
20
20
 
21
21
  // triangle, not sine
@@ -123,7 +123,6 @@ export class WorkletModulationEnvelope
123
123
  }
124
124
 
125
125
  /**
126
- * FIXME: GeneralUserGS 808 toms sound incorrect
127
126
  * Calculates the current modulation envelope value for the given time and voice
128
127
  * @param voice {WorkletVoice} the voice we're working on
129
128
  * @param currentTime {number} in seconds
@@ -134,7 +133,7 @@ export class WorkletModulationEnvelope
134
133
  const env = voice.modulationEnvelope;
135
134
  if(voice.isInRelease)
136
135
  {
137
- if(voice.modulatedGenerators[generatorTypes.releaseModEnv] < -7199)
136
+ if(env.releaseDuration < 0.001)
138
137
  {
139
138
  // prevent lowpass bugs if release is instant
140
139
  return env.releaseStartLevel;
@@ -9,7 +9,7 @@ import { generatorTypes } from '../../../soundfont/read_sf2/generators.js'
9
9
  export const VOLUME_ENVELOPE_SMOOTHING_FACTOR = 0.001;
10
10
 
11
11
  const DB_SILENCE = 100;
12
- const PERCEIVED_DB_SILENCE = 96;
12
+ const PERCEIVED_DB_SILENCE = 70;
13
13
 
14
14
  /**
15
15
  * VOL ENV STATES:
@@ -208,6 +208,11 @@ export class WorkletVolumeEnvelope
208
208
  default:
209
209
  env.releaseStartDb = env.currentAttenuationDb;
210
210
  }
211
+ env.releaseStartDb = Math.min(env.releaseStartDb, DB_SILENCE);
212
+ if(env.releaseStartDb >= PERCEIVED_DB_SILENCE)
213
+ {
214
+ voice.finished = true;
215
+ }
211
216
  }
212
217
  }
213
218