spessasynth_lib 3.25.21 → 3.25.22
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/index.js +7 -7
- package/{midi_parser → midi}/basic_midi.js +6 -4
- package/{midi_parser → midi}/midi_loader.js +1 -1
- package/midi/midi_tools/get_note_times.js +154 -0
- package/{midi_parser → midi/midi_tools}/midi_editor.js +8 -8
- package/{midi_parser → midi/midi_tools}/midi_writer.js +3 -3
- package/{midi_parser → midi/midi_tools}/rmidi_writer.js +10 -10
- package/{midi_parser → midi/midi_tools}/used_keys_loaded.js +7 -7
- package/{midi_parser → midi}/xmf_loader.js +1 -1
- package/package.json +1 -1
- package/sequencer/sequencer_engine/events.js +1 -1
- package/sequencer/sequencer_engine/play.js +3 -5
- package/sequencer/sequencer_engine/process_event.js +1 -1
- package/sequencer/sequencer_engine/sequencer_engine.js +1 -1
- package/sequencer/sequencer_engine/song_control.js +3 -3
- package/sequencer/worklet_wrapper/sequencer.js +3 -3
- package/soundfont/basic_soundfont/modulator.js +1 -1
- package/soundfont/basic_soundfont/write_dls/modulator_converter.js +1 -1
- package/soundfont/dls/articulator_converter.js +1 -1
- package/synthetizer/audio_engine/README.md +5 -5
- package/synthetizer/audio_engine/{worklet_utilities/worklet_modulator.js → engine_components/compute_modulator.js} +12 -12
- package/synthetizer/audio_engine/{worklet_utilities → engine_components}/controller_tables.js +1 -1
- package/synthetizer/audio_engine/{worklet_methods/worklet_key_modifier.js → engine_components/key_modifier_manager.js} +24 -32
- package/synthetizer/audio_engine/{worklet_utilities → engine_components}/lowpass_filter.js +1 -1
- package/synthetizer/audio_engine/{worklet_utilities/worklet_processor_channel.js → engine_components/midi_audio_channel.js} +43 -43
- package/synthetizer/audio_engine/{worklet_utilities → engine_components}/modulation_envelope.js +6 -6
- package/synthetizer/audio_engine/{worklet_utilities → engine_components}/stereo_panner.js +3 -3
- package/synthetizer/audio_engine/{worklet_utilities/worklet_voice.js → engine_components/voice.js} +43 -37
- package/synthetizer/audio_engine/{worklet_utilities → engine_components}/volume_envelope.js +17 -17
- package/synthetizer/audio_engine/{worklet_utilities → engine_components}/wavetable_oscillator.js +3 -3
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/controller_control/controller_change.js +4 -4
- package/synthetizer/audio_engine/engine_methods/controller_control/master_parameters.js +48 -0
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/controller_control/reset_controllers.js +6 -6
- package/synthetizer/audio_engine/{worklet_methods/create_worklet_channel.js → engine_methods/create_midi_channel.js} +4 -4
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/data_entry/data_entry_coarse.js +3 -3
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/data_entry/data_entry_fine.js +3 -3
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/mute_channel.js +1 -1
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/note_on.js +10 -4
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/program_change.js +1 -1
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/render_voice.js +13 -13
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/stopping_notes/kill_note.js +1 -1
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/stopping_notes/note_off.js +1 -1
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/stopping_notes/stop_all_notes.js +1 -1
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/stopping_notes/voice_killing.js +2 -2
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/system_exclusive.js +4 -3
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/tuning_control/channel_pressure.js +3 -3
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/tuning_control/pitch_wheel.js +3 -3
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/tuning_control/poly_pressure.js +2 -2
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/tuning_control/set_master_tuning.js +1 -1
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/tuning_control/set_modulation_depth.js +2 -2
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/tuning_control/set_octave_tuning.js +1 -1
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/tuning_control/set_tuning.js +2 -2
- package/synthetizer/audio_engine/{worklet_methods → engine_methods}/tuning_control/transpose_channel.js +3 -3
- package/synthetizer/audio_engine/main_processor.js +49 -44
- package/synthetizer/audio_engine/message_protocol/worklet_message.js +1 -12
- package/synthetizer/audio_engine/snapshot/synthesizer_snapshot.js +3 -2
- package/synthetizer/worklet_processor.min.js +12 -12
- package/synthetizer/worklet_wrapper/key_modifier_manager.js +6 -4
- package/synthetizer/worklet_wrapper/synth_soundfont_manager.js +1 -1
- package/synthetizer/worklet_wrapper/synthetizer.js +6 -6
- package/synthetizer/worklet_wrapper/worklet_processor.js +26 -24
- package/synthetizer/audio_engine/worklet_methods/controller_control/master_parameters.js +0 -36
- /package/{midi_parser → midi}/README.md +0 -0
- /package/{midi_parser → midi}/midi_builder.js +0 -0
- /package/{midi_parser → midi}/midi_data.js +0 -0
- /package/{midi_parser → midi}/midi_message.js +0 -0
- /package/{midi_parser → midi}/midi_sequence.js +0 -0
- /package/synthetizer/audio_engine/{worklet_utilities → engine_components}/lfo.js +0 -0
- /package/synthetizer/audio_engine/{worklet_utilities → engine_components}/modulator_curves.js +0 -0
- /package/synthetizer/audio_engine/{worklet_methods/worklet_soundfont_manager → engine_components/soundfont_manager}/sfman_message.js +0 -0
- /package/synthetizer/audio_engine/{worklet_methods/worklet_soundfont_manager/worklet_soundfont_manager.js → engine_components/soundfont_manager/soundfont_manager.js} +0 -0
- /package/synthetizer/audio_engine/{worklet_utilities → engine_components}/unit_converter.js +0 -0
- /package/synthetizer/audio_engine/{worklet_methods → engine_methods}/portamento_time.js +0 -0
- /package/synthetizer/audio_engine/{worklet_methods → engine_methods}/soundfont_management/clear_sound_font.js +0 -0
- /package/synthetizer/audio_engine/{worklet_methods → engine_methods}/soundfont_management/get_preset.js +0 -0
- /package/synthetizer/audio_engine/{worklet_methods → engine_methods}/soundfont_management/reload_sound_font.js +0 -0
- /package/synthetizer/audio_engine/{worklet_methods → engine_methods}/soundfont_management/send_preset_list.js +0 -0
- /package/synthetizer/audio_engine/{worklet_methods → engine_methods}/soundfont_management/set_embedded_sound_font.js +0 -0
- /package/synthetizer/audio_engine/{worklet_methods → engine_methods}/stopping_notes/stop_all_channels.js +0 -0
- /package/synthetizer/audio_engine/{worklet_methods → engine_methods}/tuning_control/transpose_all_channels.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { workletMessageType } from "../audio_engine/message_protocol/worklet_message.js";
|
|
2
|
-
import { KeyModifier, workletKeyModifierMessageType } from "../audio_engine/
|
|
2
|
+
import { KeyModifier, workletKeyModifierMessageType } from "../audio_engine/engine_components/key_modifier_manager.js";
|
|
3
3
|
|
|
4
|
-
export class
|
|
4
|
+
export class WorkletKeyModifierManagerWrapper
|
|
5
5
|
{
|
|
6
6
|
/**
|
|
7
7
|
* @param synth {Synthetizer}
|
|
@@ -42,7 +42,8 @@ export class KeyModifierManager
|
|
|
42
42
|
* patch: {
|
|
43
43
|
* bank: number,
|
|
44
44
|
* program: number
|
|
45
|
-
* }|undefined
|
|
45
|
+
* }|undefined,
|
|
46
|
+
* gain: number|undefined
|
|
46
47
|
* }} the key's modifiers
|
|
47
48
|
*/
|
|
48
49
|
addModifier(channel, midiNote, options)
|
|
@@ -50,7 +51,8 @@ export class KeyModifierManager
|
|
|
50
51
|
const velocity = options?.velocity ?? -1;
|
|
51
52
|
const program = options?.patch?.program ?? -1;
|
|
52
53
|
const bank = options?.patch?.bank ?? -1;
|
|
53
|
-
const
|
|
54
|
+
const gain = options?.gain ?? 1;
|
|
55
|
+
const mod = new KeyModifier(velocity, bank, program, gain);
|
|
54
56
|
if (this._keyModifiers[channel] === undefined)
|
|
55
57
|
{
|
|
56
58
|
this._keyModifiers[channel] = [];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { workletMessageType } from "../audio_engine/message_protocol/worklet_message.js";
|
|
2
2
|
import {
|
|
3
3
|
WorkletSoundfontManagerMessageType
|
|
4
|
-
} from "../audio_engine/
|
|
4
|
+
} from "../audio_engine/engine_components/soundfont_manager/sfman_message.js";
|
|
5
5
|
import { SpessaSynthWarn } from "../../utils/loggin.js";
|
|
6
6
|
|
|
7
7
|
export class SoundfontManager
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { consoleColors } from "../../utils/other.js";
|
|
2
|
-
import { messageTypes, midiControllers } from "../../
|
|
2
|
+
import { messageTypes, midiControllers } from "../../midi/midi_message.js";
|
|
3
3
|
import { EventHandler } from "./synth_event_handler.js";
|
|
4
4
|
import { FancyChorus } from "../audio_effects/fancy_chorus.js";
|
|
5
5
|
import { getReverbProcessor } from "../audio_effects/reverb.js";
|
|
6
6
|
import {
|
|
7
7
|
ALL_CHANNELS_OR_DIFFERENT_ACTION,
|
|
8
|
-
masterParameterType,
|
|
9
8
|
returnMessageType,
|
|
10
9
|
workletMessageType
|
|
11
10
|
} from "../audio_engine/message_protocol/worklet_message.js";
|
|
12
11
|
import { SpessaSynthInfo, SpessaSynthWarn } from "../../utils/loggin.js";
|
|
13
12
|
import { DEFAULT_SYNTH_CONFIG } from "../audio_effects/effects_config.js";
|
|
14
13
|
import { SoundfontManager } from "./synth_soundfont_manager.js";
|
|
15
|
-
import {
|
|
16
|
-
import { channelConfiguration } from "../audio_engine/
|
|
14
|
+
import { WorkletKeyModifierManagerWrapper } from "./key_modifier_manager.js";
|
|
15
|
+
import { channelConfiguration } from "../audio_engine/engine_components/controller_tables.js";
|
|
17
16
|
import { DEFAULT_PERCUSSION, DEFAULT_SYNTH_MODE, MIDI_CHANNEL_COUNT, VOICE_CAP } from "../synth_constants.js";
|
|
18
|
-
import { BasicMIDI } from "../../
|
|
17
|
+
import { BasicMIDI } from "../../midi/basic_midi.js";
|
|
19
18
|
import { fillWithDefaults } from "../../utils/fill_with_defaults.js";
|
|
20
19
|
import { DEFAULT_SEQUENCER_OPTIONS } from "../../sequencer/worklet_wrapper/default_sequencer_options.js";
|
|
21
20
|
import { WORKLET_PROCESSOR_NAME } from "./worklet_url.js";
|
|
21
|
+
import { masterParameterType } from "../audio_engine/engine_methods/controller_control/master_parameters.js";
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -199,7 +199,7 @@ export class Synthetizer
|
|
|
199
199
|
// set up message handling and managers
|
|
200
200
|
this.worklet.port.onmessage = e => this.handleMessage(e.data);
|
|
201
201
|
this.soundfontManager = new SoundfontManager(this);
|
|
202
|
-
this.keyModifierManager = new
|
|
202
|
+
this.keyModifierManager = new WorkletKeyModifierManagerWrapper(this);
|
|
203
203
|
this._snapshotCallback = undefined;
|
|
204
204
|
this.sequencerCallbackFunction = undefined;
|
|
205
205
|
|
|
@@ -3,13 +3,14 @@ import { SpessaSynthInfo, SpessaSynthLogging, SpessaSynthWarn } from "../../util
|
|
|
3
3
|
import { SpessaSynthProcessor } from "../audio_engine/main_processor.js";
|
|
4
4
|
import {
|
|
5
5
|
ALL_CHANNELS_OR_DIFFERENT_ACTION,
|
|
6
|
-
masterParameterType,
|
|
7
6
|
returnMessageType,
|
|
8
7
|
workletMessageType
|
|
9
8
|
} from "../audio_engine/message_protocol/worklet_message.js";
|
|
10
9
|
import { SynthesizerSnapshot } from "../audio_engine/snapshot/synthesizer_snapshot.js";
|
|
11
10
|
import { WORKLET_PROCESSOR_NAME } from "./worklet_url.js";
|
|
12
11
|
import { MIDI_CHANNEL_COUNT } from "../synth_constants.js";
|
|
12
|
+
import { workletKeyModifierMessageType } from "../audio_engine/engine_components/key_modifier_manager.js";
|
|
13
|
+
import { masterParameterType } from "../audio_engine/engine_methods/controller_control/master_parameters.js";
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
// a worklet processor wrapper for the synthesizer core
|
|
@@ -83,7 +84,7 @@ class WorkletSpessaProcessor extends AudioWorkletProcessor
|
|
|
83
84
|
const data = message.messageData;
|
|
84
85
|
const channel = message.channelNumber;
|
|
85
86
|
/**
|
|
86
|
-
* @type {
|
|
87
|
+
* @type {MidiAudioChannel}
|
|
87
88
|
*/
|
|
88
89
|
let channelObject;
|
|
89
90
|
if (channel >= 0)
|
|
@@ -177,27 +178,7 @@ class WorkletSpessaProcessor extends AudioWorkletProcessor
|
|
|
177
178
|
*/
|
|
178
179
|
const type = data[0];
|
|
179
180
|
const value = data[1];
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
case masterParameterType.masterPan:
|
|
183
|
-
this.synthesizer.setMasterPan(value);
|
|
184
|
-
break;
|
|
185
|
-
|
|
186
|
-
case masterParameterType.mainVolume:
|
|
187
|
-
this.synthesizer.setMasterGain(value);
|
|
188
|
-
break;
|
|
189
|
-
|
|
190
|
-
case masterParameterType.voicesCap:
|
|
191
|
-
this.synthesizer.voiceCap = value;
|
|
192
|
-
break;
|
|
193
|
-
|
|
194
|
-
case masterParameterType.interpolationType:
|
|
195
|
-
this.synthesizer.interpolationType = value;
|
|
196
|
-
break;
|
|
197
|
-
|
|
198
|
-
case masterParameterType.midiSystem:
|
|
199
|
-
this.synthesizer.setSystem(value);
|
|
200
|
-
}
|
|
181
|
+
this.synthesizer.setMasterParameter(type, value);
|
|
201
182
|
break;
|
|
202
183
|
|
|
203
184
|
case workletMessageType.setDrums:
|
|
@@ -250,7 +231,28 @@ class WorkletSpessaProcessor extends AudioWorkletProcessor
|
|
|
250
231
|
break;
|
|
251
232
|
|
|
252
233
|
case workletMessageType.keyModifierManager:
|
|
253
|
-
|
|
234
|
+
/**
|
|
235
|
+
* @type {workletKeyModifierMessageType}
|
|
236
|
+
*/
|
|
237
|
+
const keyMessageType = data[0];
|
|
238
|
+
const man = this.synthesizer.keyModifierManager;
|
|
239
|
+
const keyMessageData = data[1];
|
|
240
|
+
switch (keyMessageType)
|
|
241
|
+
{
|
|
242
|
+
default:
|
|
243
|
+
return;
|
|
244
|
+
|
|
245
|
+
case workletKeyModifierMessageType.addMapping:
|
|
246
|
+
man.addMapping(...keyMessageData);
|
|
247
|
+
break;
|
|
248
|
+
|
|
249
|
+
case workletKeyModifierMessageType.clearMappings:
|
|
250
|
+
man.clearMappings();
|
|
251
|
+
break;
|
|
252
|
+
|
|
253
|
+
case workletKeyModifierMessageType.deleteMapping:
|
|
254
|
+
man.deleteMapping(...keyMessageData);
|
|
255
|
+
}
|
|
254
256
|
break;
|
|
255
257
|
|
|
256
258
|
case workletMessageType.requestSynthesizerSnapshot:
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { SYNTHESIZER_GAIN } from "../../main_processor.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @param volume {number} 0 to 1
|
|
5
|
-
* @this {SpessaSynthProcessor}
|
|
6
|
-
*/
|
|
7
|
-
export function setMIDIVolume(volume)
|
|
8
|
-
{
|
|
9
|
-
// GM2 specification, section 4.1: master-volume is squared though,
|
|
10
|
-
// according to my own testing, e seems like a better choice
|
|
11
|
-
this.midiVolume = Math.pow(volume, Math.E);
|
|
12
|
-
this.setMasterPan(this.pan);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @param volume {number} 0-1
|
|
17
|
-
* @this {SpessaSynthProcessor}
|
|
18
|
-
*/
|
|
19
|
-
export function setMasterGain(volume)
|
|
20
|
-
{
|
|
21
|
-
this.masterGain = volume * SYNTHESIZER_GAIN;
|
|
22
|
-
this.setMasterPan(this.pan);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @param pan {number} -1 to one
|
|
27
|
-
* @this {SpessaSynthProcessor}
|
|
28
|
-
*/
|
|
29
|
-
export function setMasterPan(pan)
|
|
30
|
-
{
|
|
31
|
-
this.pan = pan;
|
|
32
|
-
// clamp to 0-1 (0 is left)
|
|
33
|
-
pan = (pan / 2) + 0.5;
|
|
34
|
-
this.panLeft = (1 - pan);
|
|
35
|
-
this.panRight = (pan);
|
|
36
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/synthetizer/audio_engine/{worklet_utilities → engine_components}/modulator_curves.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|