@audio/synth-noise 2.0.1 → 2.0.3
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/audio.d.ts +6 -4
- package/colors.js +4 -1
- package/package.json +4 -1
package/audio.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// Generated from the audio.js manifest (params metadata is the source of truth).
|
|
2
|
-
// Regenerate: node tools/dts.js in @audio/
|
|
2
|
+
// Regenerate: node tools/dts.js in @audio/plugin. Do not edit by hand.
|
|
3
3
|
|
|
4
4
|
/** Automatable number — scalar, `t => value` fn, or breakpoint curve {t, v} */
|
|
5
5
|
type Auto = number | ((t: number) => number) | { t: number[], v: number[] }
|
|
6
6
|
/** Per-block param values as delivered by hosts (numbers arrive as 1-length Float32Array) */
|
|
7
7
|
type Live = Record<string, Float32Array | string | boolean>
|
|
8
|
-
type
|
|
8
|
+
type Transport = Readonly<{ playing: boolean, bpm: number, beat: number, barStart: number, timeSig: [number, number] }>
|
|
9
|
+
/** What a host hands a processor it builds: the contract's Context (CONTRACT.d.ts, 1.0) */
|
|
10
|
+
type Ctx = { readonly sampleRate: number, readonly maxBlockSize: number, readonly maxChannels: number, readonly layouts?: { readonly inputs: readonly (string | undefined)[], readonly outputs: readonly (string | undefined)[] }, readonly params: Live, readonly buffers: Readonly<Record<string, Float32Array[] | undefined>>, readonly events?: readonly { time: number, kind: 'on' | 'off', midi: number, velocity: number, id: number }[], emit(name: string, value: number): void, readonly transport: Transport }
|
|
9
11
|
type Process = (inputs: Float32Array[][], outputs: Float32Array[][], params: Live) => void
|
|
10
12
|
|
|
11
13
|
/** Chainable-host options for 'noise' */
|
|
@@ -28,8 +30,8 @@ export declare const noise: {
|
|
|
28
30
|
/** default "white" */
|
|
29
31
|
"color": { type: "enum", values: ["white","pink","brown","blue","violet"], default: "white" }
|
|
30
32
|
/** 1..65536 (default 1) */
|
|
31
|
-
"seed": { type: "number", default: 1 }
|
|
33
|
+
"seed": { type: "number", min: 1, max: 65536, default: 1, step: 1 }
|
|
32
34
|
/** 0..1 (default 0.8) */
|
|
33
|
-
"gain": { type: "number", default: 0.8 }
|
|
35
|
+
"gain": { type: "number", min: 0, max: 1, default: 0.8 }
|
|
34
36
|
}
|
|
35
37
|
}
|
package/colors.js
CHANGED
|
@@ -9,10 +9,13 @@
|
|
|
9
9
|
import pinkNoise from './pink-noise.js'
|
|
10
10
|
export { default as pinkNoise } from './pink-noise.js'
|
|
11
11
|
|
|
12
|
+
// x ← (1103515245·x + 12345) mod 2³¹ (glibc's TYPE_0 random()), period 2³¹. Math.imul keeps the
|
|
13
|
+
// product exact mod 2³²: as a double it passes 2⁵³, its low bits round, and each of the seeds
|
|
14
|
+
// 1..65536 then falls into a cycle of 10,466 steps or fewer
|
|
12
15
|
function lcg (seed) {
|
|
13
16
|
let s = seed >>> 0 || 1
|
|
14
17
|
return () => {
|
|
15
|
-
s = (s
|
|
18
|
+
s = (Math.imul(s, 1103515245) + 12345) & 0x7fffffff
|
|
16
19
|
return s / 0x3fffffff - 1
|
|
17
20
|
}
|
|
18
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/synth-noise",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Colors of noise — white, pink (Kellet), brown, blue, violet; seeded, slope-verified",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
},
|
|
16
16
|
"./package.json": "./package.json"
|
|
17
17
|
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"prepublishOnly": "node ../../../compile/tools/tested.js"
|
|
20
|
+
},
|
|
18
21
|
"files": [
|
|
19
22
|
"pink-noise.js",
|
|
20
23
|
"pink-noise.d.ts",
|