spessasynth_lib 3.24.28 → 3.24.35
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 +1 -1
- package/external_midi/web_midi_link.js +1 -1
- package/index.js +8 -52
- package/midi_parser/basic_midi.js +15 -30
- package/midi_parser/midi_builder.js +6 -6
- package/midi_parser/midi_data.js +2 -2
- package/midi_parser/midi_editor.js +15 -15
- package/midi_parser/midi_loader.js +3 -3
- package/midi_parser/midi_message.js +2 -2
- package/midi_parser/midi_sequence.js +32 -4
- package/midi_parser/midi_writer.js +8 -8
- package/midi_parser/rmidi_writer.js +20 -21
- package/midi_parser/used_keys_loaded.js +8 -6
- package/package.json +1 -1
- package/sequencer/sequencer.js +6 -6
- package/sequencer/worklet_sequencer/events.js +2 -1
- package/sequencer/worklet_sequencer/play.js +2 -3
- package/sequencer/worklet_sequencer/process_event.js +1 -1
- package/sequencer/worklet_sequencer/process_tick.js +1 -1
- package/sequencer/worklet_sequencer/sequencer_message.js +1 -1
- package/sequencer/worklet_sequencer/song_control.js +6 -7
- package/sequencer/worklet_sequencer/worklet_sequencer.js +2 -1
- package/soundfont/basic_soundfont/basic_soundfont.js +197 -13
- package/soundfont/basic_soundfont/generator.js +18 -16
- package/soundfont/basic_soundfont/modulator.js +3 -0
- package/soundfont/basic_soundfont/riff_chunk.js +2 -2
- package/soundfont/basic_soundfont/write_dls/art2.js +1 -1
- package/soundfont/basic_soundfont/write_dls/combine_zones.js +12 -10
- package/soundfont/basic_soundfont/write_dls/ins.js +2 -2
- package/soundfont/basic_soundfont/write_dls/lins.js +1 -1
- package/soundfont/basic_soundfont/write_dls/modulator_converter.js +9 -9
- package/soundfont/basic_soundfont/write_dls/rgn2.js +5 -5
- package/soundfont/basic_soundfont/write_dls/wave.js +2 -1
- package/soundfont/basic_soundfont/write_dls/write_dls.js +1 -1
- package/soundfont/basic_soundfont/write_dls/wsmp.js +2 -2
- package/soundfont/basic_soundfont/write_dls/wvpl.js +1 -1
- package/soundfont/basic_soundfont/write_sf2/ibag.js +2 -2
- package/soundfont/basic_soundfont/write_sf2/igen.js +20 -17
- package/soundfont/basic_soundfont/write_sf2/imod.js +3 -3
- package/soundfont/basic_soundfont/write_sf2/inst.js +2 -2
- package/soundfont/basic_soundfont/write_sf2/pbag.js +2 -2
- package/soundfont/basic_soundfont/write_sf2/pgen.js +21 -18
- package/soundfont/basic_soundfont/write_sf2/phdr.js +2 -2
- package/soundfont/basic_soundfont/write_sf2/pmod.js +2 -2
- package/soundfont/basic_soundfont/write_sf2/sdta.js +1 -1
- package/soundfont/basic_soundfont/write_sf2/shdr.js +1 -1
- package/soundfont/basic_soundfont/write_sf2/write.js +7 -6
- package/soundfont/dls/articulator_converter.js +1 -0
- package/soundfont/dls/dls_destinations.js +3 -3
- package/soundfont/dls/dls_preset.js +1 -1
- package/soundfont/dls/dls_soundfont.js +7 -7
- package/soundfont/dls/read_instrument.js +1 -1
- package/soundfont/dls/read_region.js +1 -0
- package/soundfont/dls/read_samples.js +4 -5
- package/soundfont/load_soundfont.js +1 -1
- package/soundfont/read_sf2/presets.js +1 -1
- package/soundfont/read_sf2/soundfont.js +5 -5
- package/synthetizer/audio_effects/effects_config.js +3 -3
- package/synthetizer/audio_effects/fancy_chorus.js +7 -7
- package/synthetizer/audio_effects/reverb.js +5 -5
- package/synthetizer/audio_effects/reverb_as_binary.js +15 -0
- package/synthetizer/audio_effects/reverb_buffer.min.js +1 -0
- package/synthetizer/synth_constants.js +14 -0
- package/synthetizer/synthetizer.js +1 -17
- package/synthetizer/worklet_processor.min.js +14 -12
- package/synthetizer/worklet_system/main_processor.js +2 -2
- package/synthetizer/worklet_system/worklet_methods/controller_control/controller_change.js +1 -1
- package/synthetizer/worklet_system/worklet_methods/controller_control/reset_controllers.js +1 -1
- package/synthetizer/worklet_system/worklet_methods/create_worklet_channel.js +2 -1
- package/synthetizer/worklet_system/worklet_methods/worklet_soundfont_manager/worklet_soundfont_manager.js +2 -2
- package/synthetizer/worklet_system/worklet_processor.js +1 -1
- package/soundfont/basic_soundfont/write_sf2/soundfont_trimmer.js +0 -185
- package/synthetizer/audio_effects/impulse_response_2.flac +0 -0
- package/synthetizer/worklet_system/minify_processor.sh +0 -4
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DEFAULT_PERCUSSION, DEFAULT_SYNTH_MODE, VOICE_CAP } from "../synthetizer.js";
|
|
2
1
|
import { WorkletSequencer } from "../../sequencer/worklet_sequencer/worklet_sequencer.js";
|
|
3
2
|
import { SpessaSynthInfo } from "../../utils/loggin.js";
|
|
4
3
|
import { consoleColors } from "../../utils/other.js";
|
|
@@ -28,6 +27,7 @@ import { sendSynthesizerSnapshot } from "./snapshot/send_synthesizer_snapshot.js
|
|
|
28
27
|
import { applySynthesizerSnapshot } from "./snapshot/apply_synthesizer_snapshot.js";
|
|
29
28
|
import { createWorkletChannel } from "./worklet_methods/create_worklet_channel.js";
|
|
30
29
|
import { FILTER_SMOOTHING_FACTOR } from "./worklet_utilities/lowpass_filter.js";
|
|
30
|
+
import { DEFAULT_PERCUSSION, DEFAULT_SYNTH_MODE, VOICE_CAP } from "../synth_constants.js";
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -166,7 +166,7 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
|
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* Overrides the main soundfont (embedded, for example)
|
|
169
|
-
* @type {
|
|
169
|
+
* @type {BasicSoundBank}
|
|
170
170
|
*/
|
|
171
171
|
overrideSoundfont = undefined;
|
|
172
172
|
|
|
@@ -2,8 +2,8 @@ import { SpessaSynthInfo } from "../../../../utils/loggin.js";
|
|
|
2
2
|
import { midiControllers } from "../../../../midi_parser/midi_message.js";
|
|
3
3
|
import { computeModulators } from "../../worklet_utilities/worklet_modulator.js";
|
|
4
4
|
import { consoleColors } from "../../../../utils/other.js";
|
|
5
|
-
import { DEFAULT_PERCUSSION } from "../../../synthetizer.js";
|
|
6
5
|
import { channelConfiguration, dataEntryStates } from "../../worklet_utilities/controller_tables.js";
|
|
6
|
+
import { DEFAULT_PERCUSSION } from "../../../synth_constants.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param controllerNumber {number}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { consoleColors } from "../../../../utils/other.js";
|
|
2
|
-
import { DEFAULT_PERCUSSION, DEFAULT_SYNTH_MODE } from "../../../synthetizer.js";
|
|
3
2
|
import { SpessaSynthInfo } from "../../../../utils/loggin.js";
|
|
4
3
|
import { modulatorSources } from "../../../../soundfont/basic_soundfont/modulator.js";
|
|
5
4
|
import {
|
|
@@ -11,6 +10,7 @@ import {
|
|
|
11
10
|
resetArray
|
|
12
11
|
} from "../../worklet_utilities/controller_tables.js";
|
|
13
12
|
import { midiControllers } from "../../../../midi_parser/midi_message.js";
|
|
13
|
+
import { DEFAULT_PERCUSSION, DEFAULT_SYNTH_MODE } from "../../../synth_constants.js";
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -5,7 +5,7 @@ import { loadSoundFont } from "../../../../soundfont/load_soundfont.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {Object} SoundFontType
|
|
7
7
|
* @property {string} id - unique id for the soundfont
|
|
8
|
-
* @property {
|
|
8
|
+
* @property {BasicSoundBank} soundfont - the soundfont itself
|
|
9
9
|
* @property {number} bankOffset - the soundfont's bank offset
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -245,7 +245,7 @@ export class WorkletSoundfontManager
|
|
|
245
245
|
{
|
|
246
246
|
this.soundfontList.forEach(s =>
|
|
247
247
|
{
|
|
248
|
-
s.soundfont.
|
|
248
|
+
s.soundfont.destroySoundBank();
|
|
249
249
|
});
|
|
250
250
|
delete this.soundfontList;
|
|
251
251
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WORKLET_PROCESSOR_NAME } from "../synthetizer.js";
|
|
2
1
|
import { consoleColors } from "../../utils/other.js";
|
|
3
2
|
import { SpessaSynthProcessor } from "./main_processor.js";
|
|
4
3
|
import { SpessaSynthInfo } from "../../utils/loggin.js";
|
|
4
|
+
import { WORKLET_PROCESSOR_NAME } from "../synth_constants.js";
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
// noinspection JSUnresolvedReference
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { consoleColors } from "../../../utils/other.js";
|
|
2
|
-
import {
|
|
3
|
-
SpessaSynthGroup,
|
|
4
|
-
SpessaSynthGroupCollapsed,
|
|
5
|
-
SpessaSynthGroupEnd,
|
|
6
|
-
SpessaSynthInfo
|
|
7
|
-
} from "../../../utils/loggin.js";
|
|
8
|
-
import { getUsedProgramsAndKeys } from "../../../midi_parser/used_keys_loaded.js";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @param soundfont {BasicSoundFont}
|
|
12
|
-
* @param mid {BasicMIDI}
|
|
13
|
-
* @returns {Uint8Array}
|
|
14
|
-
*/
|
|
15
|
-
export function trimSoundfont(soundfont, mid)
|
|
16
|
-
{
|
|
17
|
-
/**
|
|
18
|
-
* @param instrument {Instrument}
|
|
19
|
-
* @param combos {{key: number, velocity: number}[]}
|
|
20
|
-
* @returns {number}
|
|
21
|
-
*/
|
|
22
|
-
function trimInstrumentZones(instrument, combos)
|
|
23
|
-
{
|
|
24
|
-
let trimmedIZones = 0;
|
|
25
|
-
for (let iZoneIndex = 0; iZoneIndex < instrument.instrumentZones.length; iZoneIndex++)
|
|
26
|
-
{
|
|
27
|
-
const iZone = instrument.instrumentZones[iZoneIndex];
|
|
28
|
-
if (iZone.isGlobal)
|
|
29
|
-
{
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
const iKeyRange = iZone.keyRange;
|
|
33
|
-
const iVelRange = iZone.velRange;
|
|
34
|
-
let isIZoneUsed = false;
|
|
35
|
-
for (const iCombo of combos)
|
|
36
|
-
{
|
|
37
|
-
if (
|
|
38
|
-
(iCombo.key >= iKeyRange.min && iCombo.key <= iKeyRange.max) &&
|
|
39
|
-
(iCombo.velocity >= iVelRange.min && iCombo.velocity <= iVelRange.max)
|
|
40
|
-
)
|
|
41
|
-
{
|
|
42
|
-
isIZoneUsed = true;
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (!isIZoneUsed)
|
|
47
|
-
{
|
|
48
|
-
SpessaSynthInfo(
|
|
49
|
-
`%c${iZone.sample.sampleName} %cremoved from %c${instrument.instrumentName}%c. Use count: %c${iZone.useCount - 1}`,
|
|
50
|
-
consoleColors.recognized,
|
|
51
|
-
consoleColors.info,
|
|
52
|
-
consoleColors.recognized,
|
|
53
|
-
consoleColors.info,
|
|
54
|
-
consoleColors.recognized
|
|
55
|
-
);
|
|
56
|
-
if (instrument.safeDeleteZone(iZoneIndex))
|
|
57
|
-
{
|
|
58
|
-
trimmedIZones++;
|
|
59
|
-
iZoneIndex--;
|
|
60
|
-
SpessaSynthInfo(
|
|
61
|
-
`%c${iZone.sample.sampleName} %cdeleted`,
|
|
62
|
-
consoleColors.recognized,
|
|
63
|
-
consoleColors.info
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
if (iZone.sample.useCount < 1)
|
|
67
|
-
{
|
|
68
|
-
soundfont.deleteSample(iZone.sample);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
return trimmedIZones;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
SpessaSynthGroup(
|
|
77
|
-
"%cTrimming soundfont...",
|
|
78
|
-
consoleColors.info
|
|
79
|
-
);
|
|
80
|
-
const usedProgramsAndKeys = getUsedProgramsAndKeys(mid, soundfont);
|
|
81
|
-
|
|
82
|
-
SpessaSynthGroupCollapsed(
|
|
83
|
-
"%cModifying soundfont...",
|
|
84
|
-
consoleColors.info
|
|
85
|
-
);
|
|
86
|
-
SpessaSynthInfo("Detected keys for midi:", usedProgramsAndKeys);
|
|
87
|
-
// modify the soundfont to only include programs and samples that are used
|
|
88
|
-
for (let presetIndex = 0; presetIndex < soundfont.presets.length; presetIndex++)
|
|
89
|
-
{
|
|
90
|
-
const p = soundfont.presets[presetIndex];
|
|
91
|
-
const string = p.bank + ":" + p.program;
|
|
92
|
-
const used = usedProgramsAndKeys[string];
|
|
93
|
-
if (used === undefined)
|
|
94
|
-
{
|
|
95
|
-
SpessaSynthInfo(
|
|
96
|
-
`%cDeleting preset %c${p.presetName}%c and its zones`,
|
|
97
|
-
consoleColors.info,
|
|
98
|
-
consoleColors.recognized,
|
|
99
|
-
consoleColors.info
|
|
100
|
-
);
|
|
101
|
-
soundfont.deletePreset(p);
|
|
102
|
-
presetIndex--;
|
|
103
|
-
}
|
|
104
|
-
else
|
|
105
|
-
{
|
|
106
|
-
const combos = [...used].map(s =>
|
|
107
|
-
{
|
|
108
|
-
const split = s.split("-");
|
|
109
|
-
return {
|
|
110
|
-
key: parseInt(split[0]),
|
|
111
|
-
velocity: parseInt(split[1])
|
|
112
|
-
};
|
|
113
|
-
});
|
|
114
|
-
SpessaSynthGroupCollapsed(
|
|
115
|
-
`%cTrimming %c${p.presetName}`,
|
|
116
|
-
consoleColors.info,
|
|
117
|
-
consoleColors.recognized
|
|
118
|
-
);
|
|
119
|
-
SpessaSynthInfo(`Keys for ${p.presetName}:`, combos);
|
|
120
|
-
let trimmedZones = 0;
|
|
121
|
-
// clean the preset to only use zones that are used
|
|
122
|
-
for (let zoneIndex = 0; zoneIndex < p.presetZones.length; zoneIndex++)
|
|
123
|
-
{
|
|
124
|
-
const zone = p.presetZones[zoneIndex];
|
|
125
|
-
if (zone.isGlobal)
|
|
126
|
-
{
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
const keyRange = zone.keyRange;
|
|
130
|
-
const velRange = zone.velRange;
|
|
131
|
-
// check if any of the combos matches the zone
|
|
132
|
-
let isZoneUsed = false;
|
|
133
|
-
for (const combo of combos)
|
|
134
|
-
{
|
|
135
|
-
if (
|
|
136
|
-
(combo.key >= keyRange.min && combo.key <= keyRange.max) &&
|
|
137
|
-
(combo.velocity >= velRange.min && combo.velocity <= velRange.max)
|
|
138
|
-
)
|
|
139
|
-
{
|
|
140
|
-
// zone is used, trim the instrument zones
|
|
141
|
-
isZoneUsed = true;
|
|
142
|
-
const trimmedIZones = trimInstrumentZones(zone.instrument, combos);
|
|
143
|
-
SpessaSynthInfo(
|
|
144
|
-
`%cTrimmed off %c${trimmedIZones}%c zones from %c${zone.instrument.instrumentName}`,
|
|
145
|
-
consoleColors.info,
|
|
146
|
-
consoleColors.recognized,
|
|
147
|
-
consoleColors.info,
|
|
148
|
-
consoleColors.recognized
|
|
149
|
-
);
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
if (!isZoneUsed)
|
|
154
|
-
{
|
|
155
|
-
trimmedZones++;
|
|
156
|
-
p.deleteZone(zoneIndex);
|
|
157
|
-
if (zone.instrument.useCount < 1)
|
|
158
|
-
{
|
|
159
|
-
soundfont.deleteInstrument(zone.instrument);
|
|
160
|
-
}
|
|
161
|
-
zoneIndex--;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
SpessaSynthInfo(
|
|
165
|
-
`%cTrimmed off %c${trimmedZones}%c zones from %c${p.presetName}`,
|
|
166
|
-
consoleColors.info,
|
|
167
|
-
consoleColors.recognized,
|
|
168
|
-
consoleColors.info,
|
|
169
|
-
consoleColors.recognized
|
|
170
|
-
);
|
|
171
|
-
SpessaSynthGroupEnd();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
soundfont.removeUnusedElements();
|
|
175
|
-
|
|
176
|
-
soundfont.soundFontInfo["ICMT"] = `NOTE: This soundfont was trimmed by SpessaSynth to only contain presets used in "${mid.midiName}"\n\n`
|
|
177
|
-
+ soundfont.soundFontInfo["ICMT"];
|
|
178
|
-
|
|
179
|
-
SpessaSynthInfo(
|
|
180
|
-
"%cSoundfont modified!",
|
|
181
|
-
consoleColors.recognized
|
|
182
|
-
);
|
|
183
|
-
SpessaSynthGroupEnd();
|
|
184
|
-
SpessaSynthGroupEnd();
|
|
185
|
-
}
|
|
Binary file
|