@audio/effect-gain 1.0.0

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.
Files changed (2) hide show
  1. package/gain.js +14 -0
  2. package/package.json +38 -0
package/gain.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Gain — simple level adjustment in dB.
3
+ */
4
+
5
+ let {pow} = Math
6
+
7
+ export default function gain (data, params) {
8
+ let dB = params.dB ?? 0
9
+ let g = pow(10, dB / 20)
10
+
11
+ for (let i = 0, l = data.length; i < l; i++) data[i] *= g
12
+
13
+ return data
14
+ }
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@audio/effect-gain",
3
+ "version": "1.0.0",
4
+ "description": "Gain — simple level adjustment in dB",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "main": "gain.js",
8
+ "exports": {
9
+ ".": "./gain.js",
10
+ "./package.json": "./package.json"
11
+ },
12
+ "files": [
13
+ "gain.js"
14
+ ],
15
+ "keywords": [
16
+ "audio",
17
+ "dsp",
18
+ "effect",
19
+ "gain"
20
+ ],
21
+ "license": "MIT",
22
+ "author": "Dmitry Iv. <dfcreative@gmail.com>",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/audiojs/effect.git",
26
+ "directory": "packages/effect-gain"
27
+ },
28
+ "homepage": "https://github.com/audiojs/effect/tree/main/packages/effect-gain",
29
+ "bugs": {
30
+ "url": "https://github.com/audiojs/effect/issues"
31
+ },
32
+ "engines": {
33
+ "node": ">=18"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ }
38
+ }