@audio/synth-drum 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 +11 -9
- package/drum.js +1 -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 'cymbal' */
|
|
@@ -24,9 +26,9 @@ export declare const cymbal: {
|
|
|
24
26
|
streaming: false
|
|
25
27
|
params: {
|
|
26
28
|
/** 100..800 Hz (default 200) */
|
|
27
|
-
"freq": { type: "number", default: 200 }
|
|
29
|
+
"freq": { type: "number", min: 100, max: 800, default: 200, unit: "Hz" }
|
|
28
30
|
/** 0..1 (default 0.5) */
|
|
29
|
-
"amp": { type: "number", default: 0.5 }
|
|
31
|
+
"amp": { type: "number", min: 0, max: 1, default: 0.5 }
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
|
|
@@ -48,11 +50,11 @@ export declare const kick: {
|
|
|
48
50
|
streaming: false
|
|
49
51
|
params: {
|
|
50
52
|
/** 30..120 Hz (default 55) */
|
|
51
|
-
"freq": { type: "number", default: 55 }
|
|
53
|
+
"freq": { type: "number", min: 30, max: 120, default: 55, unit: "Hz" }
|
|
52
54
|
/** 1..8 (default 3) */
|
|
53
|
-
"drop": { type: "number", default: 3 }
|
|
55
|
+
"drop": { type: "number", min: 1, max: 8, default: 3 }
|
|
54
56
|
/** 0..1 (default 0.9) */
|
|
55
|
-
"amp": { type: "number", default: 0.9 }
|
|
57
|
+
"amp": { type: "number", min: 0, max: 1, default: 0.9 }
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
|
|
@@ -72,8 +74,8 @@ export declare const snare: {
|
|
|
72
74
|
streaming: false
|
|
73
75
|
params: {
|
|
74
76
|
/** 0..1 (default 0.7) */
|
|
75
|
-
"amp": { type: "number", default: 0.7 }
|
|
77
|
+
"amp": { type: "number", min: 0, max: 1, default: 0.7 }
|
|
76
78
|
/** 1..65536 (default 9) */
|
|
77
|
-
"seed": { type: "number", default: 9 }
|
|
79
|
+
"seed": { type: "number", min: 1, max: 65536, default: 9, step: 1 }
|
|
78
80
|
}
|
|
79
81
|
}
|
package/drum.js
CHANGED
|
@@ -26,7 +26,7 @@ export function noiseDrum ({ duration = 0.25, fs = 44100, amp = 0.7, seed = 9 }
|
|
|
26
26
|
let n = Math.round(duration * fs)
|
|
27
27
|
let out = new Float32Array(n)
|
|
28
28
|
let s = seed
|
|
29
|
-
for (let i = 0; i < n; i++) { s = (s
|
|
29
|
+
for (let i = 0; i < n; i++) { s = (Math.imul(s, 1103515245) + 12345) & 0x7fffffff; out[i] = amp * (s / 0x3fffffff - 1) * Math.exp(-i / n * 7) } // imul: exact mod 2³²
|
|
30
30
|
return out
|
|
31
31
|
}
|
|
32
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/synth-drum",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Drum synthesis — membrane kick, metal cymbal, noise snare (Tone.js class)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
},
|
|
14
14
|
"./package.json": "./package.json"
|
|
15
15
|
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"prepublishOnly": "node ../../../compile/tools/tested.js"
|
|
18
|
+
},
|
|
16
19
|
"files": [
|
|
17
20
|
"drum.js",
|
|
18
21
|
"drum.d.ts",
|