spessasynth_lib 3.20.22 → 3.20.23

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.
@@ -26,7 +26,7 @@ import {
26
26
  setMasterPan,
27
27
  setMIDIVolume,
28
28
  } from './worklet_methods/controller_control.js'
29
- import { disableAndLockVibrato, setVibrato } from './worklet_methods/vibrato_control.js'
29
+ import { disableAndLockGSNRPN, setVibrato } from './worklet_methods/vibrato_control.js'
30
30
  import { dataEntryCoarse, dataEntryFine } from './worklet_methods/data_entry.js'
31
31
  import { createWorkletChannel } from './worklet_utilities/worklet_processor_channel.js'
32
32
  import { resetAllControllers, resetControllers, resetParameters } from './worklet_methods/reset_controllers.js'
@@ -385,7 +385,7 @@ SpessaSynthProcessor.prototype.muteChannel = muteChannel;
385
385
 
386
386
  // custom vibrato related
387
387
  SpessaSynthProcessor.prototype.setVibrato = setVibrato;
388
- SpessaSynthProcessor.prototype.disableAndLockVibrato = disableAndLockVibrato;
388
+ SpessaSynthProcessor.prototype.disableAndLockGSNRPN = disableAndLockGSNRPN;
389
389
 
390
390
  // data entry related
391
391
  SpessaSynthProcessor.prototype.dataEntryCoarse = dataEntryCoarse;
