spessasynth_core 1.0.5 → 1.0.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/.idea/inspectionProfiles/Project_Default.xml +0 -0
- package/.idea/jsLibraryMappings.xml +0 -0
- package/.idea/modules.xml +0 -0
- package/.idea/spessasynth_core.iml +0 -0
- package/.idea/vcs.xml +0 -0
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/index.js +0 -0
- package/package.json +1 -1
- package/spessasynth_core/midi_parser/README.md +0 -0
- package/spessasynth_core/midi_parser/midi_loader.js +0 -0
- package/spessasynth_core/midi_parser/midi_message.js +0 -0
- package/spessasynth_core/sequencer/sequencer.js +0 -0
- package/spessasynth_core/sequencer/worklet_sequencer/play.js +0 -0
- package/spessasynth_core/sequencer/worklet_sequencer/process_event.js +0 -0
- package/spessasynth_core/sequencer/worklet_sequencer/process_tick.js +0 -0
- package/spessasynth_core/sequencer/worklet_sequencer/song_control.js +0 -0
- package/spessasynth_core/soundfont/README.md +0 -0
- package/spessasynth_core/soundfont/chunk/generators.js +0 -0
- package/spessasynth_core/soundfont/chunk/instruments.js +0 -0
- package/spessasynth_core/soundfont/chunk/modulators.js +0 -0
- package/spessasynth_core/soundfont/chunk/presets.js +0 -0
- package/spessasynth_core/soundfont/chunk/riff_chunk.js +0 -0
- package/spessasynth_core/soundfont/chunk/samples.js +0 -0
- package/spessasynth_core/soundfont/chunk/zones.js +0 -0
- package/spessasynth_core/soundfont/soundfont_parser.js +0 -0
- package/spessasynth_core/synthetizer/README.md +0 -0
- package/spessasynth_core/synthetizer/synthesizer.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/README.md +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_methods/controller_control.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_methods/data_entry.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_methods/note_off.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_methods/note_on.js +2 -2
- package/spessasynth_core/synthetizer/worklet_system/worklet_methods/program_control.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_methods/system_exclusive.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_methods/tuning_control.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_methods/vibrato_control.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_methods/voice_control.js +51 -15
- package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/lfo.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/lowpass_filter.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/modulation_envelope.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/modulator_curves.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/stereo_panner.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/unit_converter.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/volume_envelope.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/wavetable_oscillator.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/worklet_modulator.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js +0 -0
- package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/worklet_voice.js +0 -0
- package/spessasynth_core/utils/README.md +0 -0
- package/spessasynth_core/utils/buffer_to_wav.js +0 -0
- package/spessasynth_core/utils/byte_functions.js +0 -0
- package/spessasynth_core/utils/loggin.js +0 -0
- package/spessasynth_core/utils/other.js +0 -0
- package/spessasynth_core/utils/shiftable_array.js +0 -0
- package/spessasynth_core/utils/stbvorbis_sync.js +0 -0
|
File without changes
|
|
File without changes
|
package/.idea/modules.xml
CHANGED
|
File without changes
|
|
File without changes
|
package/.idea/vcs.xml
CHANGED
|
File without changes
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
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
|
|
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
|
|
@@ -64,12 +64,12 @@ export function noteOn(channel, midiNote, velocity, enableDebugging = false)
|
|
|
64
64
|
computeModulators(voice, this.workletProcessorChannels[channel].midiControllers);
|
|
65
65
|
voice.currentAttenuationDb = 100;
|
|
66
66
|
})
|
|
67
|
-
channelVoices.push(...voices);
|
|
68
67
|
|
|
69
68
|
this.totalVoicesAmount += voices.length;
|
|
70
69
|
// cap the voices
|
|
71
70
|
if(this.totalVoicesAmount > VOICE_CAP)
|
|
72
71
|
{
|
|
73
|
-
this.voiceKilling(
|
|
72
|
+
this.voiceKilling(voices.length);
|
|
74
73
|
}
|
|
74
|
+
channelVoices.push(...voices);
|
|
75
75
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -143,6 +143,35 @@ export function renderVoice(channel, voice, output, reverbOutput, chorusOutput)
|
|
|
143
143
|
chorusOutput, voice.modulatedGenerators[generatorTypes.chorusEffectsSend]);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
/**
|
|
147
|
+
* @param channel {WorkletProcessorChannel}
|
|
148
|
+
* @param voice {WorkletVoice}
|
|
149
|
+
* @return {number}
|
|
150
|
+
*/
|
|
151
|
+
function getPriority(channel, voice)
|
|
152
|
+
{
|
|
153
|
+
let priority = 0;
|
|
154
|
+
if(channel.drumChannel)
|
|
155
|
+
{
|
|
156
|
+
// important
|
|
157
|
+
priority += 5;
|
|
158
|
+
}
|
|
159
|
+
if(voice.isInRelease)
|
|
160
|
+
{
|
|
161
|
+
// not important
|
|
162
|
+
priority -= 5;
|
|
163
|
+
}
|
|
164
|
+
// less velocity = less important
|
|
165
|
+
priority += voice.velocity / 25; // map to 0-5
|
|
166
|
+
// the newer, more important
|
|
167
|
+
priority -= voice.volumeEnvelopeState;
|
|
168
|
+
if(voice.isInRelease)
|
|
169
|
+
{
|
|
170
|
+
priority -= 5;
|
|
171
|
+
}
|
|
172
|
+
priority -= voice.currentAttenuationDb / 50;
|
|
173
|
+
return priority;
|
|
174
|
+
}
|
|
146
175
|
|
|
147
176
|
/**
|
|
148
177
|
* @this {Synthesizer}
|
|
@@ -150,23 +179,30 @@ export function renderVoice(channel, voice, output, reverbOutput, chorusOutput)
|
|
|
150
179
|
*/
|
|
151
180
|
export function voiceKilling(amount)
|
|
152
181
|
{
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* @type {WorkletVoice[]}
|
|
158
|
-
*/
|
|
159
|
-
voicesOrderedByVelocity = voicesOrderedByVelocity.flat();
|
|
160
|
-
voicesOrderedByVelocity.sort((v1, v2) => v1.velocity - v2.velocity);
|
|
161
|
-
if(voicesOrderedByVelocity.length < amount)
|
|
182
|
+
let allVoices = [];
|
|
183
|
+
for (const channel of this.workletProcessorChannels)
|
|
162
184
|
{
|
|
163
|
-
|
|
185
|
+
for (const voice of channel.voices)
|
|
186
|
+
{
|
|
187
|
+
if (!voice.finished)
|
|
188
|
+
{
|
|
189
|
+
const priority = getPriority(channel, voice);
|
|
190
|
+
allVoices.push({ channel, voice, priority });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
164
193
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
194
|
+
|
|
195
|
+
// Step 2: Sort voices by priority (ascending order)
|
|
196
|
+
allVoices.sort((a, b) => a.priority - b.priority);
|
|
197
|
+
const voicesToRemove = allVoices.slice(0, amount);
|
|
198
|
+
|
|
199
|
+
for (const { channel, voice } of voicesToRemove)
|
|
200
|
+
{
|
|
201
|
+
const index = channel.voices.indexOf(voice);
|
|
202
|
+
if (index > -1)
|
|
203
|
+
{
|
|
204
|
+
channel.voices.splice(index, 1);
|
|
205
|
+
}
|
|
170
206
|
}
|
|
171
207
|
}
|
|
172
208
|
|
|
File without changes
|
|
File without changes
|
package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/modulation_envelope.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/wavetable_oscillator.js
CHANGED
|
File without changes
|
|
File without changes
|
package/spessasynth_core/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js
CHANGED
|
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
|