@clipkit/sfx 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.
- package/LICENSE +201 -0
- package/README.md +60 -0
- package/dist/catalog.d.ts +29 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +78 -0
- package/dist/catalog.js.map +1 -0
- package/dist/encode-wav.d.ts +4 -0
- package/dist/encode-wav.d.ts.map +1 -0
- package/dist/encode-wav.js +36 -0
- package/dist/encode-wav.js.map +1 -0
- package/dist/finish.d.ts +16 -0
- package/dist/finish.d.ts.map +1 -0
- package/dist/finish.js +99 -0
- package/dist/finish.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/sfx.d.ts +124 -0
- package/dist/sfx.d.ts.map +1 -0
- package/dist/sfx.js +320 -0
- package/dist/sfx.js.map +1 -0
- package/package.json +17 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Clipkit Contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @clipkit/sfx
|
|
2
|
+
|
|
3
|
+
> Procedural sound-effects synthesis engine — pure DSP, no dependencies, emits 16-bit stereo PCM audio.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @clipkit/sfx
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
A lightweight procedural synth library for UI, game, and motion sound design. Generate 11 core SFX types (whoosh, impact, riser, pop, glitch, etc.) as raw stereo PCM, or render from a curated named catalog. Each synth layers filtered noise, pitched sweeps, and reverb tails—all deterministic and tunable in pitch and stereo. Route through a pro finishing chain (transient shape, air EQ, saturation, parallel compression, stereo width) and export as WAV.
|
|
10
|
+
|
|
11
|
+
Built for @clipkit/score (sound design) and the editor's audio browser. Pure algorithm—no recordings, no impulse responses—so catalog entries are license-clean and infinitely reproducible.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { whoosh, riser, finish, encodeWav, renderSfx } from '@clipkit/sfx';
|
|
17
|
+
|
|
18
|
+
// Generate raw synth
|
|
19
|
+
const sfx = whoosh({ duration: 0.5, tune: 220, gain: 0.3 });
|
|
20
|
+
|
|
21
|
+
// Polish through finishing chain
|
|
22
|
+
const finished = finish(sfx);
|
|
23
|
+
|
|
24
|
+
// Or render by catalog name (finishes by default)
|
|
25
|
+
const impact = renderSfx('impact', { tune: 440 });
|
|
26
|
+
|
|
27
|
+
// Export as 16-bit WAV bytes
|
|
28
|
+
const wav = encodeWav(finished);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
**Synth primitives** (all return `Sfx` — stereo PCM with sample rate):
|
|
34
|
+
- `whoosh(opts)` — swish + vwoom sweep, tunable pitch, air
|
|
35
|
+
- `impact(opts)` — thud + sub drop + click transient
|
|
36
|
+
- `riser(opts)` — uplifter with rising tone + swell
|
|
37
|
+
- `pop(opts)` — bright snap, scale-in blip + click
|
|
38
|
+
- `tick(opts)` — tiny UI tap, high blip
|
|
39
|
+
- `glitch(opts)` — bitcrushed stutter, sample-held tone+noise
|
|
40
|
+
- `shimmer(opts)` — sparkle, stacked partials + tremolo
|
|
41
|
+
- `braam(opts)` — cinematic dread hit, detuned brass cluster
|
|
42
|
+
- `downlifter(opts)` — downer, tone pitching down
|
|
43
|
+
- `sweep(opts)` — resonant filter sweep across stereo field
|
|
44
|
+
- `subDrop(opts)` — low whump, sine drop
|
|
45
|
+
- `glueBus(L, R, opts)` — shared reverb + saturation for cohesion
|
|
46
|
+
|
|
47
|
+
**Finishing chain:**
|
|
48
|
+
- `finish(audio, opts)` — transient shape, air EQ, saturation, compression, width, ceiling
|
|
49
|
+
|
|
50
|
+
**Catalog (16 named entries):**
|
|
51
|
+
- `renderSfx(name, opts)` — render by name (whoosh, impact, braam, pop, tick, glitch, shimmer, riser, downlifter, sweep, boom, ding-correct, buzzer-wrong, notification, power-up, coin)
|
|
52
|
+
- `listSfx()` — all catalog entries
|
|
53
|
+
- `sfxCategories()` — distinct categories
|
|
54
|
+
|
|
55
|
+
**Export:**
|
|
56
|
+
- `encodeWav(audio)` → `Uint8Array` (16-bit PCM WAV, ready to serve/save)
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
Apache-2.0 · part of [ClipKit](https://clipkit.dev) · [source](https://github.com/clipkit-video/clipkit)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type Sfx } from './sfx.js';
|
|
2
|
+
import { type FinishOptions } from './finish.js';
|
|
3
|
+
export interface SfxEntry {
|
|
4
|
+
/** Unique id, e.g. "whoosh", "buzzer-wrong". */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Display label. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** transition · impact · riser · ui · feedback · game · magic · tech */
|
|
9
|
+
category: string;
|
|
10
|
+
tags: string[];
|
|
11
|
+
/** Synth recipe — every catalog entry is generated. */
|
|
12
|
+
make: (opts?: {
|
|
13
|
+
tune?: number;
|
|
14
|
+
seed?: number;
|
|
15
|
+
}) => Sfx;
|
|
16
|
+
}
|
|
17
|
+
export declare const SFX_CATALOG: SfxEntry[];
|
|
18
|
+
/** The full catalog (for an editor audio tab to browse). */
|
|
19
|
+
export declare function listSfx(): SfxEntry[];
|
|
20
|
+
/** Distinct categories in the catalog. */
|
|
21
|
+
export declare function sfxCategories(): string[];
|
|
22
|
+
export interface RenderSfxOptions {
|
|
23
|
+
tune?: number;
|
|
24
|
+
seed?: number;
|
|
25
|
+
finish?: boolean | FinishOptions;
|
|
26
|
+
}
|
|
27
|
+
/** Render a named SFX → stereo PCM, finished by default. Null for unknown names. */
|
|
28
|
+
export declare function renderSfx(name: string, opts?: RenderSfxOptions): Sfx | null;
|
|
29
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AASA,OAAO,EACiF,KAAK,GAAG,EAC/F,MAAM,UAAU,CAAC;AAClB,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAIzD,MAAM,WAAW,QAAQ;IACvB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,uDAAuD;IACvD,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,GAAG,CAAC;CACxD;AA6BD,eAAO,MAAM,WAAW,EAAE,QAAQ,EAiBjC,CAAC;AAEF,4DAA4D;AAC5D,wBAAgB,OAAO,IAAI,QAAQ,EAAE,CAAwB;AAE7D,0CAA0C;AAC1C,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAA6D;AAEtG,MAAM,WAAW,gBAAgB;IAAG,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;CAAE;AAErG,oFAAoF;AACpF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,gBAAqB,GAAG,GAAG,GAAG,IAAI,CAM/E"}
|
package/dist/catalog.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// The named SFX catalog — a browsable registry of popular sounds, all SYNTH:
|
|
2
|
+
// generated by the engine, license-clean, deterministic, tunable. The editor's
|
|
3
|
+
// audio tab lists these; renderSfx() previews.
|
|
4
|
+
//
|
|
5
|
+
// Scope is deliberately what synthesis nails — designed/abstract/tonal sounds
|
|
6
|
+
// (whoosh, impact, riser, UI, game, glitch, feedback). Organic human/crowd
|
|
7
|
+
// sounds (gasp, applause, cheering) want recordings, not synthesis, so they're
|
|
8
|
+
// intentionally out of this catalog rather than faked.
|
|
9
|
+
import { whoosh, impact, riser, downlifter, subDrop, pop, tick, sweep, glitch, shimmer, braam, } from './sfx.js';
|
|
10
|
+
import { finish } from './finish.js';
|
|
11
|
+
const SR = 44100;
|
|
12
|
+
function notesToSfx(notes, totalDur) {
|
|
13
|
+
const N = Math.floor(totalDur * SR), buf = new Float32Array(N);
|
|
14
|
+
for (const nt of notes) {
|
|
15
|
+
const start = Math.floor(nt.t * SR), len = Math.floor(nt.d * SR), w = nt.wave ?? 'sine';
|
|
16
|
+
let ph = 0;
|
|
17
|
+
for (let i = 0; i < len; i++) {
|
|
18
|
+
const tt = i / SR;
|
|
19
|
+
ph += (2 * Math.PI * nt.f) / SR;
|
|
20
|
+
let v;
|
|
21
|
+
if (w === 'square')
|
|
22
|
+
v = Math.sin(ph) >= 0 ? 0.7 : -0.7;
|
|
23
|
+
else if (w === 'saw') {
|
|
24
|
+
let s = 0;
|
|
25
|
+
const K = Math.min(12, Math.floor(SR / 2 / nt.f));
|
|
26
|
+
for (let k = 1; k <= K; k++)
|
|
27
|
+
s += Math.sin(k * ph) / k;
|
|
28
|
+
v = s * 0.5;
|
|
29
|
+
}
|
|
30
|
+
else
|
|
31
|
+
v = Math.sin(ph);
|
|
32
|
+
const env = Math.exp(-tt / (nt.d * 0.4)) * Math.min(1, tt / 0.005);
|
|
33
|
+
const idx = start + i;
|
|
34
|
+
if (idx < N)
|
|
35
|
+
buf[idx] += v * env * (nt.gain ?? 0.3);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return { left: buf, right: Float32Array.from(buf), sampleRate: SR };
|
|
39
|
+
}
|
|
40
|
+
const sc = (o) => (o?.tune ?? 220) / 220; // scale to key
|
|
41
|
+
const dingCorrect = (o) => { const t = sc(o); return notesToSfx([{ f: 880 * t, t: 0, d: 0.5 }, { f: 1320 * t, t: 0.08, d: 0.6 }], 0.7); };
|
|
42
|
+
const buzzerWrong = (o) => { const t = sc(o); return notesToSfx([{ f: 150 * t, t: 0, d: 0.18, wave: 'square', gain: 0.32 }, { f: 145 * t, t: 0.22, d: 0.24, wave: 'square', gain: 0.32 }], 0.5); };
|
|
43
|
+
const notification = (o) => { const t = sc(o); return notesToSfx([{ f: 1318 * t, t: 0, d: 0.22, gain: 0.28 }, { f: 1760 * t, t: 0.11, d: 0.4, gain: 0.28 }], 0.5); };
|
|
44
|
+
const powerUp = (o) => { const t = sc(o); return notesToSfx([523, 659, 784, 1046].map((f, i) => ({ f: f * t, t: i * 0.06, d: 0.2, wave: 'saw', gain: 0.22 })), 0.5); };
|
|
45
|
+
const coin = (o) => { const t = sc(o); return notesToSfx([{ f: 988 * t, t: 0, d: 0.08, gain: 0.3 }, { f: 1318 * t, t: 0.06, d: 0.3, gain: 0.3 }], 0.4); };
|
|
46
|
+
export const SFX_CATALOG = [
|
|
47
|
+
{ name: 'whoosh', label: 'Whoosh', category: 'transition', tags: ['swoosh', 'slide', 'transition'], make: (o) => whoosh({ tune: o?.tune, seed: o?.seed }) },
|
|
48
|
+
{ name: 'sweep', label: 'Sweep', category: 'transition', tags: ['filter', 'transition'], make: (o) => sweep({ seed: o?.seed }) },
|
|
49
|
+
{ name: 'impact', label: 'Impact / Hit', category: 'impact', tags: ['hit', 'boom', 'cut'], make: (o) => impact({ tune: o?.tune, seed: o?.seed }) },
|
|
50
|
+
{ name: 'boom', label: 'Boom / Sub Drop', category: 'impact', tags: ['sub', 'drop'], make: () => subDrop() },
|
|
51
|
+
{ name: 'braam', label: 'Braam (cinematic)', category: 'impact', tags: ['trailer', 'dread'], make: (o) => braam({ tune: o?.tune ?? 110, seed: o?.seed }) },
|
|
52
|
+
{ name: 'riser', label: 'Riser / Uplifter', category: 'riser', tags: ['build', 'tension'], make: (o) => riser({ tune: o?.tune, seed: o?.seed }) },
|
|
53
|
+
{ name: 'downlifter', label: 'Downlifter', category: 'riser', tags: ['downer', 'exit'], make: (o) => downlifter({ tune: o?.tune, seed: o?.seed }) },
|
|
54
|
+
{ name: 'pop', label: 'Pop', category: 'ui', tags: ['blip', 'appear'], make: (o) => pop({ tune: o?.tune, seed: o?.seed }) },
|
|
55
|
+
{ name: 'tick', label: 'Tick / Tap', category: 'ui', tags: ['click', 'counter'], make: (o) => tick({ tune: o?.tune, seed: o?.seed }) },
|
|
56
|
+
{ name: 'notification', label: 'Notification', category: 'ui', tags: ['alert', 'message'], make: (o) => notification(o) },
|
|
57
|
+
{ name: 'ding-correct', label: 'Correct / Ding', category: 'feedback', tags: ['right', 'success', 'chime'], make: (o) => dingCorrect(o) },
|
|
58
|
+
{ name: 'buzzer-wrong', label: 'Wrong Answer Buzzer', category: 'feedback', tags: ['wrong', 'error', 'buzz'], make: (o) => buzzerWrong(o) },
|
|
59
|
+
{ name: 'power-up', label: 'Power Up', category: 'game', tags: ['game', 'level up'], make: (o) => powerUp(o) },
|
|
60
|
+
{ name: 'coin', label: 'Coin / Pickup', category: 'game', tags: ['game', 'collect'], make: (o) => coin(o) },
|
|
61
|
+
{ name: 'shimmer', label: 'Shimmer / Sparkle', category: 'magic', tags: ['reveal', 'sparkle'], make: (o) => shimmer({ tune: o?.tune }) },
|
|
62
|
+
{ name: 'glitch', label: 'Glitch', category: 'tech', tags: ['digital', 'stutter'], make: (o) => glitch({ tune: o?.tune, seed: o?.seed }) },
|
|
63
|
+
];
|
|
64
|
+
/** The full catalog (for an editor audio tab to browse). */
|
|
65
|
+
export function listSfx() { return SFX_CATALOG; }
|
|
66
|
+
/** Distinct categories in the catalog. */
|
|
67
|
+
export function sfxCategories() { return [...new Set(SFX_CATALOG.map((e) => e.category))]; }
|
|
68
|
+
/** Render a named SFX → stereo PCM, finished by default. Null for unknown names. */
|
|
69
|
+
export function renderSfx(name, opts = {}) {
|
|
70
|
+
const e = SFX_CATALOG.find((x) => x.name === name);
|
|
71
|
+
if (!e)
|
|
72
|
+
return null;
|
|
73
|
+
let s = e.make({ tune: opts.tune, seed: opts.seed });
|
|
74
|
+
if (opts.finish !== false)
|
|
75
|
+
s = finish(s, typeof opts.finish === 'object' ? opts.finish : undefined);
|
|
76
|
+
return s;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,+EAA+E;AAC/E,+CAA+C;AAC/C,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,+EAA+E;AAC/E,uDAAuD;AAEvD,OAAO,EACL,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GACrF,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAsB,MAAM,aAAa,CAAC;AAEzD,MAAM,EAAE,GAAG,KAAK,CAAC;AAgBjB,SAAS,UAAU,CAAC,KAAa,EAAE,QAAgB;IACjD,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;IAC/D,KAAK,MAAM,EAAE,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,GAA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AK;QAAE,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACpG,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encode-wav.d.ts","sourceRoot":"","sources":["../src/encode-wav.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,0EAA0E;AAC1E,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,UAAU,CAoBhD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Stereo 16-bit PCM WAV encoder. Turns a rendered Sfx into bytes you can serve,
|
|
2
|
+
// write to disk, or wrap in a Blob/object-URL for an `audio` element's `source`.
|
|
3
|
+
// Self-contained so the editor can render → encode → drop-on-timeline without a
|
|
4
|
+
// dependency on @clipkit/score.
|
|
5
|
+
/** Encode rendered stereo audio as a 16-bit PCM WAV (interleaved L/R). */
|
|
6
|
+
export function encodeWav(audio) {
|
|
7
|
+
const { left, right, sampleRate } = audio;
|
|
8
|
+
const n = Math.min(left.length, right.length);
|
|
9
|
+
const bytes = new Uint8Array(44 + n * 4);
|
|
10
|
+
const dv = new DataView(bytes.buffer);
|
|
11
|
+
const put = (o, s) => { for (let i = 0; i < s.length; i++)
|
|
12
|
+
dv.setUint8(o + i, s.charCodeAt(i)); };
|
|
13
|
+
put(0, 'RIFF');
|
|
14
|
+
dv.setUint32(4, 36 + n * 4, true);
|
|
15
|
+
put(8, 'WAVE');
|
|
16
|
+
put(12, 'fmt ');
|
|
17
|
+
dv.setUint32(16, 16, true);
|
|
18
|
+
dv.setUint16(20, 1, true);
|
|
19
|
+
dv.setUint16(22, 2, true);
|
|
20
|
+
dv.setUint32(24, sampleRate, true);
|
|
21
|
+
dv.setUint32(28, sampleRate * 4, true);
|
|
22
|
+
dv.setUint16(32, 4, true);
|
|
23
|
+
dv.setUint16(34, 16, true);
|
|
24
|
+
put(36, 'data');
|
|
25
|
+
dv.setUint32(40, n * 4, true);
|
|
26
|
+
const clamp = (x) => Math.max(-1, Math.min(1, x));
|
|
27
|
+
let o = 44;
|
|
28
|
+
for (let i = 0; i < n; i++) {
|
|
29
|
+
dv.setInt16(o, Math.round(clamp(left[i]) * 32767), true);
|
|
30
|
+
o += 2;
|
|
31
|
+
dv.setInt16(o, Math.round(clamp(right[i]) * 32767), true);
|
|
32
|
+
o += 2;
|
|
33
|
+
}
|
|
34
|
+
return bytes;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=encode-wav.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encode-wav.js","sourceRoot":"","sources":["../src/encode-wav.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,iFAAiF;AACjF,gFAAgF;AAChF,gCAAgC;AAIhC,0EAA0E;AAC1E,MAAM,UAAU,SAAS,CAAC,KAAU;IAClC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAC1C,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACzC,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,EAAQ,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC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AAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,GAAG,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;QAAC,CAAC,IAAI,CAAC,CAAC;QAClE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,GAAG,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;QAAC,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/finish.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Sfx } from './sfx.js';
|
|
2
|
+
export interface FinishOptions {
|
|
3
|
+
/** Attack emphasis (snap/punch), 0..1. Default 0.3. */
|
|
4
|
+
transient?: number;
|
|
5
|
+
/** High-shelf "air" boost (crispness), 0..1. Default 0.5. */
|
|
6
|
+
air?: number;
|
|
7
|
+
/** Oversampled (anti-aliased) saturation amount, 0..1. Default 0.5. */
|
|
8
|
+
drive?: number;
|
|
9
|
+
/** Parallel-compression mix (density/punch), 0..1. Default 0.2. */
|
|
10
|
+
parallel?: number;
|
|
11
|
+
/** Stereo widening of the highs (lows stay mono), 0..1. Default 0.25. */
|
|
12
|
+
width?: number;
|
|
13
|
+
}
|
|
14
|
+
/** Run a sound through the finishing chain → a crisp, "mastered" version. */
|
|
15
|
+
export declare function finish(audio: Sfx, opts?: FinishOptions): Sfx;
|
|
16
|
+
//# sourceMappingURL=finish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finish.d.ts","sourceRoot":"","sources":["../src/finish.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,WAAW,aAAa;IAC5B,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAwED,6EAA6E;AAC7E,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,GAAE,aAAkB,GAAG,GAAG,CAUhE"}
|
package/dist/finish.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// The FINISHING CHAIN — the polish pros put on every sound to make it crisp.
|
|
2
|
+
// A synth produces a raw sound; this is the "mastering" stage every sound runs
|
|
3
|
+
// through. Order matters (same as a real chain):
|
|
4
|
+
//
|
|
5
|
+
// transient shape → air EQ → oversampled saturation → parallel comp → M/S width → ceiling
|
|
6
|
+
//
|
|
7
|
+
// All in code, license-clean. (Convolution reverb is the one technique we DON'T
|
|
8
|
+
// do here — it needs an impulse response, which is a recording; deferred like
|
|
9
|
+
// organic foley.)
|
|
10
|
+
// ── 1. transient shaping: emphasise the attack (fast env above slow env) ──────
|
|
11
|
+
function transientShape(L, R, sr, amount) {
|
|
12
|
+
if (amount <= 0)
|
|
13
|
+
return;
|
|
14
|
+
const fu = 1 - Math.exp(-1 / (0.0008 * sr)), fd = 1 - Math.exp(-1 / (0.02 * sr));
|
|
15
|
+
const su = 1 - Math.exp(-1 / (0.005 * sr)), sd = 1 - Math.exp(-1 / (0.08 * sr));
|
|
16
|
+
let ef = 0, es = 0;
|
|
17
|
+
for (let i = 0; i < L.length; i++) {
|
|
18
|
+
const m = Math.max(Math.abs(L[i]), Math.abs(R[i]));
|
|
19
|
+
ef += (m > ef ? fu : fd) * (m - ef);
|
|
20
|
+
es += (m > es ? su : sd) * (m - es);
|
|
21
|
+
const g = 1 + amount * Math.min(2, Math.max(0, ef - es) * 6);
|
|
22
|
+
L[i] *= g;
|
|
23
|
+
R[i] *= g;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// ── 2. air EQ: high-shelf boost (crisp) + sub-rumble cleanup ──────────────────
|
|
27
|
+
function airEQ(L, R, sr, air) {
|
|
28
|
+
const a9 = 1 - Math.exp((-2 * Math.PI * 9000) / sr);
|
|
29
|
+
const a30 = 1 - Math.exp((-2 * Math.PI * 30) / sr);
|
|
30
|
+
let lp9L = 0, lp9R = 0, lp30L = 0, lp30R = 0;
|
|
31
|
+
for (let i = 0; i < L.length; i++) {
|
|
32
|
+
lp9L += a9 * (L[i] - lp9L);
|
|
33
|
+
lp30L += a30 * (L[i] - lp30L);
|
|
34
|
+
L[i] = (L[i] - lp30L) + air * (L[i] - lp9L);
|
|
35
|
+
lp9R += a9 * (R[i] - lp9R);
|
|
36
|
+
lp30R += a30 * (R[i] - lp30R);
|
|
37
|
+
R[i] = (R[i] - lp30R) + air * (R[i] - lp9R);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// ── 3. oversampled saturation: 2× to keep distortion harmonics from aliasing ──
|
|
41
|
+
function oversampledSat(buf, drive) {
|
|
42
|
+
if (drive <= 0)
|
|
43
|
+
return;
|
|
44
|
+
const d = 1 + drive * 2, norm = Math.tanh(d) || 1;
|
|
45
|
+
let prev = 0;
|
|
46
|
+
for (let i = 0; i < buf.length; i++) {
|
|
47
|
+
const x = buf[i];
|
|
48
|
+
const a = Math.tanh(((prev + x) * 0.5) * d); // interpolated midpoint (the 2× sample)
|
|
49
|
+
const b = Math.tanh(x * d);
|
|
50
|
+
buf[i] = ((a + b) * 0.5) / norm; // average pair = lowpass before decimating
|
|
51
|
+
prev = x;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// ── 4. parallel ("New York") compression: add a squashed copy for density ─────
|
|
55
|
+
function parallelComp(L, R, sr, amount) {
|
|
56
|
+
if (amount <= 0)
|
|
57
|
+
return;
|
|
58
|
+
const au = 1 - Math.exp(-1 / (0.002 * sr)), ad = 1 - Math.exp(-1 / (0.1 * sr));
|
|
59
|
+
const thr = 0.15, ratio = 4, makeup = 1.8;
|
|
60
|
+
let env = 0;
|
|
61
|
+
for (let i = 0; i < L.length; i++) {
|
|
62
|
+
const m = Math.max(Math.abs(L[i]), Math.abs(R[i]));
|
|
63
|
+
env += (m > env ? au : ad) * (m - env);
|
|
64
|
+
const gr = env > thr ? (thr + (env - thr) / ratio) / env : 1;
|
|
65
|
+
L[i] += amount * L[i] * gr * makeup;
|
|
66
|
+
R[i] += amount * R[i] * gr * makeup;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// ── 5. mid/side width: widen the highs, keep the lows mono (no phase mush) ─────
|
|
70
|
+
function msWidth(L, R, sr, width) {
|
|
71
|
+
if (width <= 0)
|
|
72
|
+
return;
|
|
73
|
+
const a200 = 1 - Math.exp((-2 * Math.PI * 200) / sr);
|
|
74
|
+
let sLP = 0;
|
|
75
|
+
for (let i = 0; i < L.length; i++) {
|
|
76
|
+
const mid = (L[i] + R[i]) * 0.5, side = (L[i] - R[i]) * 0.5;
|
|
77
|
+
sLP += a200 * (side - sLP);
|
|
78
|
+
const s = sLP + (side - sLP) * (1 + width); // lows (sLP) mono, highs widened
|
|
79
|
+
L[i] = mid + s;
|
|
80
|
+
R[i] = mid - s;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** Run a sound through the finishing chain → a crisp, "mastered" version. */
|
|
84
|
+
export function finish(audio, opts = {}) {
|
|
85
|
+
const L = Float32Array.from(audio.left), R = Float32Array.from(audio.right);
|
|
86
|
+
const sr = audio.sampleRate;
|
|
87
|
+
transientShape(L, R, sr, opts.transient ?? 0.3);
|
|
88
|
+
airEQ(L, R, sr, opts.air ?? 0.5);
|
|
89
|
+
oversampledSat(L, opts.drive ?? 0.5);
|
|
90
|
+
oversampledSat(R, opts.drive ?? 0.5);
|
|
91
|
+
parallelComp(L, R, sr, opts.parallel ?? 0.2);
|
|
92
|
+
msWidth(L, R, sr, opts.width ?? 0.25);
|
|
93
|
+
for (let i = 0; i < L.length; i++) {
|
|
94
|
+
L[i] = Math.max(-1, Math.min(1, L[i]));
|
|
95
|
+
R[i] = Math.max(-1, Math.min(1, R[i]));
|
|
96
|
+
}
|
|
97
|
+
return { left: L, right: R, sampleRate: sr };
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=finish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finish.js","sourceRoot":"","sources":["../src/finish.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,+EAA+E;AAC/E,iDAAiD;AACjD,EAAE;AACF,4FAA4F;AAC5F,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,kBAAkB;AAiBlB,iFAAiF;AACjF,SAAS,cAAc,CAAC,CAAe,EAAE,CAAe,EAAE,EAAU,EAAE,MAAc;IAClF,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO;IACxB,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC;IACjF,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC;IAChF,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,MAAM,CAAC,GAAG,IAAI,CA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C,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC;IAAC,CAAC;IACxH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;AAC/C,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { whoosh, impact, riser, subDrop, pop, tick, braam, downlifter, sweep, glitch, shimmer, glueBus, type Sfx, type Pan, type WhooshOptions, type ImpactOptions, type RiserOptions, type SubDropOptions, type PopOptions, type TickOptions, type BraamOptions, type DownlifterOptions, type SweepOptions, type GlitchOptions, type ShimmerOptions, } from './sfx.js';
|
|
2
|
+
export { finish, type FinishOptions } from './finish.js';
|
|
3
|
+
export { encodeWav } from './encode-wav.js';
|
|
4
|
+
export { SFX_CATALOG, listSfx, sfxCategories, renderSfx, type SfxEntry, type RenderSfxOptions, } from './catalog.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAC7F,KAAK,GAAG,EAAE,KAAK,GAAG,EAClB,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAC/F,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,GACxH,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAC9C,KAAK,QAAQ,EAAE,KAAK,gBAAgB,GACrC,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @clipkit/sfx — standalone procedural sound-effects engine.
|
|
2
|
+
//
|
|
3
|
+
// • synthesis primitives (whoosh, impact, riser, pop, glitch, …)
|
|
4
|
+
// • a pro finishing chain (finish) — transient/air/anti-alias/comp/width
|
|
5
|
+
// • a browsable named catalog (listSfx / renderSfx) — for an editor audio tab
|
|
6
|
+
//
|
|
7
|
+
// Pure DSP, no dependencies. Used by @clipkit/score (sound design) and the editor.
|
|
8
|
+
export { whoosh, impact, riser, subDrop, pop, tick, braam, downlifter, sweep, glitch, shimmer, glueBus, } from './sfx.js';
|
|
9
|
+
export { finish } from './finish.js';
|
|
10
|
+
export { encodeWav } from './encode-wav.js';
|
|
11
|
+
export { SFX_CATALOG, listSfx, sfxCategories, renderSfx, } from './catalog.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,mEAAmE;AACnE,2EAA2E;AAC3E,gFAAgF;AAChF,EAAE;AACF,mFAAmF;AAEnF,OAAO,EACL,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAI9F,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAsB,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,GAE/C,MAAM,cAAc,CAAC"}
|
package/dist/sfx.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export interface Sfx {
|
|
2
|
+
left: Float32Array;
|
|
3
|
+
right: Float32Array;
|
|
4
|
+
sampleRate: number;
|
|
5
|
+
}
|
|
6
|
+
/** Static pan -1..1, or [from, to] to sweep across the stereo field (a slide). */
|
|
7
|
+
export type Pan = number | [number, number];
|
|
8
|
+
export interface WhooshOptions {
|
|
9
|
+
duration?: number;
|
|
10
|
+
gain?: number;
|
|
11
|
+
seed?: number;
|
|
12
|
+
pan?: Pan;
|
|
13
|
+
reverb?: number;
|
|
14
|
+
tune?: number;
|
|
15
|
+
}
|
|
16
|
+
/** A swish into a cut: a noise BAND sweeping upward (movement) layered with a
|
|
17
|
+
* pitched "vwoom" tuned to `tune` Hz, bell-shaped, with air. Place to END on the
|
|
18
|
+
* cut. `reverb: 0` for a dry voice (glue with one shared reverb on the bus). */
|
|
19
|
+
export declare function whoosh(o?: WhooshOptions): Sfx;
|
|
20
|
+
export interface ImpactOptions {
|
|
21
|
+
duration?: number;
|
|
22
|
+
gain?: number;
|
|
23
|
+
seed?: number;
|
|
24
|
+
pan?: Pan;
|
|
25
|
+
reverb?: number;
|
|
26
|
+
tune?: number;
|
|
27
|
+
}
|
|
28
|
+
/** A thud on the cut: sub sine drop (tuned low, around `tune`) + a filtered noise
|
|
29
|
+
* body + a click transient, with a tail. Subtle by default. */
|
|
30
|
+
export declare function impact(o?: ImpactOptions): Sfx;
|
|
31
|
+
export interface RiserOptions {
|
|
32
|
+
duration?: number;
|
|
33
|
+
gain?: number;
|
|
34
|
+
seed?: number;
|
|
35
|
+
pan?: Pan;
|
|
36
|
+
reverb?: number;
|
|
37
|
+
tune?: number;
|
|
38
|
+
}
|
|
39
|
+
/** An uplifter into a big moment: a noise band + rising tone (tuned), swelling. */
|
|
40
|
+
export declare function riser(o?: RiserOptions): Sfx;
|
|
41
|
+
export interface PopOptions {
|
|
42
|
+
duration?: number;
|
|
43
|
+
gain?: number;
|
|
44
|
+
seed?: number;
|
|
45
|
+
pan?: Pan;
|
|
46
|
+
reverb?: number;
|
|
47
|
+
tune?: number;
|
|
48
|
+
}
|
|
49
|
+
/** A bright snap for a scale-in/bounce: a quick pitched blip (tuned high, around
|
|
50
|
+
* 2× `tune`) + a click + air. */
|
|
51
|
+
export declare function pop(o?: PopOptions): Sfx;
|
|
52
|
+
/**
|
|
53
|
+
* "Glue" a stereo SFX bus into one cohesive layer: a single SHARED reverb (so
|
|
54
|
+
* every SFX sits in the same space) + light saturation. Run this once on the
|
|
55
|
+
* summed bus AFTER placing dry SFX — the cohesion fix. In place.
|
|
56
|
+
*/
|
|
57
|
+
export declare function glueBus(L: Float32Array, R: Float32Array, opts?: {
|
|
58
|
+
space?: number;
|
|
59
|
+
drive?: number;
|
|
60
|
+
}): void;
|
|
61
|
+
export interface SubDropOptions {
|
|
62
|
+
duration?: number;
|
|
63
|
+
gain?: number;
|
|
64
|
+
}
|
|
65
|
+
/** A low whump after an impact — sine dropping in pitch. */
|
|
66
|
+
export declare function subDrop(o?: SubDropOptions): Sfx;
|
|
67
|
+
export interface TickOptions {
|
|
68
|
+
gain?: number;
|
|
69
|
+
seed?: number;
|
|
70
|
+
pan?: Pan;
|
|
71
|
+
reverb?: number;
|
|
72
|
+
tune?: number;
|
|
73
|
+
}
|
|
74
|
+
/** A tiny UI tick/tap — a short high blip + click. For small reveals/counters. */
|
|
75
|
+
export declare function tick(o?: TickOptions): Sfx;
|
|
76
|
+
export interface BraamOptions {
|
|
77
|
+
duration?: number;
|
|
78
|
+
gain?: number;
|
|
79
|
+
seed?: number;
|
|
80
|
+
reverb?: number;
|
|
81
|
+
tune?: number;
|
|
82
|
+
}
|
|
83
|
+
/** Cinematic dread hit — a detuned low brass/saw cluster (root+fifth+octave) +
|
|
84
|
+
* sub + noise rasp, slow swell, heavy saturation, long tail. Power & weight. */
|
|
85
|
+
export declare function braam(o?: BraamOptions): Sfx;
|
|
86
|
+
export interface DownlifterOptions {
|
|
87
|
+
duration?: number;
|
|
88
|
+
gain?: number;
|
|
89
|
+
seed?: number;
|
|
90
|
+
pan?: Pan;
|
|
91
|
+
reverb?: number;
|
|
92
|
+
tune?: number;
|
|
93
|
+
}
|
|
94
|
+
/** A downer — noise band + tone pitching DOWN, falling away. Scene exit / release. */
|
|
95
|
+
export declare function downlifter(o?: DownlifterOptions): Sfx;
|
|
96
|
+
export interface SweepOptions {
|
|
97
|
+
duration?: number;
|
|
98
|
+
gain?: number;
|
|
99
|
+
seed?: number;
|
|
100
|
+
reverb?: number;
|
|
101
|
+
}
|
|
102
|
+
/** A wide resonant filter sweep — noise through a state-variable bandpass whose
|
|
103
|
+
* cutoff sweeps up, panned across the field. A clean transition wash. */
|
|
104
|
+
export declare function sweep(o?: SweepOptions): Sfx;
|
|
105
|
+
export interface GlitchOptions {
|
|
106
|
+
duration?: number;
|
|
107
|
+
gain?: number;
|
|
108
|
+
seed?: number;
|
|
109
|
+
pan?: Pan;
|
|
110
|
+
tune?: number;
|
|
111
|
+
}
|
|
112
|
+
/** A digital glitch/stutter — bitcrushed + sample-held tone+noise, gated into
|
|
113
|
+
* retriggered slices. Dry-ish, modern/tech. */
|
|
114
|
+
export declare function glitch(o?: GlitchOptions): Sfx;
|
|
115
|
+
export interface ShimmerOptions {
|
|
116
|
+
duration?: number;
|
|
117
|
+
gain?: number;
|
|
118
|
+
reverb?: number;
|
|
119
|
+
tune?: number;
|
|
120
|
+
}
|
|
121
|
+
/** A bright sparkle for reveals — stacked high partials (octaves + fifths) with
|
|
122
|
+
* tremolo and a long bright tail. The "premium" sheen. */
|
|
123
|
+
export declare function shimmer(o?: ShimmerOptions): Sfx;
|
|
124
|
+
//# sourceMappingURL=sfx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sfx.d.ts","sourceRoot":"","sources":["../src/sfx.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,GAA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2
|
+
// the real sound-design recipe (not just filtered noise): each SFX LAYERS a
|
|
3
|
+
// swept noise band + a pitched sweep, shapes it with a bell envelope, and adds a
|
|
4
|
+
// short reverb TAIL for air + stereo movement. Procedural, license-clean,
|
|
5
|
+
// deterministic, infinitely tunable. (The same functions can be swapped for CC0
|
|
6
|
+
// WAVs later — designSfxBus just needs audio.)
|
|
7
|
+
//
|
|
8
|
+
// whoosh → into a cut (anticipation), impact → on it (payoff), riser → builds in,
|
|
9
|
+
// pop → a scale/snap. Each returns stereo PCM (encodeWav-able).
|
|
10
|
+
const SR = 44100;
|
|
11
|
+
function rng(seed) {
|
|
12
|
+
let a = seed >>> 0;
|
|
13
|
+
return () => {
|
|
14
|
+
a |= 0;
|
|
15
|
+
a = (a + 0x6d2b79f5) | 0;
|
|
16
|
+
let t = Math.imul(a ^ (a >>> 15), 1 | a);
|
|
17
|
+
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
|
|
18
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
// ── a small Schroeder reverb for "air" (4 combs + 2 allpass) ──────────────────
|
|
22
|
+
function comb(x, D, g) {
|
|
23
|
+
const y = new Float32Array(x.length), z = new Float32Array(D);
|
|
24
|
+
let p = 0;
|
|
25
|
+
for (let i = 0; i < x.length; i++) {
|
|
26
|
+
const yn = x[i] + g * z[p];
|
|
27
|
+
z[p] = yn;
|
|
28
|
+
y[i] = yn;
|
|
29
|
+
p = (p + 1) % D;
|
|
30
|
+
}
|
|
31
|
+
return y;
|
|
32
|
+
}
|
|
33
|
+
function allpass(x, D, g) {
|
|
34
|
+
const y = new Float32Array(x.length), z = new Float32Array(D);
|
|
35
|
+
let p = 0;
|
|
36
|
+
for (let i = 0; i < x.length; i++) {
|
|
37
|
+
const bo = z[p];
|
|
38
|
+
y[i] = -g * x[i] + bo;
|
|
39
|
+
z[p] = x[i] + g * bo;
|
|
40
|
+
p = (p + 1) % D;
|
|
41
|
+
}
|
|
42
|
+
return y;
|
|
43
|
+
}
|
|
44
|
+
function reverbMono(x) {
|
|
45
|
+
const wet = new Float32Array(x.length);
|
|
46
|
+
for (const d of [1116, 1188, 1277, 1356]) {
|
|
47
|
+
const c = comb(x, d, 0.78);
|
|
48
|
+
for (let i = 0; i < x.length; i++)
|
|
49
|
+
wet[i] += c[i] * 0.25;
|
|
50
|
+
}
|
|
51
|
+
return allpass(allpass(wet, 556, 0.5), 441, 0.5);
|
|
52
|
+
}
|
|
53
|
+
/** Place a mono dry signal in stereo with a pan (or pan-sweep) and a reverb tail. */
|
|
54
|
+
function spatialize(dry, pan, reverbMix, tailSec) {
|
|
55
|
+
const tail = Math.floor(tailSec * SR), n = dry.length, N = n + tail;
|
|
56
|
+
const src = new Float32Array(N);
|
|
57
|
+
src.set(dry);
|
|
58
|
+
const wet = reverbMix > 0 ? reverbMono(src) : null;
|
|
59
|
+
const L = new Float32Array(N), R = new Float32Array(N);
|
|
60
|
+
for (let i = 0; i < N; i++) {
|
|
61
|
+
const k = Math.min(1, i / n);
|
|
62
|
+
const p = Array.isArray(pan) ? pan[0] + (pan[1] - pan[0]) * k : pan;
|
|
63
|
+
const lg = Math.cos((p + 1) * Math.PI / 4), rg = Math.sin((p + 1) * Math.PI / 4);
|
|
64
|
+
const wv = wet ? wet[i] * reverbMix : 0;
|
|
65
|
+
L[i] = src[i] * lg + wv;
|
|
66
|
+
R[i] = src[i] * rg + wv;
|
|
67
|
+
}
|
|
68
|
+
return { left: L, right: R, sampleRate: SR };
|
|
69
|
+
}
|
|
70
|
+
/** A swish into a cut: a noise BAND sweeping upward (movement) layered with a
|
|
71
|
+
* pitched "vwoom" tuned to `tune` Hz, bell-shaped, with air. Place to END on the
|
|
72
|
+
* cut. `reverb: 0` for a dry voice (glue with one shared reverb on the bus). */
|
|
73
|
+
export function whoosh(o = {}) {
|
|
74
|
+
const dur = o.duration ?? 0.5, gain = o.gain ?? 0.3, rand = rng(o.seed ?? 1), tune = o.tune ?? 220;
|
|
75
|
+
const n = Math.floor(dur * SR), dry = new Float32Array(n);
|
|
76
|
+
let hpState = 0, lpState = 0, lpState2 = 0, ph = 0;
|
|
77
|
+
for (let i = 0; i < n; i++) {
|
|
78
|
+
const k = i / n;
|
|
79
|
+
const fc = 300 + 2600 * k * k; // band centre sweeps up (capped lower = less fizz)
|
|
80
|
+
const aH = 1 - Math.exp((-2 * Math.PI * fc) / SR);
|
|
81
|
+
const aL = 1 - Math.exp((-2 * Math.PI * (fc * 2.2)) / SR);
|
|
82
|
+
const x = rand() * 2 - 1;
|
|
83
|
+
hpState += aH * (x - hpState); // highpass = x − lp
|
|
84
|
+
const hp = x - hpState;
|
|
85
|
+
lpState += aL * (hp - lpState); // two-pole lowpass (12 dB/oct) →
|
|
86
|
+
lpState2 += aL * (lpState - lpState2); // steeper roll-off = smooth, not grainy
|
|
87
|
+
const f = tune * (0.5 + 1.5 * k * k);
|
|
88
|
+
ph += (2 * Math.PI * f) / SR; // "vwoom", tuned
|
|
89
|
+
const tone = Math.sin(ph) * 0.22;
|
|
90
|
+
const env = Math.pow(Math.sin(Math.PI * Math.min(1, k / 0.96)), 1.4); // bell
|
|
91
|
+
dry[i] = (lpState2 * 1.1 + tone) * env * gain;
|
|
92
|
+
}
|
|
93
|
+
return spatialize(dry, o.pan ?? 0, o.reverb ?? 0.28, 0.32);
|
|
94
|
+
}
|
|
95
|
+
/** A thud on the cut: sub sine drop (tuned low, around `tune`) + a filtered noise
|
|
96
|
+
* body + a click transient, with a tail. Subtle by default. */
|
|
97
|
+
export function impact(o = {}) {
|
|
98
|
+
const dur = o.duration ?? 0.3, gain = o.gain ?? 0.4, rand = rng(o.seed ?? 2), tune = o.tune ?? 220;
|
|
99
|
+
const n = Math.floor(dur * SR), dry = new Float32Array(n);
|
|
100
|
+
let ph = 0, prev = 0, lp = 0, lp2 = 0;
|
|
101
|
+
const aBody = 1 - Math.exp((-2 * Math.PI * 900) / SR); // LOWPASS the body (round thump, not bright hiss)
|
|
102
|
+
for (let i = 0; i < n; i++) {
|
|
103
|
+
const t = i / SR;
|
|
104
|
+
const f = tune * 0.26 + tune * 0.32 * Math.exp(-t / 0.025);
|
|
105
|
+
ph += (2 * Math.PI * f) / SR;
|
|
106
|
+
const sub = Math.sin(ph) * Math.exp(-t / 0.12);
|
|
107
|
+
const x = rand() * 2 - 1;
|
|
108
|
+
lp += aBody * (x - lp);
|
|
109
|
+
lp2 += aBody * (lp - lp2); // 2-pole lowpassed noise
|
|
110
|
+
const body = lp2 * Math.exp(-t / 0.05) * 0.7;
|
|
111
|
+
const clk = i < 0.004 * SR ? (x - prev) * 0.4 : 0;
|
|
112
|
+
prev = x; // brief click only
|
|
113
|
+
dry[i] = (sub + body + clk) * gain;
|
|
114
|
+
}
|
|
115
|
+
return spatialize(dry, o.pan ?? 0, o.reverb ?? 0.22, 0.36);
|
|
116
|
+
}
|
|
117
|
+
/** An uplifter into a big moment: a noise band + rising tone (tuned), swelling. */
|
|
118
|
+
export function riser(o = {}) {
|
|
119
|
+
const dur = o.duration ?? 1.2, gain = o.gain ?? 0.3, rand = rng(o.seed ?? 3), tune = o.tune ?? 220;
|
|
120
|
+
const n = Math.floor(dur * SR), dry = new Float32Array(n);
|
|
121
|
+
let hpState = 0, lpState = 0, lpState2 = 0, ph = 0;
|
|
122
|
+
for (let i = 0; i < n; i++) {
|
|
123
|
+
const k = i / n;
|
|
124
|
+
const fc = 350 + 2800 * k;
|
|
125
|
+
const aH = 1 - Math.exp((-2 * Math.PI * fc) / SR);
|
|
126
|
+
const aL = 1 - Math.exp((-2 * Math.PI * (fc * 2.2)) / SR);
|
|
127
|
+
const x = rand() * 2 - 1;
|
|
128
|
+
hpState += aH * (x - hpState);
|
|
129
|
+
const hp = x - hpState;
|
|
130
|
+
lpState += aL * (hp - lpState);
|
|
131
|
+
lpState2 += aL * (lpState - lpState2); // 2-pole, smoother
|
|
132
|
+
const f = tune * (0.7 + 1.3 * k * k);
|
|
133
|
+
ph += (2 * Math.PI * f) / SR;
|
|
134
|
+
const tone = Math.sin(ph) * 0.28;
|
|
135
|
+
const env = k * k * gain;
|
|
136
|
+
dry[i] = (lpState2 * 1.05 + tone) * env;
|
|
137
|
+
}
|
|
138
|
+
return spatialize(dry, o.pan ?? 0, o.reverb ?? 0.3, 0.4);
|
|
139
|
+
}
|
|
140
|
+
/** A bright snap for a scale-in/bounce: a quick pitched blip (tuned high, around
|
|
141
|
+
* 2× `tune`) + a click + air. */
|
|
142
|
+
export function pop(o = {}) {
|
|
143
|
+
const dur = o.duration ?? 0.1, gain = o.gain ?? 0.3, rand = rng(o.seed ?? 4), tune = o.tune ?? 220;
|
|
144
|
+
const n = Math.floor(dur * SR), dry = new Float32Array(n);
|
|
145
|
+
let ph = 0, prev = 0;
|
|
146
|
+
for (let i = 0; i < n; i++) {
|
|
147
|
+
const t = i / SR;
|
|
148
|
+
const f = tune * 2 + tune * 4 * Math.exp(-t / 0.015);
|
|
149
|
+
ph += (2 * Math.PI * f) / SR;
|
|
150
|
+
const tone = Math.sin(ph) * Math.exp(-t / 0.03);
|
|
151
|
+
const x = rand() * 2 - 1;
|
|
152
|
+
const clk = i < 0.006 * SR ? (x - prev) * 0.6 : 0;
|
|
153
|
+
prev = x;
|
|
154
|
+
dry[i] = (tone * 0.7 + clk) * gain;
|
|
155
|
+
}
|
|
156
|
+
return spatialize(dry, o.pan ?? 0, o.reverb ?? 0.18, 0.2);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* "Glue" a stereo SFX bus into one cohesive layer: a single SHARED reverb (so
|
|
160
|
+
* every SFX sits in the same space) + light saturation. Run this once on the
|
|
161
|
+
* summed bus AFTER placing dry SFX — the cohesion fix. In place.
|
|
162
|
+
*/
|
|
163
|
+
export function glueBus(L, R, opts = {}) {
|
|
164
|
+
const space = opts.space ?? 0.25, drive = opts.drive ?? 0.15;
|
|
165
|
+
if (space > 0) {
|
|
166
|
+
const wl = reverbMono(L), wr = reverbMono(R);
|
|
167
|
+
for (let i = 0; i < L.length; i++) {
|
|
168
|
+
L[i] += wl[i] * space;
|
|
169
|
+
R[i] += wr[i] * space;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const d = 1 + drive * 2;
|
|
173
|
+
for (let i = 0; i < L.length; i++) {
|
|
174
|
+
L[i] = Math.tanh(L[i] * d);
|
|
175
|
+
R[i] = Math.tanh(R[i] * d);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/** A low whump after an impact — sine dropping in pitch. */
|
|
179
|
+
export function subDrop(o = {}) {
|
|
180
|
+
const dur = o.duration ?? 0.6, gain = o.gain ?? 0.4;
|
|
181
|
+
const n = Math.floor(dur * SR), dry = new Float32Array(n);
|
|
182
|
+
let ph = 0;
|
|
183
|
+
for (let i = 0; i < n; i++) {
|
|
184
|
+
const t = i / SR;
|
|
185
|
+
const f = 70 * Math.exp(-t / 0.25) + 28;
|
|
186
|
+
ph += (2 * Math.PI * f) / SR;
|
|
187
|
+
dry[i] = Math.sin(ph) * Math.exp(-t / 0.3) * gain;
|
|
188
|
+
}
|
|
189
|
+
return spatialize(dry, 0, 0.15, 0.3);
|
|
190
|
+
}
|
|
191
|
+
/** A tiny UI tick/tap — a short high blip + click. For small reveals/counters. */
|
|
192
|
+
export function tick(o = {}) {
|
|
193
|
+
const gain = o.gain ?? 0.25, rand = rng(o.seed ?? 5), tune = o.tune ?? 220;
|
|
194
|
+
const n = Math.floor(0.05 * SR), dry = new Float32Array(n);
|
|
195
|
+
let ph = 0, prev = 0;
|
|
196
|
+
for (let i = 0; i < n; i++) {
|
|
197
|
+
const t = i / SR;
|
|
198
|
+
ph += (2 * Math.PI * tune * 4) / SR;
|
|
199
|
+
const tone = Math.sin(ph) * Math.exp(-t / 0.01);
|
|
200
|
+
const x = rand() * 2 - 1;
|
|
201
|
+
const clk = i < 0.003 * SR ? (x - prev) * 0.6 : 0;
|
|
202
|
+
prev = x;
|
|
203
|
+
dry[i] = (tone * 0.5 + clk) * gain;
|
|
204
|
+
}
|
|
205
|
+
return spatialize(dry, o.pan ?? 0, o.reverb ?? 0.1, 0.12);
|
|
206
|
+
}
|
|
207
|
+
/** Cinematic dread hit — a detuned low brass/saw cluster (root+fifth+octave) +
|
|
208
|
+
* sub + noise rasp, slow swell, heavy saturation, long tail. Power & weight. */
|
|
209
|
+
export function braam(o = {}) {
|
|
210
|
+
const dur = o.duration ?? 1.6, gain = o.gain ?? 0.5, rand = rng(o.seed ?? 6), tune = o.tune ?? 110;
|
|
211
|
+
const n = Math.floor(dur * SR), dry = new Float32Array(n);
|
|
212
|
+
const freqs = [tune * 0.5, tune, tune * 1.498, tune * 2];
|
|
213
|
+
const det = [0, 0.4, -0.3, 0.6];
|
|
214
|
+
const phs = freqs.map(() => 0);
|
|
215
|
+
let lp = 0, lp2 = 0;
|
|
216
|
+
for (let i = 0; i < n; i++) {
|
|
217
|
+
const k = i / n;
|
|
218
|
+
let v = 0;
|
|
219
|
+
for (let j = 0; j < freqs.length; j++) {
|
|
220
|
+
phs[j] += (2 * Math.PI * (freqs[j] + det[j])) / SR;
|
|
221
|
+
v += Math.sin(phs[j]) + 0.4 * Math.sin(2 * phs[j]) + 0.2 * Math.sin(3 * phs[j]); // brassy harmonics
|
|
222
|
+
}
|
|
223
|
+
v /= freqs.length;
|
|
224
|
+
// rasp: LOWPASSED noise (a soft growl), not bright hiss
|
|
225
|
+
const x = rand() * 2 - 1;
|
|
226
|
+
lp += 0.06 * (x - lp);
|
|
227
|
+
lp2 += 0.06 * (lp - lp2);
|
|
228
|
+
const rasp = lp2 * 0.5;
|
|
229
|
+
const env = Math.min(1, k / 0.25) * Math.min(1, (1 - k) / 0.3);
|
|
230
|
+
dry[i] = Math.tanh((v * 0.5 + rasp) * env * 1.7) * gain; // moderate drive (less harsh)
|
|
231
|
+
}
|
|
232
|
+
return spatialize(dry, 0, o.reverb ?? 0.4, 0.6);
|
|
233
|
+
}
|
|
234
|
+
/** A downer — noise band + tone pitching DOWN, falling away. Scene exit / release. */
|
|
235
|
+
export function downlifter(o = {}) {
|
|
236
|
+
const dur = o.duration ?? 1.0, gain = o.gain ?? 0.3, rand = rng(o.seed ?? 7), tune = o.tune ?? 220;
|
|
237
|
+
const n = Math.floor(dur * SR), dry = new Float32Array(n);
|
|
238
|
+
let hpState = 0, lpState = 0, lpState2 = 0, ph = 0;
|
|
239
|
+
for (let i = 0; i < n; i++) {
|
|
240
|
+
const k = i / n;
|
|
241
|
+
const fc = 3000 - 2500 * k;
|
|
242
|
+
const aH = 1 - Math.exp((-2 * Math.PI * fc) / SR);
|
|
243
|
+
const aL = 1 - Math.exp((-2 * Math.PI * (fc * 2.2)) / SR);
|
|
244
|
+
const x = rand() * 2 - 1;
|
|
245
|
+
hpState += aH * (x - hpState);
|
|
246
|
+
const hp = x - hpState;
|
|
247
|
+
lpState += aL * (hp - lpState);
|
|
248
|
+
lpState2 += aL * (lpState - lpState2);
|
|
249
|
+
const f = tune * (2 - 1.3 * k);
|
|
250
|
+
ph += (2 * Math.PI * Math.max(40, f)) / SR;
|
|
251
|
+
const tone = Math.sin(ph) * 0.28;
|
|
252
|
+
const env = Math.min(1, k / 0.03) * Math.pow(1 - k, 0.9) * gain;
|
|
253
|
+
dry[i] = (lpState2 * 1.05 + tone) * env;
|
|
254
|
+
}
|
|
255
|
+
return spatialize(dry, o.pan ?? 0, o.reverb ?? 0.3, 0.4);
|
|
256
|
+
}
|
|
257
|
+
/** A wide resonant filter sweep — noise through a state-variable bandpass whose
|
|
258
|
+
* cutoff sweeps up, panned across the field. A clean transition wash. */
|
|
259
|
+
export function sweep(o = {}) {
|
|
260
|
+
const dur = o.duration ?? 0.6, gain = o.gain ?? 0.3, rand = rng(o.seed ?? 8);
|
|
261
|
+
const n = Math.floor(dur * SR), dry = new Float32Array(n);
|
|
262
|
+
let low = 0, band = 0;
|
|
263
|
+
const q = 0.6; // lower = more resonant
|
|
264
|
+
for (let i = 0; i < n; i++) {
|
|
265
|
+
const k = i / n;
|
|
266
|
+
const fc = 200 + 7000 * k * k;
|
|
267
|
+
const f = 2 * Math.sin((Math.PI * fc) / SR);
|
|
268
|
+
const x = rand() * 2 - 1;
|
|
269
|
+
const high = x - low - q * band;
|
|
270
|
+
band += f * high;
|
|
271
|
+
low += f * band;
|
|
272
|
+
const env = Math.pow(Math.sin(Math.PI * Math.min(1, k / 0.95)), 1.3) * gain;
|
|
273
|
+
dry[i] = band * env;
|
|
274
|
+
}
|
|
275
|
+
return spatialize(dry, [-0.7, 0.7], o.reverb ?? 0.25, 0.3);
|
|
276
|
+
}
|
|
277
|
+
/** A digital glitch/stutter — bitcrushed + sample-held tone+noise, gated into
|
|
278
|
+
* retriggered slices. Dry-ish, modern/tech. */
|
|
279
|
+
export function glitch(o = {}) {
|
|
280
|
+
const dur = o.duration ?? 0.25, gain = o.gain ?? 0.3, rand = rng(o.seed ?? 9), tune = o.tune ?? 220;
|
|
281
|
+
const n = Math.floor(dur * SR), dry = new Float32Array(n);
|
|
282
|
+
const hold = 90; // sample-hold (downsample) → digital aliasing
|
|
283
|
+
const levels = 6; // bitcrush quantization
|
|
284
|
+
const slice = Math.floor(0.03 * SR); // stutter slice length
|
|
285
|
+
let held = 0, ph = 0;
|
|
286
|
+
for (let i = 0; i < n; i++) {
|
|
287
|
+
const posInSlice = i % slice;
|
|
288
|
+
if (i % hold === 0) {
|
|
289
|
+
ph += (2 * Math.PI * tune * 2 * hold) / SR;
|
|
290
|
+
const tone = Math.sin(ph) * 0.5;
|
|
291
|
+
const noise = (rand() * 2 - 1) * 0.5;
|
|
292
|
+
held = Math.round((tone + noise) * levels) / levels;
|
|
293
|
+
}
|
|
294
|
+
// gate: each slice fades fast → stutter feel
|
|
295
|
+
const gate = posInSlice < slice * 0.6 ? 1 : 0;
|
|
296
|
+
dry[i] = held * gate * gain;
|
|
297
|
+
}
|
|
298
|
+
return spatialize(dry, o.pan ?? 0, 0.08, 0.12);
|
|
299
|
+
}
|
|
300
|
+
/** A bright sparkle for reveals — stacked high partials (octaves + fifths) with
|
|
301
|
+
* tremolo and a long bright tail. The "premium" sheen. */
|
|
302
|
+
export function shimmer(o = {}) {
|
|
303
|
+
const dur = o.duration ?? 1.0, gain = o.gain ?? 0.22, tune = o.tune ?? 220;
|
|
304
|
+
const n = Math.floor(dur * SR), dry = new Float32Array(n);
|
|
305
|
+
const parts = [tune * 2, tune * 3, tune * 4, tune * 6, tune * 8];
|
|
306
|
+
const phs = parts.map(() => 0);
|
|
307
|
+
for (let i = 0; i < n; i++) {
|
|
308
|
+
const t = i / SR, k = i / n;
|
|
309
|
+
let v = 0;
|
|
310
|
+
for (let j = 0; j < parts.length; j++) {
|
|
311
|
+
phs[j] += (2 * Math.PI * parts[j]) / SR;
|
|
312
|
+
v += Math.sin(phs[j]) / (j + 1);
|
|
313
|
+
}
|
|
314
|
+
const trem = 0.7 + 0.3 * Math.sin(2 * Math.PI * 7 * t);
|
|
315
|
+
const env = Math.min(1, k / 0.1) * Math.pow(1 - k, 0.6) * gain * trem;
|
|
316
|
+
dry[i] = v * env;
|
|
317
|
+
}
|
|
318
|
+
return spatialize(dry, 0, o.reverb ?? 0.45, 0.7);
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=sfx.js.map
|
package/dist/sfx.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sfx.js","sourceRoot":"","sources":["../src/sfx.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,4EAA4E;AAC5E,iFAAiF;AACjF,0EAA0E;AAC1E,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,kFAAkF;AAClF,gEAAgE;AAEhE,MAAM,EAAE,GAAG,KAAK,CAAC;AAWjB,SAAS,GAAG,CAAC,IAAY;IACvB,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC;IACnB,OAAO,GAAG,EAAE;QACV,CAAC,IAAI,CAAC,CAAC;QAAC,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;Q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I,GAAG,IAAI,CAAC;QACtE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IACnB,CAAC;IACD,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,IAAI,IAAI,EAAE,GAAG,CAAC,CAAC;AACnD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@clipkit/sfx",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Standalone sound-effects engine for Clipkit — procedural SFX synthesis (whoosh/impact/riser/UI/glitch/…), a pro finishing chain, and a browsable named catalog. Pure DSP, no dependencies; used by @clipkit/score (sound design) and by the editor (an audio tab to browse/preview SFX).",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": { "type": "git", "url": "git+https://github.com/clipkit-video/clipkit.git", "directory": "packages/sfx" },
|
|
7
|
+
"homepage": "https://clipkit.dev",
|
|
8
|
+
"bugs": "https://github.com/clipkit-video/clipkit/issues",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": { ".": { "import": "./dist/index.js", "types": "./dist/index.d.ts" } },
|
|
13
|
+
"files": ["dist", "README.md", "LICENSE"],
|
|
14
|
+
"scripts": { "build": "tsc", "dev": "tsc --watch", "typecheck": "tsc --noEmit", "clean": "rm -rf dist" },
|
|
15
|
+
"dependencies": {},
|
|
16
|
+
"devDependencies": { "@types/node": "^22.0.0", "typescript": "^5.7.3" }
|
|
17
|
+
}
|