@effetune/dsp 0.5.0 → 0.7.0

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.
@@ -29,8 +29,8 @@ function channelSpec(channel) {
29
29
  if (channel === 'stereo') return -1;
30
30
  if (channel === 'left' || channel === '1') return 0;
31
31
  if (channel === 'right' || channel === '2') return 1;
32
- if (/^[3-8]$/.test(channel)) return Number(channel) - 1;
33
- return { '34': 17, '56': 18, '78': 19 }[channel];
32
+ if (/^([3-9]|1[0-6])$/.test(channel)) return Number(channel) - 1;
33
+ return { '34': 17, '56': 18, '78': 19, '910': 20, '1112': 21, '1314': 22, '1516': 23 }[channel];
34
34
  }
35
35
 
36
36
  export function effectiveNodeIds(document) {
@@ -143,7 +143,7 @@ function optionalSlot(value) {
143
143
  }
144
144
 
145
145
  export function decodeGraphSnapshot(bytes, document) {
146
- if (!(bytes instanceof Uint8Array) || bytes.byteLength < 128) {
146
+ if (!(bytes instanceof Uint8Array) || bytes.byteLength < 192) {
147
147
  throw new EffeTuneRuntimeError('DSP returned an invalid Graph compile snapshot.');
148
148
  }
149
149
  const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
@@ -161,7 +161,7 @@ export function decodeGraphSnapshot(bytes, document) {
161
161
  const edgesOffset = view.getUint32(56, true);
162
162
  const totalBytes = view.getUint32(60, true);
163
163
  if (nodeCount !== document.nodes.length || edgeCount !== document.edges.length ||
164
- channels < 1 || channels > 8 || nodeBytes !== 128 || edgeBytes !== 48 ||
164
+ channels < 1 || channels > 16 || nodeBytes !== 224 || edgeBytes !== 80 ||
165
165
  totalBytes !== bytes.byteLength) {
166
166
  throw new EffeTuneRuntimeError('DSP returned an inconsistent Graph compile snapshot.');
167
167
  }
@@ -185,8 +185,8 @@ export function decodeGraphSnapshot(bytes, document) {
185
185
  },
186
186
  kernelLatency: view.getUint32(offset + 24, true),
187
187
  inputLatency: vector(view, offset + 32, channels),
188
- outputLatency: vector(view, offset + 64, channels),
189
- preNodeCompensation: vector(view, offset + 96, channels)
188
+ outputLatency: vector(view, offset + 96, channels),
189
+ preNodeCompensation: vector(view, offset + 160, channels)
190
190
  };
191
191
  });
192
192
  const edges = document.edges.map((edge, index) => {
@@ -209,7 +209,7 @@ export function decodeGraphSnapshot(bytes, document) {
209
209
  nodes,
210
210
  edges,
211
211
  outputLatency: vector(view, 64, channels),
212
- outputCompensation: vector(view, 96, channels),
212
+ outputCompensation: vector(view, 128, channels),
213
213
  latencySamples: view.getUint32(28, true),
214
214
  capacity: {
215
215
  bufferSlots: view.getUint32(24, true),
package/dist/graph.js CHANGED
@@ -26,8 +26,8 @@ const STREAM_SAFE_PARAMETERS = new Map([
26
26
  ]);
27
27
 
28
28
  function validateAudio(audio) {
29
- if (!Array.isArray(audio) || audio.length < 1 || audio.length > 8) {
30
- throw new ValidationError('Audio must be an array containing between 1 and 8 Float32Array channels.');
29
+ if (!Array.isArray(audio) || audio.length < 1 || audio.length > 16) {
30
+ throw new ValidationError('Audio must be an array containing between 1 and 16 Float32Array channels.');
31
31
  }
32
32
  const frames = audio[0] instanceof Float32Array ? audio[0].length : -1;
33
33
  for (const channel of audio) {
@@ -49,8 +49,8 @@ function validateBlockSize(value = 128) {
49
49
  }
50
50
 
51
51
  function validateChannels(channels) {
52
- if (!Number.isInteger(channels) || channels < 1 || channels > 8) {
53
- throw new ValidationError('channels must be an integer from 1 to 8.');
52
+ if (!Number.isInteger(channels) || channels < 1 || channels > 16) {
53
+ throw new ValidationError('channels must be an integer from 1 to 16.');
54
54
  }
55
55
  return channels;
56
56
  }
package/dist/index.d.ts CHANGED
@@ -53,6 +53,7 @@ export type {
53
53
  GSMFullRateSimulatorOptions,
54
54
  GateOptions,
55
55
  GroupDelayEQOptions,
56
+ GroupDelayPEQOptions,
56
57
  HardClippingOptions,
57
58
  HarmonicDistortionOptions,
58
59
  HiPassFilterOptions,
@@ -63,6 +64,7 @@ export type {
63
64
  IRReverbOptions,
64
65
  LoPassFilterOptions,
65
66
  LoudnessEqualizerOptions,
67
+ MDSimulatorOptions,
66
68
  MP3CodecSimulatorOptions,
67
69
  MSMatrixOptions,
68
70
  ModalResonatorOptions,
@@ -149,6 +151,7 @@ export {
149
151
  GSMFullRateSimulator,
150
152
  Gate,
151
153
  GroupDelayEQ,
154
+ GroupDelayPEQ,
152
155
  HardClipping,
153
156
  HarmonicDistortion,
154
157
  HiPassFilter,
@@ -158,6 +161,7 @@ export {
158
161
  IRReverb,
159
162
  LoPassFilter,
160
163
  LoudnessEqualizer,
164
+ MDSimulator,
161
165
  MP3CodecSimulator,
162
166
  MSMatrix,
163
167
  ModalResonator,
@@ -240,6 +244,7 @@ export {
240
244
  createGSMFullRateSimulator,
241
245
  createGate,
242
246
  createGroupDelayEQ,
247
+ createGroupDelayPEQ,
243
248
  createHardClipping,
244
249
  createHarmonicDistortion,
245
250
  createHiPassFilter,
@@ -249,6 +254,7 @@ export {
249
254
  createIRReverb,
250
255
  createLoPassFilter,
251
256
  createLoudnessEqualizer,
257
+ createMDSimulator,
252
258
  createMP3CodecSimulator,
253
259
  createMSMatrix,
254
260
  createModalResonator,
package/dist/index.js CHANGED
@@ -60,6 +60,7 @@ export {
60
60
  GSMFullRateSimulator,
61
61
  Gate,
62
62
  GroupDelayEQ,
63
+ GroupDelayPEQ,
63
64
  HardClipping,
64
65
  HarmonicDistortion,
65
66
  HiPassFilter,
@@ -69,6 +70,7 @@ export {
69
70
  IRReverb,
70
71
  LoPassFilter,
71
72
  LoudnessEqualizer,
73
+ MDSimulator,
72
74
  MP3CodecSimulator,
73
75
  MSMatrix,
74
76
  ModalResonator,
@@ -151,6 +153,7 @@ export {
151
153
  createGSMFullRateSimulator,
152
154
  createGate,
153
155
  createGroupDelayEQ,
156
+ createGroupDelayPEQ,
154
157
  createHardClipping,
155
158
  createHarmonicDistortion,
156
159
  createHiPassFilter,
@@ -160,6 +163,7 @@ export {
160
163
  createIRReverb,
161
164
  createLoPassFilter,
162
165
  createLoudnessEqualizer,
166
+ createMDSimulator,
163
167
  createMP3CodecSimulator,
164
168
  createMSMatrix,
165
169
  createModalResonator,