@audio/synth-sfx 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 +22 -0
- package/package.json +6 -3
package/atom.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// atom manifest — sfxr-class game sound presets (pickup/laser/explosion/…).
|
|
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).sfx()` renders sfx over those 5 seconds).
|
|
5
|
+
|
|
6
|
+
import sfxFn from './sfx.js'
|
|
7
|
+
|
|
8
|
+
export const sfx = (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 d = sfxFn(params.preset, { fs: ctx.sampleRate })
|
|
14
|
+
const m = Math.min(n, d.length)
|
|
15
|
+
for (let c = 0; c < out.length; c++) { out[c].set(d.subarray(0, m)); out[c].fill(0, m) }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
sfx.channels = { inputs: [], outputs: 'any' }
|
|
19
|
+
sfx.streaming = false
|
|
20
|
+
sfx.params = {
|
|
21
|
+
preset: { type: 'enum', values: ['pickup', 'laser', 'explosion', 'powerup', 'hit', 'jump', 'blip', 'coin'], default: 'blip' },
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/synth-sfx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Game/UI sound effects generator — ZZFX / ChipTone class parameterized synthesis",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -19,12 +19,15 @@
|
|
|
19
19
|
"main": "sfx.js",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": "./sfx.js",
|
|
22
|
+
"./atom": "./atom.js",
|
|
22
23
|
"./package.json": "./package.json"
|
|
23
24
|
},
|
|
24
25
|
"files": [
|
|
25
|
-
"sfx.js"
|
|
26
|
+
"sfx.js",
|
|
27
|
+
"atom.js"
|
|
26
28
|
],
|
|
27
29
|
"publishConfig": {
|
|
28
30
|
"access": "public"
|
|
29
|
-
}
|
|
31
|
+
},
|
|
32
|
+
"atom": "./atom.js"
|
|
30
33
|
}
|