spessasynth_core 3.26.12 → 3.26.13
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/src/soundfont/basic_soundfont/generator.js +1 -0
- package/src/soundfont/basic_soundfont/modulator.js +2 -2
- package/src/synthetizer/audio_engine/engine_components/compute_modulator.js +6 -0
- package/src/synthetizer/audio_engine/engine_methods/system_exclusive.js +36 -15
package/package.json
CHANGED
|
@@ -70,6 +70,7 @@ export const generatorTypes = {
|
|
|
70
70
|
vibLfoToFilterFc: 62
|
|
71
71
|
};
|
|
72
72
|
export const GENERATORS_AMOUNT = Object.keys(generatorTypes).length;
|
|
73
|
+
export const MAX_GENERATOR = Math.max(...Object.values(generatorTypes));
|
|
73
74
|
|
|
74
75
|
/**
|
|
75
76
|
* @type {{min: number, max: number, def: number}[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generatorTypes } from "./generator.js";
|
|
1
|
+
import { generatorTypes, MAX_GENERATOR } from "./generator.js";
|
|
2
2
|
import { midiControllers } from "../../midi/midi_message.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -79,7 +79,7 @@ export class Modulator
|
|
|
79
79
|
this.transformType = transformType;
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
if (this.modulatorDestination >
|
|
82
|
+
if (this.modulatorDestination > MAX_GENERATOR)
|
|
83
83
|
{
|
|
84
84
|
this.modulatorDestination = generatorTypes.INVALID; // flag as invalid (for linked ones)
|
|
85
85
|
}
|
|
@@ -4,6 +4,7 @@ import { ModulationEnvelope } from "./modulation_envelope.js";
|
|
|
4
4
|
import { generatorLimits, generatorTypes } from "../../../soundfont/basic_soundfont/generator.js";
|
|
5
5
|
import { Modulator, modulatorSources } from "../../../soundfont/basic_soundfont/modulator.js";
|
|
6
6
|
import { NON_CC_INDEX_OFFSET } from "./controller_tables.js";
|
|
7
|
+
import { SpessaSynthWarn } from "../../../utils/loggin.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* compute_modulator.js
|
|
@@ -137,6 +138,11 @@ export function computeModulators(voice, controllerTable, sourceUsesCC = -1, sou
|
|
|
137
138
|
modulators.forEach(mod =>
|
|
138
139
|
{
|
|
139
140
|
const limits = generatorLimits[mod.modulatorDestination];
|
|
141
|
+
if (!limits)
|
|
142
|
+
{
|
|
143
|
+
SpessaSynthWarn(`Invalid modulator: ${mod.modulatorDestination}`);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
140
146
|
const newValue = modulatedGenerators[mod.modulatorDestination] + computeModulator(
|
|
141
147
|
controllerTable,
|
|
142
148
|
mod,
|
|
@@ -469,13 +469,28 @@ export function systemExclusive(syx, channelOffset = 0)
|
|
|
469
469
|
case 0x00:
|
|
470
470
|
// see https://github.com/spessasus/SpessaSynth/issues/154
|
|
471
471
|
// pitch control
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
472
|
+
// special case:
|
|
473
|
+
// if the source is a pitch wheel, it's a strange way of setting the bend range
|
|
474
|
+
// testcase: th07_03.mid
|
|
475
|
+
if (source === NON_CC_INDEX_OFFSET + modulatorSources.pitchWheel)
|
|
476
|
+
{
|
|
477
|
+
channelObject.controllerChange(midiControllers.RPNMsb, 0x0);
|
|
478
|
+
channelObject.controllerChange(midiControllers.RPNLsb, 0x0);
|
|
479
|
+
channelObject.controllerChange(
|
|
480
|
+
midiControllers.dataEntryMsb,
|
|
481
|
+
Math.floor(centeredValue)
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
else
|
|
485
|
+
{
|
|
486
|
+
channelObject.sysExModulators.setModulator(
|
|
487
|
+
source,
|
|
488
|
+
generatorTypes.fineTune,
|
|
489
|
+
centeredValue * 100,
|
|
490
|
+
bipolar
|
|
491
|
+
);
|
|
492
|
+
niceLogging(channel, centeredValue, `${sourceName} pitch control`, "semitones");
|
|
493
|
+
}
|
|
479
494
|
break;
|
|
480
495
|
|
|
481
496
|
case 0x01:
|
|
@@ -512,7 +527,8 @@ export function systemExclusive(syx, channelOffset = 0)
|
|
|
512
527
|
channelObject.sysExModulators.setModulator(
|
|
513
528
|
source,
|
|
514
529
|
generatorTypes.vibLfoToPitch,
|
|
515
|
-
normalizedNotCentered * 600
|
|
530
|
+
normalizedNotCentered * 600,
|
|
531
|
+
bipolar
|
|
516
532
|
);
|
|
517
533
|
niceLogging(
|
|
518
534
|
channel,
|
|
@@ -527,7 +543,8 @@ export function systemExclusive(syx, channelOffset = 0)
|
|
|
527
543
|
channelObject.sysExModulators.setModulator(
|
|
528
544
|
source,
|
|
529
545
|
generatorTypes.vibLfoToFilterFc,
|
|
530
|
-
normalizedNotCentered * 2400
|
|
546
|
+
normalizedNotCentered * 2400,
|
|
547
|
+
bipolar
|
|
531
548
|
);
|
|
532
549
|
niceLogging(
|
|
533
550
|
channel,
|
|
@@ -542,11 +559,12 @@ export function systemExclusive(syx, channelOffset = 0)
|
|
|
542
559
|
channelObject.sysExModulators.setModulator(
|
|
543
560
|
source,
|
|
544
561
|
generatorTypes.vibLfoToVolume,
|
|
545
|
-
|
|
562
|
+
normalizedValue * 960,
|
|
563
|
+
bipolar
|
|
546
564
|
);
|
|
547
565
|
niceLogging(
|
|
548
566
|
channel,
|
|
549
|
-
|
|
567
|
+
normalizedValue * 960,
|
|
550
568
|
`${sourceName} LFO1 amplitude depth`,
|
|
551
569
|
"cB"
|
|
552
570
|
);
|
|
@@ -559,7 +577,8 @@ export function systemExclusive(syx, channelOffset = 0)
|
|
|
559
577
|
channelObject.sysExModulators.setModulator(
|
|
560
578
|
source,
|
|
561
579
|
generatorTypes.modLfoToPitch,
|
|
562
|
-
normalizedNotCentered * 600
|
|
580
|
+
normalizedNotCentered * 600,
|
|
581
|
+
bipolar
|
|
563
582
|
);
|
|
564
583
|
niceLogging(
|
|
565
584
|
channel,
|
|
@@ -574,7 +593,8 @@ export function systemExclusive(syx, channelOffset = 0)
|
|
|
574
593
|
channelObject.sysExModulators.setModulator(
|
|
575
594
|
source,
|
|
576
595
|
generatorTypes.modLfoToFilterFc,
|
|
577
|
-
normalizedNotCentered * 2400
|
|
596
|
+
normalizedNotCentered * 2400,
|
|
597
|
+
bipolar
|
|
578
598
|
);
|
|
579
599
|
niceLogging(
|
|
580
600
|
channel,
|
|
@@ -589,11 +609,12 @@ export function systemExclusive(syx, channelOffset = 0)
|
|
|
589
609
|
channelObject.sysExModulators.setModulator(
|
|
590
610
|
source,
|
|
591
611
|
generatorTypes.modLfoToVolume,
|
|
592
|
-
|
|
612
|
+
normalizedValue * 960,
|
|
613
|
+
bipolar
|
|
593
614
|
);
|
|
594
615
|
niceLogging(
|
|
595
616
|
channel,
|
|
596
|
-
|
|
617
|
+
normalizedValue * 960,
|
|
597
618
|
`${sourceName} LFO2 amplitude depth`,
|
|
598
619
|
"cB"
|
|
599
620
|
);
|