@audio/synth-noise 1.0.0 → 1.1.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.
- package/atom.js +27 -0
- package/package.json +8 -5
package/atom.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// atom manifest — noise generator with defined spectral slopes (white/pink/brown/blue/violet).
|
|
2
|
+
// Generator: no input bus, output width host-negotiated; whole-render (the batch
|
|
3
|
+
// kernel produces its buffer in one call, placed over the materialized timeline —
|
|
4
|
+
// `audio(5).noise()` renders noise over those 5 seconds).
|
|
5
|
+
|
|
6
|
+
import * as colors from './colors.js'
|
|
7
|
+
|
|
8
|
+
export const noise = (ctx) => {
|
|
9
|
+
return (inputs, outputs, params) => {
|
|
10
|
+
const out = outputs[0]
|
|
11
|
+
if (!out || !out.length) return
|
|
12
|
+
const n = out[0].length
|
|
13
|
+
const fn = colors[params.color]
|
|
14
|
+
for (let c = 0; c < out.length; c++) {
|
|
15
|
+
const d = fn(n, { seed: (params.seed[0] | 0) + c * 7919 }) // independent per channel
|
|
16
|
+
const g = params.gain[0]
|
|
17
|
+
for (let i = 0; i < n; i++) out[c][i] = d[i] * g
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
noise.channels = { inputs: [], outputs: 'any' }
|
|
22
|
+
noise.streaming = false
|
|
23
|
+
noise.params = {
|
|
24
|
+
color: { type: 'enum', values: ['white', 'pink', 'brown', 'blue', 'violet'], default: 'white' },
|
|
25
|
+
seed: { type: 'number', min: 1, max: 65536, default: 1, step: 1 },
|
|
26
|
+
gain: { type: 'number', min: 0, max: 1, default: 0.8 },
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/synth-noise",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Colors of noise — white, pink (Kellet), brown, blue, violet; seeded, slope-verified",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "pink-noise.js",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./pink-noise.js",
|
|
10
|
-
"./package.json": "./package.json",
|
|
11
10
|
"./colors": "./colors.js",
|
|
12
|
-
"./pink": "./pink-noise.js"
|
|
11
|
+
"./pink": "./pink-noise.js",
|
|
12
|
+
"./atom": "./atom.js",
|
|
13
|
+
"./package.json": "./package.json"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
15
16
|
"pink-noise.js",
|
|
16
17
|
"pink-noise.d.ts",
|
|
17
|
-
"colors.js"
|
|
18
|
+
"colors.js",
|
|
19
|
+
"atom.js"
|
|
18
20
|
],
|
|
19
21
|
"keywords": [
|
|
20
22
|
"audio",
|
|
@@ -31,5 +33,6 @@
|
|
|
31
33
|
"publishConfig": {
|
|
32
34
|
"access": "public"
|
|
33
35
|
},
|
|
34
|
-
"types": "pink-noise.d.ts"
|
|
36
|
+
"types": "pink-noise.d.ts",
|
|
37
|
+
"atom": "./atom.js"
|
|
35
38
|
}
|