spessasynth_lib 3.22.9 → 3.22.11

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.
@@ -476,6 +476,19 @@ export function modifyMIDI(
476
476
  midi.tracks[firstVoice.track].splice(firstIndex, 0, bankChange);
477
477
  firstIndex++;
478
478
 
479
+ // on xg, add lsb
480
+ if (!change.isDrum && midiSystem === "xg")
481
+ {
482
+ const bankChangeLSB = getControllerChange(
483
+ midiChannel,
484
+ midiControllers.lsbForControl0BankSelect,
485
+ desiredBank,
486
+ ticks
487
+ );
488
+ midi.tracks[firstVoice.track].splice(firstIndex, 0, bankChangeLSB);
489
+ firstIndex++;
490
+ }
491
+
479
492
  // add program change
480
493
  const programChange = new MidiMessage(
481
494
  ticks,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spessasynth_lib",
3
- "version": "3.22.9",
3
+ "version": "3.22.11",
4
4
  "description": "MIDI and SoundFont2/DLS library with no compromises",
5
5
  "browser": "index.js",
6
6
  "types": "@types/index.d.ts",
@@ -1,17 +1,11 @@
1
1
  import { getEvent, messageTypes, midiControllers } from "../../midi_parser/midi_message.js";
2
2
  import { WorkletSequencerReturnMessageType } from "./sequencer_message.js";
3
3
  import { MIDIticksToSeconds } from "../../midi_parser/basic_midi.js";
4
+ import { resetArray } from "../../synthetizer/worklet_system/worklet_utilities/controller_tables.js";
4
5
 
5
6
 
6
7
  // an array with preset default values
7
- const defaultControllerArray = new Int16Array(127);
8
- // default values
9
- defaultControllerArray[midiControllers.mainVolume] = 100;
10
- defaultControllerArray[midiControllers.expressionController] = 127;
11
- defaultControllerArray[midiControllers.pan] = 64;
12
- defaultControllerArray[midiControllers.releaseTime] = 64;
13
- defaultControllerArray[midiControllers.brightness] = 64;
14
- defaultControllerArray[midiControllers.reverbDepth] = 0;
8
+ const defaultControllerArray = resetArray.slice(0, 128);
15
9
 
16
10
  /**
17
11
  * plays from start to the target time, excluding note messages (to get the synth to the correct state)
@@ -130,6 +124,10 @@ export function _playTo(time, ticks = undefined)
130
124
  programs[channel].bank = ccV;
131
125
  break;
132
126
  }
127
+ else if (controllerNumber === midiControllers.resetAllControllers)
128
+ {
129
+ savedControllers[channel] = Array.from(defaultControllerArray);
130
+ }
133
131
  if (this.sendMIDIMessages)
134
132
  {
135
133
  this.sendMIDICC(channel, controllerNumber, ccV);
@@ -56,14 +56,18 @@ export function readRegion(chunk)
56
56
  const waveSampleChunk = regionChunks.find(c => c.header === "wsmp");
57
57
  // cbSize
58
58
  readLittleEndian(waveSampleChunk.chunkData, 4);
59
- const originalKey = readLittleEndian(waveSampleChunk.chunkData, 2);
59
+ let originalKey = readLittleEndian(waveSampleChunk.chunkData, 2);
60
60
 
61
61
  // sFineTune
62
- const pitchCorrection = signedInt16(
62
+ let pitchCorrection = signedInt16(
63
63
  waveSampleChunk.chunkData[waveSampleChunk.chunkData.currentIndex++],
64
64
  waveSampleChunk.chunkData[waveSampleChunk.chunkData.currentIndex++]
65
65
  );
66
66
 
67
+ const pitchCorrectionSemitones = Math.trunc(pitchCorrection / 100);
68
+ originalKey += pitchCorrectionSemitones;
69
+ pitchCorrection -= pitchCorrectionSemitones * 100;
70
+
67
71
  // gain correction: Each unit of gain represents 1/655360 dB
68
72
  // it is set after linking the sample
69
73
  const gainCorrection = readLittleEndian(waveSampleChunk.chunkData, 4);
@@ -199,6 +199,13 @@ export function readDLSSamples(waveListChunk)
199
199
  wsmpChunk.chunkData[wsmpChunk.chunkData.currentIndex++],
200
200
  wsmpChunk.chunkData[wsmpChunk.chunkData.currentIndex++]
201
201
  );
202
+
203
+ // pitch correction: convert hundreds to root key
204
+ const samplePitchSemitones = Math.trunc(samplePitch / 100);
205
+ sampleKey += samplePitchSemitones;
206
+ samplePitch -= samplePitchSemitones * 100;
207
+
208
+
202
209
  // gain is applied it manually here (literally multiplying the samples)
203
210
  const gainCorrection = readLittleEndian(wsmpChunk.chunkData, 4);
204
211
  // convert to signed and turn into decibels
@@ -252,6 +259,7 @@ export function readDLSSamples(waveListChunk)
252
259
  sampleDbAttenuation
253
260
  ));
254
261
 
262
+
255
263
  sampleID++;
256
264
  SpessaSynthInfo(
257
265
  `%cLoaded sample %c${sampleName}`,