@elemaudio/core
Advanced tools
Comparing version 2.0.2 to 2.1.0
@@ -1113,9 +1113,14 @@ var __defProp = Object.defineProperty; | ||
function createNode(kind, props, children) { | ||
invariant(children.length <= 8, `Nodes can only have at most 8 children.`); | ||
if (typeof kind === "string") { | ||
return NodeRepr_createPrimitive(kind, props, children.map(resolve)); | ||
} | ||
console.warn("WARNING: Support for composite nodes are deprecated as of v2.1.0, and will be removed in v3"); | ||
return NodeRepr_createComposite(kind, props, children.map(resolve)); | ||
} | ||
// src/Events.ts | ||
import events from "events"; | ||
var EventEmitter = class extends events.EventEmitter { | ||
}; | ||
// lib/core.ts | ||
@@ -1550,3 +1555,4 @@ var core_exports = {}; | ||
var el2 = __spreadValues(__spreadValues(__spreadValues({}, core_exports), math_exports), signals_exports); | ||
function CompressComposite({ children }) { | ||
function compress(a_, b_, c_, d_, e_, f_, g_) { | ||
let children = typeof a_ === "number" || isNode2(a_) ? [a_, b_, c_, d_, e_, f_] : [b_, c_, d_, e_, f_, g_]; | ||
const [atkMs, relMs, threshold, ratio, sidechain, xn] = children; | ||
@@ -1557,10 +1563,4 @@ const env2 = el2.env(el2.tau2pole(el2.mul(1e-3, atkMs)), el2.tau2pole(el2.mul(1e-3, relMs)), sidechain); | ||
const gain = el2.select(el2.ge(envDecibels, threshold), el2.db2gain(el2.mul(el2.sub(threshold, envDecibels), strength)), 1); | ||
return resolve(el2.mul(xn, gain)); | ||
return el2.mul(xn, gain); | ||
} | ||
function compress(a, b, c, d, e, f, g) { | ||
if (typeof a === "number" || isNode2(a)) { | ||
return createNode(CompressComposite, {}, [a, b, c, d, e, f]); | ||
} | ||
return createNode(CompressComposite, a, [b, c, d, e, f, g]); | ||
} | ||
@@ -1672,3 +1672,4 @@ // lib/envelopes.ts | ||
var el4 = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, core_exports), math_exports), filters_exports), signals_exports); | ||
function AdsrComposite({ children }) { | ||
function adsr(a_, b_, c_, d_, e_, f_) { | ||
let children = typeof a_ === "number" || isNode2(a_) ? [a_, b_, c_, d_, e_] : [b_, c_, d_, e_, f_]; | ||
let [a, d, s, r, g] = children; | ||
@@ -1682,8 +1683,2 @@ let atkSamps = el4.mul(a, el4.sr()); | ||
} | ||
function adsr(a, b, c, d, e, f) { | ||
if (typeof a === "number" || isNode2(a)) { | ||
return createNode(AdsrComposite, {}, [a, b, c, d, e]); | ||
} | ||
return createNode(AdsrComposite, a, [b, c, d, e, f]); | ||
} | ||
@@ -1756,3 +1751,3 @@ // lib/oscillators.ts | ||
let gain = el5.div(el5.mul(4, rate), el5.sr()); | ||
return el5.mul(gain, el5.pole(0.999, blepsquare(props, rate))); | ||
return el5.mul(gain, el5.pole(0.995, blepsquare(props, rate))); | ||
} | ||
@@ -1869,2 +1864,3 @@ function noise(a) { | ||
export { | ||
EventEmitter, | ||
Renderer, | ||
@@ -1871,0 +1867,0 @@ createNode, |
@@ -0,1 +1,3 @@ | ||
import events from 'events'; | ||
declare type NodeRepr_symbol$1 = Symbol; | ||
@@ -56,5 +58,46 @@ | ||
declare function resolve(n: NodeRepr_t | number): NodeRepr_t; | ||
declare function isNode(n: any): boolean; | ||
declare function isNode(n: unknown): n is NodeRepr_t; | ||
declare function createNode(kind: Parameters<typeof NodeRepr_createPrimitive>[0] | Parameters<typeof NodeRepr_createComposite>[0], props: any, children: Array<NodeRepr_t | number>): NodeRepr_t; | ||
declare type EventListener<E> = (event: E) => void; | ||
declare type Events = { | ||
"error": Error; | ||
"fft": { | ||
source?: string; | ||
data: { | ||
real: Float32Array; | ||
imag: Float32Array; | ||
}; | ||
}; | ||
"load": void; | ||
"meter": { | ||
source?: string; | ||
min: number; | ||
max: number; | ||
}; | ||
"scope": { | ||
source?: string; | ||
data: Float32Array[]; | ||
}; | ||
"snapshot": { | ||
source?: string; | ||
data: number; | ||
}; | ||
}; | ||
declare interface EventEmitter { | ||
addListener<K extends keyof Events>(eventName: K, listener: EventListener<Events[K]>): this; | ||
listenerCount<K extends keyof Events>(eventName: K, listener?: EventListener<Events[K]>): number; | ||
listeners<K extends keyof Events>(eventName: K): Function[]; | ||
off<K extends keyof Events>(eventName: K, listener: EventListener<Events[K]>): this; | ||
on<K extends keyof Events>(eventName: K, listener: EventListener<Events[K]>): this; | ||
once<K extends keyof Events>(eventName: K, listener: EventListener<Events[K]>): this; | ||
prependListener<K extends keyof Events>(eventName: K, listener: EventListener<Events[K]>): this; | ||
prependOnceListener<K extends keyof Events>(eventName: K, listener: EventListener<Events[K]>): this; | ||
removeAllListeners<K extends keyof Events>(eventName?: K): this; | ||
removeListener<K extends keyof Events>(eventName: K, listener: EventListener<Events[K]>): this; | ||
rawListeners<K extends keyof Events>(eventName: K): Function[]; | ||
} | ||
declare class EventEmitter extends events.EventEmitter { | ||
} | ||
declare type ConstNodeProps = { | ||
@@ -473,2 +516,2 @@ key?: string; | ||
export { NodeRepr_t, Renderer, createNode, stdlib as el, isNode, renderWithDelegate, resolve, stdlib, stepGarbageCollector }; | ||
export { EventEmitter, NodeRepr_t, Renderer, createNode, stdlib as el, isNode, renderWithDelegate, resolve, stdlib, stepGarbageCollector }; |
@@ -1113,9 +1113,14 @@ var __defProp = Object.defineProperty; | ||
function createNode(kind, props, children) { | ||
invariant(children.length <= 8, `Nodes can only have at most 8 children.`); | ||
if (typeof kind === "string") { | ||
return NodeRepr_createPrimitive(kind, props, children.map(resolve)); | ||
} | ||
console.warn("WARNING: Support for composite nodes are deprecated as of v2.1.0, and will be removed in v3"); | ||
return NodeRepr_createComposite(kind, props, children.map(resolve)); | ||
} | ||
// src/Events.ts | ||
import events from "events"; | ||
var EventEmitter = class extends events.EventEmitter { | ||
}; | ||
// lib/core.ts | ||
@@ -1550,3 +1555,4 @@ var core_exports = {}; | ||
var el2 = __spreadValues(__spreadValues(__spreadValues({}, core_exports), math_exports), signals_exports); | ||
function CompressComposite({ children }) { | ||
function compress(a_, b_, c_, d_, e_, f_, g_) { | ||
let children = typeof a_ === "number" || isNode2(a_) ? [a_, b_, c_, d_, e_, f_] : [b_, c_, d_, e_, f_, g_]; | ||
const [atkMs, relMs, threshold, ratio, sidechain, xn] = children; | ||
@@ -1557,10 +1563,4 @@ const env2 = el2.env(el2.tau2pole(el2.mul(1e-3, atkMs)), el2.tau2pole(el2.mul(1e-3, relMs)), sidechain); | ||
const gain = el2.select(el2.ge(envDecibels, threshold), el2.db2gain(el2.mul(el2.sub(threshold, envDecibels), strength)), 1); | ||
return resolve(el2.mul(xn, gain)); | ||
return el2.mul(xn, gain); | ||
} | ||
function compress(a, b, c, d, e, f, g) { | ||
if (typeof a === "number" || isNode2(a)) { | ||
return createNode(CompressComposite, {}, [a, b, c, d, e, f]); | ||
} | ||
return createNode(CompressComposite, a, [b, c, d, e, f, g]); | ||
} | ||
@@ -1672,3 +1672,4 @@ // lib/envelopes.ts | ||
var el4 = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, core_exports), math_exports), filters_exports), signals_exports); | ||
function AdsrComposite({ children }) { | ||
function adsr(a_, b_, c_, d_, e_, f_) { | ||
let children = typeof a_ === "number" || isNode2(a_) ? [a_, b_, c_, d_, e_] : [b_, c_, d_, e_, f_]; | ||
let [a, d, s, r, g] = children; | ||
@@ -1682,8 +1683,2 @@ let atkSamps = el4.mul(a, el4.sr()); | ||
} | ||
function adsr(a, b, c, d, e, f) { | ||
if (typeof a === "number" || isNode2(a)) { | ||
return createNode(AdsrComposite, {}, [a, b, c, d, e]); | ||
} | ||
return createNode(AdsrComposite, a, [b, c, d, e, f]); | ||
} | ||
@@ -1756,3 +1751,3 @@ // lib/oscillators.ts | ||
let gain = el5.div(el5.mul(4, rate), el5.sr()); | ||
return el5.mul(gain, el5.pole(0.999, blepsquare(props, rate))); | ||
return el5.mul(gain, el5.pole(0.995, blepsquare(props, rate))); | ||
} | ||
@@ -1869,2 +1864,3 @@ function noise(a) { | ||
export { | ||
EventEmitter, | ||
Renderer, | ||
@@ -1871,0 +1867,0 @@ createNode, |
{ | ||
"name": "@elemaudio/core", | ||
"version": "2.0.2", | ||
"version": "2.1.0", | ||
"type": "module", | ||
@@ -56,6 +56,7 @@ "description": "Official Elementary Audio core package", | ||
"dependencies": { | ||
"events": "^3.3.0", | ||
"invariant": "^2.2.4", | ||
"shallowequal": "^1.1.0" | ||
}, | ||
"gitHead": "5f6fcbe132e81d5fad6b050e83bce92d33fc2ae0" | ||
"gitHead": "39ae7ec006744d522ed7b3d684e86a30488bc77a" | ||
} |
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
166494
6061
3
+ Addedevents@^3.3.0
+ Addedevents@3.3.0(transitive)