@vessel-dsp/runtime 0.14.1 → 0.15.1
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/chain-slot.d.ts +13 -1
- package/dist/chain-slot.d.ts.map +1 -1
- package/dist/chain-slot.js.map +1 -1
- package/dist/chain.d.ts +7 -0
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +16 -3
- package/dist/chain.js.map +1 -1
- package/dist/reference-runtime.d.ts.map +1 -1
- package/dist/reference-runtime.js +73 -0
- package/dist/reference-runtime.js.map +1 -1
- package/dist/wasm/v2_dsp.wasm +0 -0
- package/dist/worklet/v2-audio-worklet.js +68 -5
- package/package.json +2 -2
package/dist/wasm/v2_dsp.wasm
CHANGED
|
Binary file
|
|
@@ -1610,6 +1610,7 @@ var IMPLEMENTED_OPERATORS = {
|
|
|
1610
1610
|
vccs: true,
|
|
1611
1611
|
optocoupler: true,
|
|
1612
1612
|
"logic-divider": true,
|
|
1613
|
+
"d-flip-flop": true,
|
|
1613
1614
|
"analog-switch": true,
|
|
1614
1615
|
ota: true,
|
|
1615
1616
|
compandor: true,
|
|
@@ -5494,6 +5495,56 @@ var ReferenceRuntime = class {
|
|
|
5494
5495
|
rhs[row] = Q * stamp.highVolts;
|
|
5495
5496
|
break;
|
|
5496
5497
|
}
|
|
5498
|
+
case "d-flip-flop": {
|
|
5499
|
+
const stateIdx = stamp.stateIndex;
|
|
5500
|
+
const dffKey = `${block.id}_dff_${stamp.stateIndex}`;
|
|
5501
|
+
if (this.elapsedSamples !== (this.lastShiftedSample.get(dffKey) ?? -1)) {
|
|
5502
|
+
this.lastShiftedSample.set(dffKey, this.elapsedSamples);
|
|
5503
|
+
const vSup = (solution[stamp.vddNode] ?? 0) - (solution[stamp.vssNode] ?? 0);
|
|
5504
|
+
const vThr = (solution[stamp.vssNode] ?? 0) + vSup / 2;
|
|
5505
|
+
const vClkPrev = state[stateIdx + 2] ?? 0;
|
|
5506
|
+
const vClk = (solution[stamp.clockNode] ?? 0) - (solution[stamp.vssNode] ?? 0);
|
|
5507
|
+
const vD = (solution[stamp.dNode] ?? 0) - (solution[stamp.vssNode] ?? 0);
|
|
5508
|
+
const vSet = (solution[stamp.setNode] ?? 0) - (solution[stamp.vssNode] ?? 0);
|
|
5509
|
+
const vReset = (solution[stamp.resetNode] ?? 0) - (solution[stamp.vssNode] ?? 0);
|
|
5510
|
+
const setHigh = vSet >= vThr;
|
|
5511
|
+
const resetHigh = vReset >= vThr;
|
|
5512
|
+
if (setHigh && resetHigh) {
|
|
5513
|
+
state[stateIdx] = 1;
|
|
5514
|
+
state[stateIdx + 1] = 1;
|
|
5515
|
+
} else if (setHigh) {
|
|
5516
|
+
state[stateIdx] = 1;
|
|
5517
|
+
state[stateIdx + 1] = 0;
|
|
5518
|
+
} else if (resetHigh) {
|
|
5519
|
+
state[stateIdx] = 0;
|
|
5520
|
+
state[stateIdx + 1] = 1;
|
|
5521
|
+
} else if (vClkPrev < vThr && vClk >= vThr) {
|
|
5522
|
+
const q = vD >= vThr ? 1 : 0;
|
|
5523
|
+
state[stateIdx] = q;
|
|
5524
|
+
state[stateIdx + 1] = 1 - q;
|
|
5525
|
+
}
|
|
5526
|
+
state[stateIdx + 2] = vClk;
|
|
5527
|
+
}
|
|
5528
|
+
const Q = state[stateIdx] ?? 0;
|
|
5529
|
+
const Qbar = state[stateIdx + 1] ?? 1;
|
|
5530
|
+
const vSupOut = (solution[stamp.vddNode] ?? 0) - (solution[stamp.vssNode] ?? 0);
|
|
5531
|
+
const vSsOut = solution[stamp.vssNode] ?? 0;
|
|
5532
|
+
const rowQ = block.nodeCount + stamp.sourceIndex;
|
|
5533
|
+
matrix[rowQ][stamp.qNode] += 1;
|
|
5534
|
+
matrix[stamp.qNode][rowQ] += 1;
|
|
5535
|
+
matrix[rowQ][stamp.vssNode] -= 1;
|
|
5536
|
+
matrix[stamp.vssNode][rowQ] -= 1;
|
|
5537
|
+
matrix[rowQ][rowQ] -= 1;
|
|
5538
|
+
rhs[rowQ] = vSsOut + Q * vSupOut;
|
|
5539
|
+
const rowQbar = block.nodeCount + stamp.sourceIndex2;
|
|
5540
|
+
matrix[rowQbar][stamp.qBarNode] += 1;
|
|
5541
|
+
matrix[stamp.qBarNode][rowQbar] += 1;
|
|
5542
|
+
matrix[rowQbar][stamp.vssNode] -= 1;
|
|
5543
|
+
matrix[stamp.vssNode][rowQbar] -= 1;
|
|
5544
|
+
matrix[rowQbar][rowQbar] -= 1;
|
|
5545
|
+
rhs[rowQbar] = vSsOut + Qbar * vSupOut;
|
|
5546
|
+
break;
|
|
5547
|
+
}
|
|
5497
5548
|
case "analog-switch": {
|
|
5498
5549
|
const vA = solution[stamp.a] ?? 0;
|
|
5499
5550
|
const vB = solution[stamp.b] ?? 0;
|
|
@@ -6728,13 +6779,25 @@ var ChainRuntime = class {
|
|
|
6728
6779
|
for (const [slot, engine] of this.engines.entries()) {
|
|
6729
6780
|
try {
|
|
6730
6781
|
if (engine instanceof ReferenceRuntime) {
|
|
6731
|
-
engine.prepare(sampleRate2, {
|
|
6782
|
+
engine.prepare(sampleRate2, {
|
|
6783
|
+
maxNewtonIterations,
|
|
6784
|
+
oversample: options.oversample
|
|
6785
|
+
});
|
|
6732
6786
|
} else {
|
|
6733
|
-
engine.prepare(sampleRate2);
|
|
6787
|
+
engine.prepare(sampleRate2, { oversample: options.oversample });
|
|
6734
6788
|
}
|
|
6735
6789
|
const bufEngine = this.bufferEngines[slot];
|
|
6736
6790
|
if (bufEngine !== null) {
|
|
6737
|
-
bufEngine
|
|
6791
|
+
if (bufEngine instanceof ReferenceRuntime) {
|
|
6792
|
+
bufEngine.prepare(sampleRate2, {
|
|
6793
|
+
maxNewtonIterations,
|
|
6794
|
+
oversample: options.oversample
|
|
6795
|
+
});
|
|
6796
|
+
} else {
|
|
6797
|
+
bufEngine.prepare(sampleRate2, {
|
|
6798
|
+
oversample: options.oversample
|
|
6799
|
+
});
|
|
6800
|
+
}
|
|
6738
6801
|
}
|
|
6739
6802
|
} catch (error) {
|
|
6740
6803
|
if (error instanceof RuntimeError) {
|
|
@@ -7380,8 +7443,8 @@ var V2PedalProcessor = class _V2PedalProcessor extends AudioWorkletProcessor {
|
|
|
7380
7443
|
portFullScaleVolts: program.portFullScaleVolts,
|
|
7381
7444
|
portReferenceVolts: program.portReferenceVolts,
|
|
7382
7445
|
portImpedanceOhms: program.portImpedanceOhms,
|
|
7383
|
-
prepare(rate) {
|
|
7384
|
-
engine.prepare({ sampleRate: rate });
|
|
7446
|
+
prepare(rate, options) {
|
|
7447
|
+
engine.prepare({ sampleRate: rate, oversample: options?.oversample });
|
|
7385
7448
|
},
|
|
7386
7449
|
process(buffer) {
|
|
7387
7450
|
if (scratchIn.length !== buffer.length) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vessel-dsp/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "Real-time MNA simulation runtime and solver console for VesselDSP Program ROMs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"guitar-pedal",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"generate-kernels": "bun scripts/generate-kernels.ts"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@vessel-dsp/compiler": "0.
|
|
61
|
+
"@vessel-dsp/compiler": "0.18.1"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|