spessasynth_lib 3.24.4 → 3.24.7

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.
@@ -62,7 +62,7 @@ import { panVoice } from "./worklet_utilities/stereo_panner.js";
62
62
  // if the note is released faster than that, it forced to last that long
63
63
  // this is used mostly for drum channels, where a lot of midis like to send instant note off after a note on
64
64
  export const MIN_NOTE_LENGTH = 0.03;
65
- // this sounds way nicer for instant hi-hat cutoff
65
+ // this sounds way nicer for an instant hi-hat cutoff
66
66
  export const MIN_EXCLUSIVE_LENGTH = 0.07;
67
67
 
68
68
  export const SYNTHESIZER_GAIN = 1.0;
@@ -149,7 +149,7 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
149
149
  this.voiceCap = VOICE_CAP;
150
150
 
151
151
  /**
152
- * -1 to 1
152
+ * (-1 to 1)
153
153
  * @type {number}
154
154
  */
155
155
  this.pan = 0.0;
@@ -168,7 +168,7 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
168
168
  this.keyModifierManager = new WorkletKeyModifierManager();
169
169
 
170
170
  /**
171
- * Overrides the main soundfont (embedded for example)
171
+ * Overrides the main soundfont (embedded, for example)
172
172
  * @type {BasicSoundFont}
173
173
  */
174
174
  this.overrideSoundfont = undefined;
@@ -214,7 +214,7 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
214
214
  this.workletProcessorChannels[DEFAULT_PERCUSSION].preset = this.drumPreset;
215
215
  this.workletProcessorChannels[DEFAULT_PERCUSSION].drumChannel = true;
216
216
 
217
- // these smoothing factors were tested on 44100Hz, adjust them here
217
+ // these smoothing factors were tested on 44,100 Hz, adjust them here
218
218
  this.volumeEnvelopeSmoothingFactor = VOLUME_ENVELOPE_SMOOTHING_FACTOR * (44100 / sampleRate);
219
219
  this.panSmoothingFactor = PAN_SMOOTHING_FACTOR * (44100 / sampleRate);
220
220
 
@@ -259,6 +259,8 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
259
259
  {
260
260
  this.sequencer.loop = false;
261
261
  }
262
+ // set voice cap to unlimited
263
+ this.voiceCap = Infinity;
262
264
  this.sequencer.loadNewSongList([options.processorOptions.startRenderingData.parsedMIDI]);
263
265
  }
264
266
  }
@@ -316,7 +318,7 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
316
318
  /**
317
319
  * Syntesizes the voice to buffers
318
320
  * @param inputs {Float32Array[][]} required by WebAudioAPI
319
- * @param outputs {Float32Array[][]} the outputs to write to, only the first 2 channels are populated
321
+ * @param outputs {Float32Array[][]} the outputs to write to, only the first two channels are populated
320
322
  * @returns {boolean} true
321
323
  */
322
324
  process(inputs, outputs)
@@ -348,14 +350,14 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
348
350
  {
349
351
  // first output only
350
352
  const output = outputs[0];
351
- // reverb and chorus are disabled. 32 output channels: two for each midi channels
353
+ // reverb and chorus are disabled. 32 output channels: two for each midi channel
352
354
  outputIndex = (index % 16) * 2;
353
355
  outputLeft = output[outputIndex];
354
356
  outputRight = output[outputIndex + 1];
355
357
  }
356
358
  else
357
359
  {
358
- // 2 first outputs are reverb and chorus, other are for channels
360
+ // 2 first outputs are reverb and chorus, others are for channels
359
361
  outputIndex = (index % this._outputsAmount) + 2;
360
362
  outputLeft = outputs[outputIndex][0];
361
363
  outputRight = outputs[outputIndex][1];
@@ -19,11 +19,12 @@ const EXCLUSIVE_MOD_CUTOFF_TIME = -1130; // less because filter shenanigans
19
19
  */
20
20
  export function noteOn(channel, midiNote, velocity, enableDebugging = false, sendEvent = true, startTime = currentTime)
21
21
  {
22
- if (velocity === 0)
22
+ if (velocity < 1)
23
23
  {
24
24
  this.noteOff(channel, midiNote);
25
25
  return;
26
26
  }
27
+ velocity = Math.min(127, velocity);
27
28
 
28
29
  const channelObject = this.workletProcessorChannels[channel];
29
30
  if (