spessasynth_core 3.26.6 → 3.26.8

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 CHANGED
@@ -21,6 +21,12 @@ npm install --save spessasynth_core
21
21
 
22
22
  > Note: This is the new heart of the SpessaSynth library, after the repository has been split.
23
23
 
24
+ **Project index**
25
+
26
+ - spessasynth_core (you are here) - SF2/DLS/MIDI library
27
+ - [spessasynth_lib](https://github.com/spessasus/spessasynth_lib) - spessasynth_core wrapper optimized for browsers and WebAudioAPI
28
+ - [SpessaSynth](https://github.com/spessasus/SpessaSynth) - online/local web player/editor application
29
+
24
30
  ## Current Features
25
31
 
26
32
  ### Easy Integration
@@ -87,7 +93,7 @@ npm install --save spessasynth_core
87
93
  - **Compression and trimming support:** Reduce a MIDI file with a 1GB soundfont to **as small as 5MB**!
88
94
  - **DLS Version support:** The original legacy format with bank offset detection!
89
95
  - **Automatic bank shifting and validation:** Every soundfont *just works!*
90
- - **Metadata support:** Add title, artist, album name and cover and more! And of course read them too! *(In any encoding!)*
96
+ - **Metadata support:** Add title, artist, album name and cover and more! And of course, read them too! *(In any encoding!)*
91
97
  - **Compatible with [Falcosoft Midi Player 6!](https://falcosoft.hu/softwares.html#midiplayer)**
92
98
  - **Easy saving:** [As simple as saving a MIDI file!](https://github.com/spessasus/spessasynth_core/wiki/Writing-MIDI-Files#writermidi)
93
99
 
@@ -120,13 +126,9 @@ npm install --save spessasynth_core
120
126
  - **Loop multiple times:** *Render two (or more) loops into the file for seamless transitions!*
121
127
  - *That's right, saving as WAV is also [just one function!](https://github.com/spessasus/spessasynth_core/wiki/Writing-Wave-Files#audiobuffertowav)*
122
128
 
123
- ## Limitations
124
- - Synth's performance may be suboptimal, especially on mobile devices.
125
- - [SF2 to DLS Conversion](https://github.com/spessasus/SpessaSynth/wiki/DLS-Conversion-Problem)
126
- - Audio may sometimes sound distorted in Chrome, Edge, Brave,
127
- etc. due to a **[Chromium Bug](https://issues.chromium.org/issues/367304685).**
128
- I can't do anything about it, only hope that it gets fixed.
129
- Please consider voting for it on the bug tracker to get it fixed!
129
+ ### Limitations
130
+ - Synth's performance may be questionable sometimes
131
+ - [SF2 to DLS Conversion limits](https://github.com/spessasus/SpessaSynth/wiki/DLS-Conversion-Problem)
130
132
 
131
133
  #### TODO
132
134
  - Improve the performance of the engine
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spessasynth_core",
3
- "version": "3.26.6",
3
+ "version": "3.26.8",
4
4
  "description": "MIDI and SoundFont2/DLS library with no compromises",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -402,6 +402,9 @@ class BasicMIDI extends MIDISequenceData
402
402
  }
403
403
  }
404
404
 
405
+ // fix empty port channel offsets (do a copy to turn empty slots into undefined so map goes over them)
406
+ this.midiPortChannelOffsets = [...this.midiPortChannelOffsets].map(o => o ?? 0);
407
+
405
408
  // fix midi ports:
406
409
  // midi tracks without ports will have a value of -1
407
410
  // if all ports have a value of -1, set it to 0,
@@ -426,7 +429,7 @@ class BasicMIDI extends MIDISequenceData
426
429
  {
427
430
  defaultPort = 0;
428
431
  }
429
- this.midiPorts = this.midiPorts.map(port => port === -1 ? defaultPort : port);
432
+ this.midiPorts = this.midiPorts.map(port => port === -1 || port === undefined ? defaultPort : port);
430
433
  // add fake port if empty
431
434
  if (this.midiPortChannelOffsets.length === 0)
432
435
  {
@@ -334,6 +334,10 @@ export function play(resetTime = false)
334
334
  */
335
335
  export function setTimeTicks(ticks)
336
336
  {
337
+ if (!this.midiData)
338
+ {
339
+ return;
340
+ }
337
341
  this.stop();
338
342
  this.playingNotes = [];
339
343
  this.pausedTime = undefined;
@@ -208,6 +208,10 @@ class SpessaSynthSequencer
208
208
 
209
209
  set currentTime(time)
210
210
  {
211
+ if (!this.midiData)
212
+ {
213
+ return;
214
+ }
211
215
  if (time > this.duration || time < 0)
212
216
  {
213
217
  // time is 0