spessasynth_lib 3.20.4 → 3.20.6
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/package.json +1 -1
- package/synthetizer/worklet_processor.min.js +7 -7
- package/synthetizer/worklet_system/worklet_methods/controller_control.js +6 -1
- package/synthetizer/worklet_system/worklet_methods/program_control.js +6 -1
- package/synthetizer/worklet_system/worklet_methods/system_exclusive.js +16 -0
- package/synthetizer/worklet_system/worklet_methods/voice_control.js +1 -1
- package/synthetizer/worklet_system/worklet_utilities/volume_envelope.js +9 -0
|
@@ -2,7 +2,7 @@ import { consoleColors } from '../../../utils/other.js'
|
|
|
2
2
|
import { midiControllers } from '../../../midi_parser/midi_message.js'
|
|
3
3
|
import { dataEntryStates } from '../worklet_utilities/worklet_processor_channel.js'
|
|
4
4
|
import { computeModulators } from '../worklet_utilities/worklet_modulator.js'
|
|
5
|
-
import { SpessaSynthInfo } from '../../../utils/loggin.js'
|
|
5
|
+
import { SpessaSynthInfo, SpessaSynthWarn } from '../../../utils/loggin.js'
|
|
6
6
|
import { SYNTHESIZER_GAIN } from '../main_processor.js'
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -18,6 +18,11 @@ export function controllerChange(channel, controllerNumber, controllerValue, for
|
|
|
18
18
|
* @type {WorkletProcessorChannel}
|
|
19
19
|
*/
|
|
20
20
|
const channelObject = this.workletProcessorChannels[channel];
|
|
21
|
+
if(channelObject === undefined)
|
|
22
|
+
{
|
|
23
|
+
SpessaSynthWarn(`Trying to access channel ${channel} which does not exist... ignoring!`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
21
26
|
// lsb controller values: append them as the lower nibble of the 14 bit value
|
|
22
27
|
// excluding bank select and data entry as it's handled separately
|
|
23
28
|
if(
|
|
@@ -2,7 +2,7 @@ import { midiControllers } from '../../../midi_parser/midi_message.js'
|
|
|
2
2
|
import { clearSamplesList } from '../worklet_utilities/worklet_voice.js'
|
|
3
3
|
import { generatorTypes } from '../../../soundfont/read_sf2/generators.js'
|
|
4
4
|
import { returnMessageType } from '../message_protocol/worklet_message.js'
|
|
5
|
-
import { SpessaSynthInfo } from '../../../utils/loggin.js'
|
|
5
|
+
import { SpessaSynthInfo, SpessaSynthWarn } from '../../../utils/loggin.js'
|
|
6
6
|
import { consoleColors } from '../../../utils/other.js'
|
|
7
7
|
import { loadSoundFont } from '../../../soundfont/load_soundfont.js'
|
|
8
8
|
|
|
@@ -19,6 +19,11 @@ export function programChange(channel, programNumber, userChange=false)
|
|
|
19
19
|
* @type {WorkletProcessorChannel}
|
|
20
20
|
*/
|
|
21
21
|
const channelObject = this.workletProcessorChannels[channel];
|
|
22
|
+
if(channelObject === undefined)
|
|
23
|
+
{
|
|
24
|
+
SpessaSynthWarn(`Trying to access channel ${channel} which does not exist... ignoring!`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
22
27
|
if(channelObject.lockPreset)
|
|
23
28
|
{
|
|
24
29
|
return;
|
|
@@ -463,6 +463,11 @@ export function systemExclusive(messageData, channelOffset = 0)
|
|
|
463
463
|
return;
|
|
464
464
|
}
|
|
465
465
|
const channel = messageData[4] + channelOffset;
|
|
466
|
+
if(channel >= this.workletProcessorChannels.length)
|
|
467
|
+
{
|
|
468
|
+
// invalid channel
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
466
471
|
const value = messageData[6];
|
|
467
472
|
switch (messageData[5])
|
|
468
473
|
{
|
|
@@ -481,6 +486,17 @@ export function systemExclusive(messageData, channelOffset = 0)
|
|
|
481
486
|
this.programChange(channel, value);
|
|
482
487
|
break;
|
|
483
488
|
|
|
489
|
+
// note shift
|
|
490
|
+
case 0x08:
|
|
491
|
+
const chan = this.workletProcessorChannels[channel];
|
|
492
|
+
if(chan.drumChannel)
|
|
493
|
+
{
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
const semitones = value - 64;
|
|
497
|
+
chan.channelTransposeKeyShift = semitones;
|
|
498
|
+
break;
|
|
499
|
+
|
|
484
500
|
// volume
|
|
485
501
|
case 0x0B:
|
|
486
502
|
this.controllerChange(channel, midiControllers.mainVolume, value);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { generatorTypes } from '../../../soundfont/read_sf2/generators.js'
|
|
2
|
-
import { absCentsToHz,
|
|
2
|
+
import { absCentsToHz, timecentsToSeconds } from '../worklet_utilities/unit_converter.js'
|
|
3
3
|
import { getLFOValue } from '../worklet_utilities/lfo.js'
|
|
4
4
|
import { customControllers } from '../worklet_utilities/worklet_processor_channel.js'
|
|
5
5
|
import { WorkletModulationEnvelope } from '../worklet_utilities/modulation_envelope.js'
|
|
@@ -249,6 +249,15 @@ export class WorkletVolumeEnvelope
|
|
|
249
249
|
// as the instant notes don't end instantly when they should
|
|
250
250
|
const releaseSmoothingFactor = smoothingFactor * 10;
|
|
251
251
|
let elapsedRelease = env.currentSampleTime - env.releaseStartTimeSamples;
|
|
252
|
+
if(elapsedRelease >= env.releaseDuration)
|
|
253
|
+
{
|
|
254
|
+
for (let i = 0; i < audioBuffer.length; i++)
|
|
255
|
+
{
|
|
256
|
+
audioBuffer[i] = 0;
|
|
257
|
+
}
|
|
258
|
+
voice.finished = true;
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
252
261
|
let dbDifference = DB_SILENCE - env.releaseStartDb;
|
|
253
262
|
let db = 0;
|
|
254
263
|
for (let i = 0; i < audioBuffer.length; i++)
|