spessasynth_lib 3.25.18 → 3.25.19

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.
Files changed (23) hide show
  1. package/index.js +4 -0
  2. package/package.json +1 -1
  3. package/sequencer/worklet_sequencer/play.js +2 -2
  4. package/sequencer/worklet_sequencer/worklet_sequencer.js +4 -3
  5. package/soundfont/basic_soundfont/generator.js +1 -1
  6. package/soundfont/dls/read_region.js +1 -5
  7. package/synthetizer/synthetizer.js +1 -0
  8. package/synthetizer/worklet_processor.min.js +11 -11
  9. package/synthetizer/worklet_system/README.md +14 -1
  10. package/synthetizer/worklet_system/main_processor.js +94 -96
  11. package/synthetizer/worklet_system/worklet_methods/controller_control/controller_change.js +1 -1
  12. package/synthetizer/worklet_system/worklet_methods/note_on.js +1 -2
  13. package/synthetizer/worklet_system/worklet_methods/render_voice.js +2 -3
  14. package/synthetizer/worklet_system/worklet_methods/stopping_notes/kill_note.js +1 -1
  15. package/synthetizer/worklet_system/worklet_methods/stopping_notes/note_off.js +1 -1
  16. package/synthetizer/worklet_system/worklet_methods/stopping_notes/stop_all_notes.js +2 -2
  17. package/synthetizer/worklet_system/worklet_processor.js +334 -3
  18. package/synthetizer/worklet_system/worklet_utilities/lowpass_filter.js +20 -3
  19. package/synthetizer/worklet_system/worklet_utilities/stereo_panner.js +2 -2
  20. package/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js +1 -1
  21. package/synthetizer/worklet_system/worklet_utilities/worklet_voice.js +12 -11
  22. package/synthetizer/worklet_system/message_protocol/handle_message.js +0 -210
  23. package/synthetizer/worklet_system/snapshot/send_synthesizer_snapshot.js +0 -14
package/index.js CHANGED
@@ -27,6 +27,8 @@ import { DEFAULT_SYNTH_CONFIG } from "./synthetizer/audio_effects/effects_config
27
27
  import { WORKLET_URL_ABSOLUTE } from './synthetizer/worklet_url.js';
28
28
  import { SynthesizerSnapshot} from "./synthetizer/worklet_system/snapshot/synthesizer_snapshot.js";
29
29
  import { ChannelSnapshot } from "./synthetizer/worklet_system/snapshot/channel_snapshot.js";
30
+ import { NON_CC_INDEX_OFFSET } from "./synthetizer/worklet_system/worklet_utilities/controller_tables.js";
31
+ import { ALL_CHANNELS_OR_DIFFERENT_ACTION } from "./synthetizer/worklet_system/message_protocol/worklet_message.js";
30
32
 
31
33
  // Export modules
32
34
  export {
@@ -38,6 +40,8 @@ export {
38
40
  DEFAULT_PERCUSSION,
39
41
  VOICE_CAP,
40
42
  DEFAULT_SYNTH_CONFIG,
43
+ ALL_CHANNELS_OR_DIFFERENT_ACTION,
44
+ NON_CC_INDEX_OFFSET,
41
45
 
42
46
  // SoundFont
43
47
  BasicSoundBank,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spessasynth_lib",
3
- "version": "3.25.18",
3
+ "version": "3.25.19",
4
4
  "description": "MIDI and SoundFont2/DLS library with no compromises",
5
5
  "browser": "index.js",
6
6
  "type": "module",
@@ -333,7 +333,7 @@ export function setTimeTicks(ticks)
333
333
  this.pausedTime = undefined;
334
334
  this.post(
335
335
  WorkletSequencerReturnMessageType.timeChange,
336
- currentTime - this.midiData.MIDIticksToSeconds(ticks)
336
+ this.synth.currentSynthTime - this.midiData.MIDIticksToSeconds(ticks)
337
337
  );
338
338
  const isNotFinished = this._playTo(0, ticks);
339
339
  this._recalculateStartTime(this.playedTime);
@@ -351,5 +351,5 @@ export function setTimeTicks(ticks)
351
351
  */
352
352
  export function _recalculateStartTime(time)
353
353
  {
354
- this.absoluteStartTime = currentTime - time / this._playbackRate;
354
+ this.absoluteStartTime = this.synth.currentSynthTime - time / this._playbackRate;
355
355
  }
@@ -83,7 +83,7 @@ class WorkletSequencer
83
83
  * Absolute playback startTime, bases on the synth's time
84
84
  * @type {number}
85
85
  */
86
- absoluteStartTime = currentTime;
86
+ absoluteStartTime = 0;
87
87
  /**
88
88
  * Currently playing notes (for pausing and resuming)
89
89
  * @type {{
@@ -142,6 +142,7 @@ class WorkletSequencer
142
142
  constructor(spessasynthProcessor)
143
143
  {
144
144
  this.synth = spessasynthProcessor;
145
+ this.absoluteStartTime = this.synth.currentSynthTime;
145
146
  }
146
147
 
147
148
  /**
@@ -169,7 +170,7 @@ class WorkletSequencer
169
170
  return this.pausedTime;
170
171
  }
171
172
 
172
- return (currentTime - this.absoluteStartTime) * this._playbackRate;
173
+ return (this.synth.currentSynthTime - this.absoluteStartTime) * this._playbackRate;
173
174
  }
174
175
 
175
176
  set currentTime(time)
@@ -199,7 +200,7 @@ class WorkletSequencer
199
200
  this.playingNotes = [];
200
201
  const wasPaused = this.paused && this.preservePlaybackState;
201
202
  this.pausedTime = undefined;
202
- this.post(WorkletSequencerReturnMessageType.timeChange, currentTime - time);
203
+ this.post(WorkletSequencerReturnMessageType.timeChange, this.synth.currentSynthTime - time);
203
204
  if (this.midiData.duration === 0)
204
205
  {
205
206
  SpessaSynthWarn("No duration!");
@@ -129,7 +129,7 @@ generatorLimits[generatorTypes.startloopAddrsCoarseOffset] = { min: -32768, max:
129
129
  generatorLimits[generatorTypes.keyNum] = { min: -1, max: 127, def: -1 };
130
130
  generatorLimits[generatorTypes.velocity] = { min: -1, max: 127, def: -1 };
131
131
 
132
- generatorLimits[generatorTypes.initialAttenuation] = { min: -250, max: 1440, def: 0 }; // sound blaster allows 10dB of gain (divide by 0.4)
132
+ generatorLimits[generatorTypes.initialAttenuation] = { min: 0, max: 1440, def: 0 };
133
133
 
134
134
  generatorLimits[generatorTypes.endloopAddrsCoarseOffset] = { min: -32768, max: 32768, def: 0 };
135
135
 
@@ -37,11 +37,7 @@ export function readRegion(chunk)
37
37
  velMax = 127;
38
38
  velMin = 0;
39
39
  }
40
- if (keyMin === 0 && keyMax === 0)
41
- {
42
- keyMax = 127;
43
- keyMin = 0;
44
- }
40
+ // cannot do the same to key zones sadly
45
41
 
46
42
  const zone = new DLSZone(
47
43
  { min: keyMin, max: keyMax },
@@ -44,6 +44,7 @@ const DEFAULT_SYNTH_METHOD_OPTIONS = {
44
44
  };
45
45
 
46
46
 
47
+ // the "remote controller" of the worklet processor in the audio thread from the main thread
47
48
  export class Synthetizer
48
49
  {
49
50