@elemaudio/core
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -1083,2 +1083,3 @@ var __defProp = Object.defineProperty; | ||
sample: () => sample, | ||
sampleseq: () => sampleseq, | ||
scope: () => scope, | ||
@@ -1185,2 +1186,5 @@ sdelay: () => sdelay, | ||
} | ||
function sampleseq(props, time2) { | ||
return createNode("sampleseq", props, [resolve(time2)]); | ||
} | ||
function pole(a, b, c) { | ||
@@ -1318,3 +1322,4 @@ if (typeof a === "number" || isNode3(a)) { | ||
__export(dynamics_exports, { | ||
compress: () => compress | ||
compress: () => compress, | ||
skcompress: () => skcompress | ||
}); | ||
@@ -1349,2 +1354,3 @@ | ||
pow: () => pow, | ||
round: () => round, | ||
sin: () => sin, | ||
@@ -1389,2 +1395,5 @@ sqrt: () => sqrt, | ||
} | ||
function round(a, b) { | ||
return typeof a === "number" || isNode3(a) ? createNode("round", {}, [resolve(a)]) : createNode("round", a, [resolve(b)]); | ||
} | ||
function sqrt(a, b) { | ||
@@ -1522,11 +1531,23 @@ return typeof a === "number" || isNode3(a) ? createNode("sqrt", {}, [resolve(a)]) : createNode("sqrt", a, [resolve(b)]); | ||
var el2 = __spreadValues(__spreadValues(__spreadValues({}, core_exports), math_exports), signals_exports); | ||
function compress(a_, b_, c_, d_, e_, f_, g_) { | ||
let children = typeof a_ === "number" || isNode3(a_) ? [a_, b_, c_, d_, e_, f_] : [b_, c_, d_, e_, f_, g_]; | ||
const [atkMs, relMs, threshold, ratio, sidechain, xn] = children; | ||
function compress(atkMs, relMs, threshold, ratio, sidechain, xn) { | ||
const env2 = el2.env(el2.tau2pole(el2.mul(1e-3, atkMs)), el2.tau2pole(el2.mul(1e-3, relMs)), sidechain); | ||
const envDecibels = el2.gain2db(env2); | ||
const strength = el2.select(el2.leq(ratio, 1), 0, el2.select(el2.geq(ratio, 50), 1, el2.div(1, ratio))); | ||
const gain = el2.select(el2.ge(envDecibels, threshold), el2.db2gain(el2.mul(el2.sub(threshold, envDecibels), strength)), 1); | ||
return el2.mul(xn, gain); | ||
const adjustedRatio = el2.sub(1, el2.div(1, ratio)); | ||
const gain = el2.mul(adjustedRatio, el2.sub(threshold, envDecibels)); | ||
const cleanGain = el2.min(0, gain); | ||
const compressedGain = el2.db2gain(cleanGain); | ||
return el2.mul(xn, compressedGain); | ||
} | ||
function skcompress(atkMs, relMs, threshold, ratio, kneeWidth, sidechain, xn) { | ||
const env2 = el2.env(el2.tau2pole(el2.mul(1e-3, atkMs)), el2.tau2pole(el2.mul(1e-3, relMs)), sidechain); | ||
const envDecibels = el2.gain2db(env2); | ||
const lowerKneeBound = el2.sub(threshold, el2.div(kneeWidth, 2)); | ||
const upperKneeBound = el2.add(threshold, el2.div(kneeWidth, 2)); | ||
const isInSoftKneeRange = el2.and(el2.geq(envDecibels, lowerKneeBound), el2.leq(envDecibels, upperKneeBound)); | ||
const adjustedRatio = el2.sub(1, el2.div(1, ratio)); | ||
const gain = el2.select(isInSoftKneeRange, el2.mul(el2.div(adjustedRatio, 2), el2.mul(el2.div(el2.sub(envDecibels, lowerKneeBound), kneeWidth), el2.sub(lowerKneeBound, envDecibels))), el2.mul(adjustedRatio, el2.sub(threshold, envDecibels))); | ||
const cleanGain = el2.min(0, gain); | ||
const compressedGain = el2.db2gain(cleanGain); | ||
return el2.mul(xn, compressedGain); | ||
} | ||
@@ -1533,0 +1554,0 @@ // lib/envelopes.ts |
@@ -189,2 +189,6 @@ import events from 'events'; | ||
}, x: ElemNode): t; | ||
round(x: ElemNode): t; | ||
round(props: { | ||
key?: string; | ||
}, x: ElemNode): t; | ||
sqrt(x: ElemNode): t; | ||
@@ -323,5 +327,3 @@ sqrt(props: { | ||
compress(attackMs: ElemNode, releaseMs: ElemNode, threshold: ElemNode, ratio: ElemNode, sidechain: ElemNode, xn: ElemNode): t; | ||
compress(props: { | ||
key?: string; | ||
}, attackMs: ElemNode, releaseMs: ElemNode, threshold: ElemNode, ratio: ElemNode, sidechain: ElemNode, xn: ElemNode): t; | ||
skcompress(attackMs: ElemNode, releaseMs: ElemNode, threshold: ElemNode, ratio: ElemNode, kneeWidth: ElemNode, sidechain: ElemNode, xn: ElemNode): t; | ||
constant(props: { | ||
@@ -421,2 +423,11 @@ key?: string; | ||
}, time: ElemNode): t; | ||
sampleseq(props: { | ||
key?: string; | ||
seq?: { | ||
value: number; | ||
time: number; | ||
}[]; | ||
duration: number; | ||
path: string; | ||
}, time: ElemNode): t; | ||
pole(p: ElemNode, x: ElemNode): t; | ||
@@ -423,0 +434,0 @@ pole(props: { |
@@ -1083,2 +1083,3 @@ var __defProp = Object.defineProperty; | ||
sample: () => sample, | ||
sampleseq: () => sampleseq, | ||
scope: () => scope, | ||
@@ -1185,2 +1186,5 @@ sdelay: () => sdelay, | ||
} | ||
function sampleseq(props, time2) { | ||
return createNode("sampleseq", props, [resolve(time2)]); | ||
} | ||
function pole(a, b, c) { | ||
@@ -1318,3 +1322,4 @@ if (typeof a === "number" || isNode3(a)) { | ||
__export(dynamics_exports, { | ||
compress: () => compress | ||
compress: () => compress, | ||
skcompress: () => skcompress | ||
}); | ||
@@ -1349,2 +1354,3 @@ | ||
pow: () => pow, | ||
round: () => round, | ||
sin: () => sin, | ||
@@ -1389,2 +1395,5 @@ sqrt: () => sqrt, | ||
} | ||
function round(a, b) { | ||
return typeof a === "number" || isNode3(a) ? createNode("round", {}, [resolve(a)]) : createNode("round", a, [resolve(b)]); | ||
} | ||
function sqrt(a, b) { | ||
@@ -1522,11 +1531,23 @@ return typeof a === "number" || isNode3(a) ? createNode("sqrt", {}, [resolve(a)]) : createNode("sqrt", a, [resolve(b)]); | ||
var el2 = __spreadValues(__spreadValues(__spreadValues({}, core_exports), math_exports), signals_exports); | ||
function compress(a_, b_, c_, d_, e_, f_, g_) { | ||
let children = typeof a_ === "number" || isNode3(a_) ? [a_, b_, c_, d_, e_, f_] : [b_, c_, d_, e_, f_, g_]; | ||
const [atkMs, relMs, threshold, ratio, sidechain, xn] = children; | ||
function compress(atkMs, relMs, threshold, ratio, sidechain, xn) { | ||
const env2 = el2.env(el2.tau2pole(el2.mul(1e-3, atkMs)), el2.tau2pole(el2.mul(1e-3, relMs)), sidechain); | ||
const envDecibels = el2.gain2db(env2); | ||
const strength = el2.select(el2.leq(ratio, 1), 0, el2.select(el2.geq(ratio, 50), 1, el2.div(1, ratio))); | ||
const gain = el2.select(el2.ge(envDecibels, threshold), el2.db2gain(el2.mul(el2.sub(threshold, envDecibels), strength)), 1); | ||
return el2.mul(xn, gain); | ||
const adjustedRatio = el2.sub(1, el2.div(1, ratio)); | ||
const gain = el2.mul(adjustedRatio, el2.sub(threshold, envDecibels)); | ||
const cleanGain = el2.min(0, gain); | ||
const compressedGain = el2.db2gain(cleanGain); | ||
return el2.mul(xn, compressedGain); | ||
} | ||
function skcompress(atkMs, relMs, threshold, ratio, kneeWidth, sidechain, xn) { | ||
const env2 = el2.env(el2.tau2pole(el2.mul(1e-3, atkMs)), el2.tau2pole(el2.mul(1e-3, relMs)), sidechain); | ||
const envDecibels = el2.gain2db(env2); | ||
const lowerKneeBound = el2.sub(threshold, el2.div(kneeWidth, 2)); | ||
const upperKneeBound = el2.add(threshold, el2.div(kneeWidth, 2)); | ||
const isInSoftKneeRange = el2.and(el2.geq(envDecibels, lowerKneeBound), el2.leq(envDecibels, upperKneeBound)); | ||
const adjustedRatio = el2.sub(1, el2.div(1, ratio)); | ||
const gain = el2.select(isInSoftKneeRange, el2.mul(el2.div(adjustedRatio, 2), el2.mul(el2.div(el2.sub(envDecibels, lowerKneeBound), kneeWidth), el2.sub(lowerKneeBound, envDecibels))), el2.mul(adjustedRatio, el2.sub(threshold, envDecibels))); | ||
const cleanGain = el2.min(0, gain); | ||
const compressedGain = el2.db2gain(cleanGain); | ||
return el2.mul(xn, compressedGain); | ||
} | ||
@@ -1533,0 +1554,0 @@ // lib/envelopes.ts |
{ | ||
"name": "@elemaudio/core", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"type": "module", | ||
@@ -60,3 +60,3 @@ "description": "Official Elementary Audio core package", | ||
}, | ||
"gitHead": "7f915af18486feebaf5390684a0991c6ac8c925d" | ||
"gitHead": "eb96b3816163dfde6de6703ddd124198003e1c00" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164201
6109