@libraz/libsonare 1.5.3 → 1.5.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/sonare.wasm CHANGED
Binary file
package/dist/worklet.js CHANGED
@@ -170,6 +170,8 @@ function panLawCode(panLaw) {
170
170
  return panLaw;
171
171
  }
172
172
  switch (panLaw) {
173
+ case "const3dB":
174
+ return 0;
173
175
  case "const4.5dB":
174
176
  return 1;
175
177
  case "const6dB":
@@ -177,7 +179,7 @@ function panLawCode(panLaw) {
177
179
  case "linear0dB":
178
180
  return 3;
179
181
  default:
180
- return 0;
182
+ throw new Error(`Invalid pan law: ${panLaw}`);
181
183
  }
182
184
  }
183
185
  function panModeCode(panMode) {
@@ -185,6 +187,8 @@ function panModeCode(panMode) {
185
187
  return panMode;
186
188
  }
187
189
  switch (panMode) {
190
+ case "balance":
191
+ return 0;
188
192
  case "stereoPan":
189
193
  case "stereo-pan":
190
194
  return 1;
@@ -192,17 +196,34 @@ function panModeCode(panMode) {
192
196
  case "dual-pan":
193
197
  return 2;
194
198
  default:
195
- return 0;
199
+ throw new Error(`Invalid pan mode: ${panMode}`);
196
200
  }
197
201
  }
198
202
  function meterTapCode(tap) {
199
- return tap === "preFader" || tap === 0 ? 0 : 1;
203
+ if (typeof tap === "number") {
204
+ return tap;
205
+ }
206
+ switch (tap) {
207
+ case "preFader":
208
+ return 0;
209
+ case "postFader":
210
+ return 1;
211
+ default:
212
+ throw new Error(`Invalid meter tap: ${tap}`);
213
+ }
200
214
  }
201
215
  function sendTimingCode(timing) {
202
216
  if (typeof timing === "number") {
203
217
  return timing;
204
218
  }
205
- return timing === "preFader" ? 1 : 0;
219
+ switch (timing) {
220
+ case "postFader":
221
+ return 0;
222
+ case "preFader":
223
+ return 1;
224
+ default:
225
+ throw new Error(`Invalid send timing: ${timing}`);
226
+ }
206
227
  }
207
228
 
208
229
  // src/realtime_engine.ts
@@ -1235,6 +1256,61 @@ var Mixer = class _Mixer {
1235
1256
  };
1236
1257
 
1237
1258
  // src/realtime_voice_changer.ts
1259
+ function isFlatVoiceChangerPod(config) {
1260
+ return typeof config === "object" && config !== null && "retuneSemitones" in config;
1261
+ }
1262
+ function flatVoiceChangerPodToNested(pod) {
1263
+ return {
1264
+ inputGainDb: pod.inputGainDb,
1265
+ outputGainDb: pod.outputGainDb,
1266
+ wetMix: pod.wetMix,
1267
+ retune: { semitones: pod.retuneSemitones, mix: pod.retuneMix, grainSize: pod.retuneGrainSize },
1268
+ formant: {
1269
+ factor: pod.formantFactor,
1270
+ amount: pod.formantAmount,
1271
+ body: pod.formantBody,
1272
+ brightness: pod.formantBrightness,
1273
+ nasal: pod.formantNasal
1274
+ },
1275
+ eq: {
1276
+ highpassHz: pod.eqHighpassHz,
1277
+ bodyDb: pod.eqBodyDb,
1278
+ presenceDb: pod.eqPresenceDb,
1279
+ airDb: pod.eqAirDb
1280
+ },
1281
+ gate: {
1282
+ thresholdDb: pod.gateThresholdDb,
1283
+ attackMs: pod.gateAttackMs,
1284
+ releaseMs: pod.gateReleaseMs,
1285
+ rangeDb: pod.gateRangeDb
1286
+ },
1287
+ compressor: {
1288
+ thresholdDb: pod.compressorThresholdDb,
1289
+ ratio: pod.compressorRatio,
1290
+ attackMs: pod.compressorAttackMs,
1291
+ releaseMs: pod.compressorReleaseMs,
1292
+ makeupGainDb: pod.compressorMakeupGainDb
1293
+ },
1294
+ deesser: {
1295
+ frequencyHz: pod.deesserFrequencyHz,
1296
+ thresholdDb: pod.deesserThresholdDb,
1297
+ ratio: pod.deesserRatio,
1298
+ rangeDb: pod.deesserRangeDb
1299
+ },
1300
+ reverb: {
1301
+ mix: pod.reverbMix,
1302
+ timeMs: pod.reverbTimeMs,
1303
+ damping: pod.reverbDamping,
1304
+ seed: pod.reverbSeed
1305
+ },
1306
+ limiter: {
1307
+ ceilingDb: pod.limiterCeilingDb,
1308
+ releaseMs: pod.limiterReleaseMs,
1309
+ enableIspLimiter: pod.limiterEnableIspLimiter,
1310
+ ispCeilingDbtp: pod.limiterIspCeilingDbtp
1311
+ }
1312
+ };
1313
+ }
1238
1314
  var RealtimeVoiceChanger = class {
1239
1315
  constructor(config = "neutral-monitor") {
1240
1316
  const module2 = getSonareModule();
@@ -1247,7 +1323,8 @@ var RealtimeVoiceChanger = class {
1247
1323
  this.changer.reset();
1248
1324
  }
1249
1325
  setConfig(config) {
1250
- this.changer.setConfig(config);
1326
+ const resolved = isFlatVoiceChangerPod(config) ? flatVoiceChangerPodToNested(config) : config;
1327
+ this.changer.setConfig(resolved);
1251
1328
  }
1252
1329
  configJson() {
1253
1330
  return this.changer.configJson();