spessasynth_core 4.2.2 → 4.2.4

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/dist/index.d.ts CHANGED
@@ -531,12 +531,39 @@ declare const dataEntryStates: {
531
531
  };
532
532
  type DataEntryState = (typeof dataEntryStates)[keyof typeof dataEntryStates];
533
533
  declare const customControllers: {
534
+ /**
535
+ * Cents, RPN for fine-tuning
536
+ */
534
537
  readonly channelTuning: 0;
538
+ /**
539
+ * Cents, only the decimal tuning, (e.g., transpose is 4.5,
540
+ * Then shift by 4 keys + tune by 50 cents)
541
+ */
535
542
  readonly channelTransposeFine: 1;
543
+ /**
544
+ * The MIDI specification assumes the default modulation depth is 50 cents,
545
+ * but it may vary for different sound banks.
546
+ * For example, if you want a modulation depth of 100 cents,
547
+ * the multiplier will be 2,
548
+ * which, for a preset with a depth of 50,
549
+ * will create a total modulation depth of 100 cents.
550
+ */
536
551
  readonly modulationMultiplier: 2;
552
+ /**
553
+ * Cents, set by system exclusive
554
+ */
537
555
  readonly masterTuning: 3;
556
+ /**
557
+ * Semitones, for RPN coarse tuning
558
+ */
538
559
  readonly channelTuningSemitones: 4;
560
+ /**
561
+ * Key shift: for system exclusive
562
+ */
539
563
  readonly channelKeyShift: 5;
564
+ /**
565
+ * Sf2 NPRN LSB for selecting a generator value
566
+ */
540
567
  readonly sf2NPRNGeneratorLSB: 6;
541
568
  };
542
569
  type CustomController = (typeof customControllers)[keyof typeof customControllers];
package/dist/index.js CHANGED
@@ -1808,21 +1808,40 @@ var dataEntryStates = {
1808
1808
  DataFine: 6
1809
1809
  };
1810
1810
  var customControllers = {
1811
+ /**
1812
+ * Cents, RPN for fine-tuning
1813
+ */
1811
1814
  channelTuning: 0,
1812
- // Cents, RPN for fine tuning
1815
+ /**
1816
+ * Cents, only the decimal tuning, (e.g., transpose is 4.5,
1817
+ * Then shift by 4 keys + tune by 50 cents)
1818
+ */
1813
1819
  channelTransposeFine: 1,
1814
- // Cents, only the decimal tuning, (e.g., transpose is 4.5,
1815
- // Then shift by 4 keys + tune by 50 cents)
1820
+ /**
1821
+ * The MIDI specification assumes the default modulation depth is 50 cents,
1822
+ * but it may vary for different sound banks.
1823
+ * For example, if you want a modulation depth of 100 cents,
1824
+ * the multiplier will be 2,
1825
+ * which, for a preset with a depth of 50,
1826
+ * will create a total modulation depth of 100 cents.
1827
+ */
1816
1828
  modulationMultiplier: 2,
1817
- // Cents, set by modulation depth RPN
1829
+ /**
1830
+ * Cents, set by system exclusive
1831
+ */
1818
1832
  masterTuning: 3,
1819
- // Cents, set by system exclusive
1833
+ /**
1834
+ * Semitones, for RPN coarse tuning
1835
+ */
1820
1836
  channelTuningSemitones: 4,
1821
- // Semitones, for RPN coarse tuning
1837
+ /**
1838
+ * Key shift: for system exclusive
1839
+ */
1822
1840
  channelKeyShift: 5,
1823
- // Key shift: for system exclusive
1841
+ /**
1842
+ * Sf2 NPRN LSB for selecting a generator value
1843
+ */
1824
1844
  sf2NPRNGeneratorLSB: 6
1825
- // Sf2 NPRN LSB for selecting a generator value
1826
1845
  };
1827
1846
 
1828
1847
  // src/midi/midi_tools/midi_editor.ts
@@ -4773,7 +4792,6 @@ setResetValue(midiControllers.vibratoDepth, 64);
4773
4792
  setResetValue(midiControllers.vibratoDelay, 64);
4774
4793
  setResetValue(midiControllers.generalPurposeController6, 64);
4775
4794
  setResetValue(midiControllers.generalPurposeController8, 64);
4776
- setResetValue(midiControllers.reverbDepth, 40);
4777
4795
  setResetValue(midiControllers.registeredParameterLSB, 127);
4778
4796
  setResetValue(midiControllers.registeredParameterMSB, 127);
4779
4797
  setResetValue(midiControllers.nonRegisteredParameterLSB, 127);
@@ -9798,6 +9816,7 @@ function dataEntryCoarse(dataCoarse) {
9798
9816
  break;
9799
9817
  }
9800
9818
  // Process NRPNs
9819
+ case dataEntryStates.NRPCoarse:
9801
9820
  case dataEntryStates.NRPFine: {
9802
9821
  const paramCoarse = this.midiControllers[midiControllers.nonRegisteredParameterMSB] >> 7;
9803
9822
  const paramFine = this.midiControllers[midiControllers.nonRegisteredParameterLSB] >> 7;
@@ -10571,7 +10590,14 @@ function portaTimeToRate(cc) {
10571
10590
  1.9030899869919435
10572
10591
  ];
10573
10592
  const thresholds = [2, 4, 8, 16, 32, 64, 80, 96, 112, 120, 124];
10574
- const s = thresholds.findLastIndex((t2) => t2 < cc) + 1;
10593
+ let s = -1;
10594
+ for (let i = thresholds.length - 1; i >= 0; i--) {
10595
+ if (thresholds[i] < cc) {
10596
+ s = i;
10597
+ break;
10598
+ }
10599
+ }
10600
+ s += 1;
10575
10601
  const t = (cc - x0[s]) * ih[s];
10576
10602
  return Math.exp(
10577
10603
  2.302585092994046 * (((a[s] * t + b[s]) * t + c[s]) * t + d[s])
@@ -13914,18 +13940,23 @@ function handleGS(syx, channelOffset = 0) {
13914
13940
  }
13915
13941
  // Rate control is ignored as it is in hertz
13916
13942
  case 4: {
13917
- channelObject.sysExModulators.setModulator(
13918
- source,
13919
- generatorTypes.vibLfoToPitch,
13920
- normalizedNotCentered * 600,
13921
- bipolar
13922
- );
13923
- sysExLogging(
13924
- channel,
13925
- normalizedNotCentered * 600,
13926
- `${sourceName} LFO1 pitch depth`,
13927
- "cents"
13928
- );
13943
+ if (source === midiControllers.modulationWheel) {
13944
+ const cents = normalizedNotCentered * 600;
13945
+ channelObject.customControllers[customControllers.modulationMultiplier] = cents / 50;
13946
+ } else {
13947
+ channelObject.sysExModulators.setModulator(
13948
+ source,
13949
+ generatorTypes.vibLfoToPitch,
13950
+ normalizedNotCentered * 600,
13951
+ bipolar
13952
+ );
13953
+ sysExLogging(
13954
+ channel,
13955
+ normalizedNotCentered * 600,
13956
+ `${sourceName} LFO1 pitch depth`,
13957
+ "cents"
13958
+ );
13959
+ }
13929
13960
  break;
13930
13961
  }
13931
13962
  case 5: {