@@ -77,7 +77,7 @@ export function handleMessage(message)
77
77
  {
78
78
  if(data.rate === -1)
79
79
  {
80
- this.disableAndLockVibrato(i);
80
+ this.disableAndLockGSNRPN(i);
81
81
  }
82
82
  else
83
83
  {
@@ -88,7 +88,7 @@ export function handleMessage(message)
88
88
  else
89
89
  if(data.rate === -1)
90
90
  {
91
- this.disableAndLockVibrato(channel);
91
+ this.disableAndLockGSNRPN(channel);
92
92
  }
93
93
  else
94
94
  {
@@ -43,6 +43,10 @@ export function dataEntryCoarse(channel, dataValue)
43
43
  {
44
44
  return;
45
45
  }
46
+ if(channelObject.lockGSNRPNParams)
47
+ {
48
+ return;
49
+ }
46
50
  switch(channelObject.NRPCoarse)
47
51
  {
48
52
  default:
@@ -83,10 +87,6 @@ export function dataEntryCoarse(channel, dataValue)
83
87
 
84
88
  // vibrato rate
85
89
  case 0x08:
86
- if(channelObject.lockVibrato)
87
- {
88
- return;
89
- }
90
90
  if(dataValue === 64)
91
91
  {
92
92
  return;
@@ -103,10 +103,6 @@ export function dataEntryCoarse(channel, dataValue)
103
103
 
104
104
  // vibrato depth
105
105
  case 0x09:
106
- if(channelObject.lockVibrato)
107
- {
108
- return;
109
- }
110
106
  if(dataValue === 64)
111
107
  {
112
108
  return;
@@ -123,10 +119,6 @@ export function dataEntryCoarse(channel, dataValue)
123
119
 
124
120
  // vibrato delay
125
121
  case 0x0A:
126
- if(channelObject.lockVibrato)
127
- {
128
- return;
129
- }
130
122
  if(dataValue === 64)
131
123
  {
132
124
  return;
@@ -156,10 +148,6 @@ export function dataEntryCoarse(channel, dataValue)
156
148
 
157
149
  // drum key tuning
158
150
  case 0x18:
159
- if(!channelObject.drumChannel)
160
- {
161
- return;
162
- }
163
151
  // fine is the key number and data value is the semitone change
164
152
  const semitones = dataValue - 64;
165
153
  channelObject.keyCentTuning[channelObject.NRPFine] = semitones * 100;
@@ -172,10 +160,6 @@ export function dataEntryCoarse(channel, dataValue)
172
160
 
173
161
  // drum reverb
174
162
  case 0x1D:
175
- if(!channelObject.drumChannel)
176
- {
177
- return;
178
- }
179
163
  const reverb = dataValue;
180
164
  this.controllerChange(channel, midiControllers.effects1Depth, reverb);
181
165
  SpessaSynthInfo(
@@ -60,7 +60,7 @@ export function sendSynthesizerSnapshot()
60
60
  customControllers: channel.customControllers,
61
61
 
62
62
  channelVibrato: channel.channelVibrato,
63
- lockVibrato: channel.lockVibrato,
63
+ lockVibrato: channel.lockGSNRPNParams,
64
64
 
65
65
  channelTransposeKeyShift: channel.channelTransposeKeyShift,
66
66
  channelOctaveTuning: channel.channelOctaveTuning,
@@ -123,7 +123,7 @@ export function applySynthesizerSnapshot(snapshot)
123
123
 
124
124
  // restore vibrato and transpose
125
125
  channelObject.channelVibrato = channelSnapshot.channelVibrato;
126
- channelObject.lockVibrato = channelSnapshot.lockVibrato;
126
+ channelObject.lockGSNRPNParams = channelSnapshot.lockVibrato;
127
127
  channelObject.channelTransposeKeyShift = channelSnapshot.channelTransposeKeyShift;
128
128
  channelObject.channelOctaveTuning = channelSnapshot.channelOctaveTuning;
129
129
 
@@ -2,9 +2,9 @@
2
2
  * @param channel {number}
3
3
  * @this {SpessaSynthProcessor}
4
4
  */
5
- export function disableAndLockVibrato(channel)
5
+ export function disableAndLockGSNRPN(channel)
6
6
  {
7
- this.workletProcessorChannels[channel].lockVibrato = true;
7
+ this.workletProcessorChannels[channel].lockGSNRPNParams = true;
8
8
  this.workletProcessorChannels[channel].channelVibrato.rate = 0;
9
9
  this.workletProcessorChannels[channel].channelVibrato.delay = 0;
10
10
  this.workletProcessorChannels[channel].channelVibrato.depth = 0;
@@ -19,7 +19,7 @@ export function disableAndLockVibrato(channel)
19
19
  */
20
20
  export function setVibrato(channel, depth, rate, delay)
21
21
  {
22
- if(this.workletProcessorChannels[channel].lockVibrato)
22
+ if(this.workletProcessorChannels[channel].lockGSNRPNParams)
23
23
  {
24
24
  return;
25
25
  }
@@ -21,7 +21,7 @@ import { modulatorSources } from '../../../soundfont/read_sf2/modulators.js'
21
21
  * @property {boolean} lockPreset - indicates whether the program on the channel is locked
22
22
  * @property {boolean} presetUsesOverride - indcates if the channel uses a preset from the override soundfont.
23
23
  *
24
- * @property {boolean} lockVibrato - indicates whether the custom vibrato is locked
24
+ * @property {boolean} lockGSNRPNParams - indicates whether the GS NRPN parameters are enabled
25
25
  * @property {Object} channelVibrato - vibrato settings for the channel
26
26
  * @property {number} channelVibrato.depth - depth of the vibrato effect (cents)
27
27
  * @property {number} channelVibrato.delay - delay before the vibrato effect starts (seconds)
@@ -62,7 +62,7 @@ export function createWorkletChannel(sendEvent = false)
62
62
  channelOctaveTuning: new Int8Array(12),
63
63
  keyCentTuning: new Int16Array(128),
64
64
  channelVibrato: {delay: 0, depth: 0, rate: 0},
65
- lockVibrato: false,
65
+ lockGSNRPNParams: false,
66
66
  holdPedal: false,
67
67
  isMuted: false,
68
68
  drumChannel: false,
@@ -149,8 +149,8 @@ export function audioBufferToWav(audioBuffer, normalizeAudio = true, channelOffs
149
149
  for (let i = 0; i < length; i++)
150
150
  {
151
151
  // interleave both channels
152
- const sample1 = Math.min(32767, Math.max(-37268, channel1Data[i] * multiplier));
153
- const sample2 = Math.min(32767, Math.max(-37268, channel2Data[i] * multiplier));
152
+ const sample1 = Math.min(32767, Math.max(-32768, channel1Data[i] * multiplier));
153
+ const sample2 = Math.min(32767, Math.max(-32768, channel2Data[i] * multiplier));
154
154
 
155
155
  // convert to 16-bit
156
156
  wavData[offset++] = sample1 & 0xff;