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.
- package/README.md +14 -4
- package/midi_parser/midi_loader.js +51 -28
- package/package.json +1 -1
- package/sequencer/sequencer.js +95 -22
- package/sequencer/worklet_sequencer/events.js +11 -2
- package/sequencer/worklet_sequencer/process_event.js +11 -18
- package/sequencer/worklet_sequencer/process_tick.js +21 -6
- package/sequencer/worklet_sequencer/sequencer_message.js +3 -2
- package/sequencer/worklet_sequencer/song_control.js +0 -2
- package/sequencer/worklet_sequencer/worklet_sequencer.js +0 -1
- package/soundfont/dls/dls_soundfont.js +8 -4
- package/soundfont/dls/read_lart.js +2 -2
- package/synthetizer/synthetizer.js +8 -6
- package/synthetizer/worklet_processor.min.js +9 -9
- package/synthetizer/worklet_system/main_processor.js +9 -7
- package/synthetizer/worklet_system/worklet_methods/note_on.js +2 -1
|
@@ -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
|
|
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
|
|
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
|
|
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,
|
|
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
|
|
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 (
|