spessasynth_core 3.26.4 → 3.26.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/src/midi/midi_tools/used_keys_loaded.js +26 -8
- package/src/sequencer/song_control.js +20 -25
- package/src/soundfont/basic_soundfont/basic_preset.js +1 -40
- package/src/soundfont/basic_soundfont/generator.js +9 -1
- package/src/synthetizer/audio_engine/engine_components/controller_tables.js +6 -5
- package/src/synthetizer/audio_engine/engine_components/dynamic_modulator_system.js +95 -0
- package/src/synthetizer/audio_engine/engine_components/midi_audio_channel.js +11 -11
- package/src/synthetizer/audio_engine/engine_components/soundfont_manager.js +45 -17
- package/src/synthetizer/audio_engine/engine_components/stereo_panner.js +2 -2
- package/src/synthetizer/audio_engine/engine_components/voice.js +51 -51
- package/src/synthetizer/audio_engine/engine_methods/controller_control/reset_controllers.js +3 -6
- package/src/synthetizer/audio_engine/engine_methods/data_entry/data_entry_coarse.js +20 -21
- package/src/synthetizer/audio_engine/engine_methods/note_on.js +28 -8
- package/src/synthetizer/audio_engine/engine_methods/program_change.js +4 -39
- package/src/synthetizer/audio_engine/engine_methods/render_voice.js +18 -11
- package/src/synthetizer/audio_engine/engine_methods/soundfont_management/embedded_sound_bank.js +43 -0
- package/src/synthetizer/audio_engine/engine_methods/soundfont_management/get_preset.js +0 -22
- package/src/synthetizer/audio_engine/engine_methods/soundfont_management/update_preset_list.js +5 -20
- package/src/synthetizer/audio_engine/engine_methods/stopping_notes/kill_note.js +3 -0
- package/src/synthetizer/audio_engine/engine_methods/stopping_notes/note_off.js +2 -1
- package/src/synthetizer/audio_engine/engine_methods/system_exclusive.js +442 -173
- package/src/synthetizer/audio_engine/engine_methods/tuning_control/channel_pressure.js +1 -0
- package/src/synthetizer/audio_engine/main_processor.js +27 -20
- package/src/synthetizer/synth_constants.js +3 -1
- package/src/synthetizer/audio_engine/engine_methods/soundfont_management/clear_sound_font.js +0 -32
- package/src/synthetizer/audio_engine/engine_methods/soundfont_management/set_embedded_sound_font.js +0 -33
|
@@ -10,6 +10,7 @@ import { computeModulators } from "../../engine_components/compute_modulator.js"
|
|
|
10
10
|
export function channelPressure(pressure)
|
|
11
11
|
{
|
|
12
12
|
this.midiControllers[NON_CC_INDEX_OFFSET + modulatorSources.channelPressure] = pressure << 7;
|
|
13
|
+
this.updateChannelTuning();
|
|
13
14
|
this.voices.forEach(v =>
|
|
14
15
|
computeModulators(
|
|
15
16
|
v,
|
|
@@ -9,13 +9,11 @@ import { masterParameterType, setMasterParameter } from "./engine_methods/contro
|
|
|
9
9
|
import { resetAllControllers } from "./engine_methods/controller_control/reset_controllers.js";
|
|
10
10
|
import { SoundFontManager } from "./engine_components/soundfont_manager.js";
|
|
11
11
|
import { KeyModifierManager } from "./engine_components/key_modifier_manager.js";
|
|
12
|
-
import { getVoices } from "./engine_components/voice.js";
|
|
12
|
+
import { getVoices, getVoicesForPreset } from "./engine_components/voice.js";
|
|
13
13
|
import { PAN_SMOOTHING_FACTOR } from "./engine_components/stereo_panner.js";
|
|
14
14
|
import { stopAllChannels } from "./engine_methods/stopping_notes/stop_all_channels.js";
|
|
15
|
-
import { setEmbeddedSoundFont } from "./engine_methods/soundfont_management/
|
|
16
|
-
import { clearSoundFont } from "./engine_methods/soundfont_management/clear_sound_font.js";
|
|
15
|
+
import { clearEmbeddedBank, setEmbeddedSoundFont } from "./engine_methods/soundfont_management/embedded_sound_bank.js";
|
|
17
16
|
import { updatePresetList } from "./engine_methods/soundfont_management/update_preset_list.js";
|
|
18
|
-
import { getPreset } from "./engine_methods/soundfont_management/get_preset.js";
|
|
19
17
|
import { transposeAllChannels } from "./engine_methods/tuning_control/transpose_all_channels.js";
|
|
20
18
|
import { setMasterTuning } from "./engine_methods/tuning_control/set_master_tuning.js";
|
|
21
19
|
import { applySynthesizerSnapshot } from "./snapshot/apply_synthesizer_snapshot.js";
|
|
@@ -26,6 +24,7 @@ import { IndexedByteArray } from "../../utils/indexed_array.js";
|
|
|
26
24
|
import { interpolationTypes } from "./engine_components/enums.js";
|
|
27
25
|
import { DEFAULT_SYNTH_OPTIONS } from "./synth_processor_options.js";
|
|
28
26
|
import { fillWithDefaults } from "../../utils/fill_with_defaults.js";
|
|
27
|
+
import { isSystemXG } from "../../utils/xg_hacks.js";
|
|
29
28
|
|
|
30
29
|
|
|
31
30
|
/**
|
|
@@ -169,7 +168,7 @@ class SpessaSynthProcessor
|
|
|
169
168
|
/**
|
|
170
169
|
* Cached voices for all presets for this synthesizer.
|
|
171
170
|
* Nesting goes like this:
|
|
172
|
-
* this.cachedVoices[bankNumber][programNumber][midiNote][velocity] = a list of
|
|
171
|
+
* this.cachedVoices[bankNumber][programNumber][midiNote][velocity] = a list of voices for that.
|
|
173
172
|
* @type {Voice[][][][][]}
|
|
174
173
|
*/
|
|
175
174
|
cachedVoices = [];
|
|
@@ -211,7 +210,6 @@ class SpessaSynthProcessor
|
|
|
211
210
|
*/
|
|
212
211
|
soundfontBankOffset = 0;
|
|
213
212
|
|
|
214
|
-
|
|
215
213
|
/**
|
|
216
214
|
* The volume gain, set by user
|
|
217
215
|
* @type {number}
|
|
@@ -235,6 +233,17 @@ class SpessaSynthProcessor
|
|
|
235
233
|
*/
|
|
236
234
|
chorusGain = 1;
|
|
237
235
|
|
|
236
|
+
/**
|
|
237
|
+
* Set via system exclusive
|
|
238
|
+
* @type {number}
|
|
239
|
+
*/
|
|
240
|
+
reverbSend = 1;
|
|
241
|
+
/**
|
|
242
|
+
* Set via system exclusive
|
|
243
|
+
* @type {number}
|
|
244
|
+
*/
|
|
245
|
+
chorusSend = 1;
|
|
246
|
+
|
|
238
247
|
/**
|
|
239
248
|
* Maximum number of voices allowed at once
|
|
240
249
|
* @type {number}
|
|
@@ -270,12 +279,6 @@ class SpessaSynthProcessor
|
|
|
270
279
|
*/
|
|
271
280
|
keyModifierManager = new KeyModifierManager();
|
|
272
281
|
|
|
273
|
-
/**
|
|
274
|
-
* Overrides the main soundfont (embedded, for example)
|
|
275
|
-
* @type {BasicSoundBank}
|
|
276
|
-
*/
|
|
277
|
-
overrideSoundfont = undefined;
|
|
278
|
-
|
|
279
282
|
/**
|
|
280
283
|
* contains all the channels with their voices on the processor size
|
|
281
284
|
* @type {MidiAudioChannel[]}
|
|
@@ -299,16 +302,12 @@ class SpessaSynthProcessor
|
|
|
299
302
|
*/
|
|
300
303
|
defaultPreset;
|
|
301
304
|
|
|
302
|
-
defaultPresetUsesOverride = false;
|
|
303
|
-
|
|
304
305
|
/**
|
|
305
306
|
* Synth's default (reset) drum preset
|
|
306
307
|
* @type {BasicPreset}
|
|
307
308
|
*/
|
|
308
309
|
drumPreset;
|
|
309
310
|
|
|
310
|
-
defaultDrumsUsesOverride = false;
|
|
311
|
-
|
|
312
311
|
/**
|
|
313
312
|
* Controls if the processor is fully initialized
|
|
314
313
|
* @type {Promise<boolean>}
|
|
@@ -431,10 +430,8 @@ class SpessaSynthProcessor
|
|
|
431
430
|
const sys = this.system;
|
|
432
431
|
this.system = "xg";
|
|
433
432
|
this.defaultPreset = this.getPreset(0, 0);
|
|
434
|
-
this.defaultPresetUsesOverride = this.overrideSoundfont?.presets?.indexOf(this.defaultPreset) >= 0;
|
|
435
433
|
this.system = sys;
|
|
436
434
|
this.drumPreset = this.getPreset(128, 0);
|
|
437
|
-
this.defaultDrumsUsesOverride = this.overrideSoundfont?.presets?.indexOf(this.drumPreset) >= 0;
|
|
438
435
|
}
|
|
439
436
|
|
|
440
437
|
/**
|
|
@@ -750,11 +747,22 @@ class SpessaSynthProcessor
|
|
|
750
747
|
{
|
|
751
748
|
this.cachedVoices = [];
|
|
752
749
|
}
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* @param program {number}
|
|
753
|
+
* @param bank {number}
|
|
754
|
+
* @returns {BasicPreset}
|
|
755
|
+
*/
|
|
756
|
+
getPreset(bank, program)
|
|
757
|
+
{
|
|
758
|
+
return this.soundfontManager.getPreset(bank, program, isSystemXG(this.system)).preset;
|
|
759
|
+
}
|
|
753
760
|
}
|
|
754
761
|
|
|
755
762
|
// include other methods
|
|
756
763
|
// voice related
|
|
757
764
|
SpessaSynthProcessor.prototype.voiceKilling = voiceKilling;
|
|
765
|
+
SpessaSynthProcessor.prototype.getVoicesForPreset = getVoicesForPreset;
|
|
758
766
|
SpessaSynthProcessor.prototype.getVoices = getVoices;
|
|
759
767
|
|
|
760
768
|
// system-exclusive related
|
|
@@ -773,8 +781,7 @@ SpessaSynthProcessor.prototype.transposeAllChannels = transposeAllChannels;
|
|
|
773
781
|
SpessaSynthProcessor.prototype.setMasterTuning = setMasterTuning;
|
|
774
782
|
|
|
775
783
|
// program related
|
|
776
|
-
SpessaSynthProcessor.prototype.
|
|
777
|
-
SpessaSynthProcessor.prototype.clearSoundFont = clearSoundFont;
|
|
784
|
+
SpessaSynthProcessor.prototype.clearEmbeddedBank = clearEmbeddedBank;
|
|
778
785
|
SpessaSynthProcessor.prototype.setEmbeddedSoundFont = setEmbeddedSoundFont;
|
|
779
786
|
SpessaSynthProcessor.prototype.updatePresetList = updatePresetList;
|
|
780
787
|
|
|
@@ -19,4 +19,6 @@ export const MIDI_CHANNEL_COUNT = 16;
|
|
|
19
19
|
*/
|
|
20
20
|
export const DEFAULT_SYNTH_MODE = "gs";
|
|
21
21
|
|
|
22
|
-
export const ALL_CHANNELS_OR_DIFFERENT_ACTION = -1;
|
|
22
|
+
export const ALL_CHANNELS_OR_DIFFERENT_ACTION = -1;
|
|
23
|
+
|
|
24
|
+
export const EMBEDDED_SOUND_BANK_ID = `SPESSASYNTH_EMBEDDED_BANK_${Math.random()}`;
|
package/src/synthetizer/audio_engine/engine_methods/soundfont_management/clear_sound_font.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @this {SpessaSynthProcessor}
|
|
3
|
-
* @param sendPresets {boolean}
|
|
4
|
-
* @param clearOverride {boolean}
|
|
5
|
-
*/
|
|
6
|
-
export function clearSoundFont(sendPresets = true, clearOverride = true)
|
|
7
|
-
{
|
|
8
|
-
this.stopAllChannels(true);
|
|
9
|
-
if (clearOverride)
|
|
10
|
-
{
|
|
11
|
-
delete this.overrideSoundfont;
|
|
12
|
-
this.overrideSoundfont = undefined;
|
|
13
|
-
}
|
|
14
|
-
this.getDefaultPresets();
|
|
15
|
-
this.clearCache();
|
|
16
|
-
|
|
17
|
-
if (sendPresets)
|
|
18
|
-
{
|
|
19
|
-
this.updatePresetList();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
for (let i = 0; i < this.midiAudioChannels.length; i++)
|
|
23
|
-
{
|
|
24
|
-
const channelObject = this.midiAudioChannels[i];
|
|
25
|
-
if (!clearOverride || (clearOverride && channelObject.presetUsesOverride))
|
|
26
|
-
{
|
|
27
|
-
channelObject.setPresetLock(false);
|
|
28
|
-
}
|
|
29
|
-
channelObject.programChange(channelObject.preset.program);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
}
|
package/src/synthetizer/audio_engine/engine_methods/soundfont_management/set_embedded_sound_font.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { loadSoundFont } from "../../../../soundfont/load_soundfont.js";
|
|
2
|
-
import { SpessaSynthInfo } from "../../../../utils/loggin.js";
|
|
3
|
-
import { consoleColors } from "../../../../utils/other.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Sets the embedded (RMI soundfont)
|
|
7
|
-
* @param font {ArrayBuffer}
|
|
8
|
-
* @param offset {number}
|
|
9
|
-
* @this {SpessaSynthProcessor}
|
|
10
|
-
*/
|
|
11
|
-
export function setEmbeddedSoundFont(font, offset)
|
|
12
|
-
{
|
|
13
|
-
// set offset
|
|
14
|
-
this.soundfontBankOffset = offset;
|
|
15
|
-
this.clearSoundFont(false, true);
|
|
16
|
-
this.overrideSoundfont = loadSoundFont(font);
|
|
17
|
-
this.updatePresetList();
|
|
18
|
-
this.getDefaultPresets();
|
|
19
|
-
this.midiAudioChannels.forEach(c =>
|
|
20
|
-
c.programChange(c.preset.program)
|
|
21
|
-
);
|
|
22
|
-
// preload all samples
|
|
23
|
-
this.overrideSoundfont.samples.forEach(s => s.getAudioData());
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// apply snapshot again if applicable
|
|
27
|
-
if (this._snapshot !== undefined)
|
|
28
|
-
{
|
|
29
|
-
this.applySynthesizerSnapshot(this._snapshot);
|
|
30
|
-
this.resetAllControllers();
|
|
31
|
-
}
|
|
32
|
-
SpessaSynthInfo("%cSpessaSynth is ready!", consoleColors.recognized);
|
|
33
|
-
}
|