@audio/effect-slew 1.1.3 → 1.1.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/README.md +33 -0
- package/package.json +6 -3
- package/slew-limiter.d.ts +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @audio/effect-slew [](https://www.npmjs.com/package/@audio/effect-slew) [](https://github.com/krishnized/license)
|
|
2
|
+
|
|
3
|
+
Rate-of-change limiter
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install @audio/effect-slew
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import slewLimiter from '@audio/effect-slew'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Clips the derivative — limits how fast the signal can change.
|
|
14
|
+
|
|
15
|
+
**`rise`** maximum rise rate in units/second (default 1000) · **`fall`** maximum fall rate (default 1000) · **`fs`** sample rate
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { slewLimiter } from '@audio/effect'
|
|
19
|
+
|
|
20
|
+
let p = { rise: 5000, fall: 5000, fs: 44100 }
|
|
21
|
+
for (let buf of stream) slewLimiter(buf, p)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Use when**: click removal, smoothing control signals, limiting slew on CVs<br>
|
|
25
|
+
**Not for**: dynamic range control
|
|
26
|
+
|
|
27
|
+
<!--  -->
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
Part of [@audio/effect](https://github.com/audiojs/effect) — the effect family umbrella. This README is generated from the umbrella docs.
|
|
32
|
+
|
|
33
|
+
MIT © [audiojs](https://github.com/audiojs)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/effect-slew",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Rate-of-change limiter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"slew-limiter.js",
|
|
18
18
|
"audio.js",
|
|
19
|
-
"audio.d.ts"
|
|
19
|
+
"audio.d.ts",
|
|
20
|
+
"slew-limiter.d.ts"
|
|
20
21
|
],
|
|
21
22
|
"keywords": [
|
|
22
23
|
"audio",
|
|
@@ -41,5 +42,7 @@
|
|
|
41
42
|
"publishConfig": {
|
|
42
43
|
"access": "public"
|
|
43
44
|
},
|
|
44
|
-
"
|
|
45
|
+
"types": "slew-limiter.d.ts",
|
|
46
|
+
"audio": "./audio.js",
|
|
47
|
+
"funding": "https://github.com/sponsors/audiojs"
|
|
45
48
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Rate-of-change (slew) limiter — nonlinear, clips the derivative; prevents clicks, smooths control signals. */
|
|
2
|
+
export interface SlewLimiterOptions {
|
|
3
|
+
/** maximum rise rate, units/second, default 1000 */
|
|
4
|
+
rise?: number
|
|
5
|
+
/** maximum fall rate, units/second, default 1000 */
|
|
6
|
+
fall?: number
|
|
7
|
+
/** sample rate, default 44100 */
|
|
8
|
+
fs?: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Mutates `data` in place and returns the same reference. Pass the same params
|
|
13
|
+
* object across calls — the running output sample persists on it (`y`, seeded
|
|
14
|
+
* from `data[0]` on the first call if absent).
|
|
15
|
+
*/
|
|
16
|
+
export default function slewLimiter(data: Float32Array, params?: SlewLimiterOptions): Float32Array
|