@popcraft/kit 0.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/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/index.js +160558 -0
- package/package.json +40 -0
- package/types/design-script.d.ts +39 -0
- package/types/lib/agent/design-script/build.d.ts +35 -0
- package/types/lib/agent/design-script/check.d.ts +11 -0
- package/types/lib/agent/design-script/helper-names.d.ts +1 -0
- package/types/lib/agent/design-script/kit-modules.d.ts +43 -0
- package/types/lib/agent/design-script/recorder.d.ts +52 -0
- package/types/lib/agent/design-script/replay.d.ts +13 -0
- package/types/lib/agent/design-script/run-node.d.ts +2 -0
- package/types/lib/ai/audio-models.d.ts +66 -0
- package/types/lib/ai/content.d.ts +27 -0
- package/types/lib/ai/limits.d.ts +42 -0
- package/types/lib/audio/presentation/loudness.d.ts +80 -0
- package/types/lib/audio/presentation/types.d.ts +112 -0
- package/types/lib/brand/apply.d.ts +25 -0
- package/types/lib/brand/review-kits.d.ts +10 -0
- package/types/lib/brand/types.d.ts +20 -0
- package/types/lib/code/hash.d.ts +2 -0
- package/types/lib/document/auto-layout.d.ts +10 -0
- package/types/lib/document/breakpoints.d.ts +45 -0
- package/types/lib/document/clone.d.ts +6 -0
- package/types/lib/document/color.d.ts +52 -0
- package/types/lib/document/detach.d.ts +12 -0
- package/types/lib/document/effects.d.ts +60 -0
- package/types/lib/document/expressions.d.ts +78 -0
- package/types/lib/document/instance-layout.d.ts +94 -0
- package/types/lib/document/instances.d.ts +63 -0
- package/types/lib/document/libraries.d.ts +97 -0
- package/types/lib/document/node-delta.d.ts +21 -0
- package/types/lib/document/page-tokens.d.ts +16 -0
- package/types/lib/document/photo-frames.d.ts +14 -0
- package/types/lib/document/print-pages.d.ts +85 -0
- package/types/lib/document/scene-graph.d.ts +194 -0
- package/types/lib/document/scene3d.d.ts +76 -0
- package/types/lib/document/shader-graph-effects.d.ts +8 -0
- package/types/lib/document/shader-graph.d.ts +134 -0
- package/types/lib/document/shader-params.d.ts +65 -0
- package/types/lib/document/shape-to-path.d.ts +20 -0
- package/types/lib/document/text-styles.d.ts +28 -0
- package/types/lib/document/text-tokens.d.ts +6 -0
- package/types/lib/document/transform.d.ts +79 -0
- package/types/lib/document/transform3d.d.ts +99 -0
- package/types/lib/document/trim.d.ts +35 -0
- package/types/lib/document/types.d.ts +2560 -0
- package/types/lib/document/variables.d.ts +14 -0
- package/types/lib/editor/easing.d.ts +46 -0
- package/types/lib/editor/modes/types.d.ts +131 -0
- package/types/lib/editor/prototype-connect.d.ts +49 -0
- package/types/lib/editor/smart-animate.d.ts +37 -0
- package/types/lib/engine/geometry/flatten.d.ts +2 -0
- package/types/lib/engine/geometry/shape-outline.d.ts +24 -0
- package/types/lib/engine/pixel/cells.d.ts +12 -0
- package/types/lib/engine/pixel/palettes.d.ts +25 -0
- package/types/lib/engine/readiness.d.ts +20 -0
- package/types/lib/engine/routing.d.ts +41 -0
- package/types/lib/engine/shader-graph-presets.d.ts +22 -0
- package/types/lib/engine/shader-presets-legacy.d.ts +7 -0
- package/types/lib/engine/shader-presets.d.ts +43 -0
- package/types/lib/engine/text/atlas.d.ts +120 -0
- package/types/lib/engine/text/emoji/segment.d.ts +15 -0
- package/types/lib/engine/text/fallback-fonts.d.ts +47 -0
- package/types/lib/engine/text/fontkit-lazy.d.ts +8 -0
- package/types/lib/engine/text/fonts.d.ts +33 -0
- package/types/lib/engine/text/glyph-linear.d.ts +22 -0
- package/types/lib/engine/text/google-fonts.d.ts +17 -0
- package/types/lib/engine/text/hyphenate/en-us.d.ts +6 -0
- package/types/lib/engine/text/hyphenate/liang.d.ts +21 -0
- package/types/lib/engine/text/layout-access.d.ts +16 -0
- package/types/lib/engine/text/layout.d.ts +168 -0
- package/types/lib/engine/text/lists.d.ts +16 -0
- package/types/lib/engine/text/measure.d.ts +58 -0
- package/types/lib/engine/text/outline-sdf.d.ts +34 -0
- package/types/lib/engine/text/shaper.d.ts +88 -0
- package/types/lib/engine/text/text-area.d.ts +16 -0
- package/types/lib/engine/text/text-fit.d.ts +51 -0
- package/types/lib/engine/text/text-path.d.ts +134 -0
- package/types/lib/engine/text/text-rings.d.ts +17 -0
- package/types/lib/engine/text/wrap-obstacles.d.ts +20 -0
- package/types/lib/i18n/catalogs.d.ts +10 -0
- package/types/lib/i18n/format.d.ts +27 -0
- package/types/lib/i18n/locales.d.ts +25 -0
- package/types/lib/i18n/pseudo.d.ts +10 -0
- package/types/lib/i18n/runtime.d.ts +27 -0
- package/types/lib/io/codecs/wav.d.ts +7 -0
- package/types/lib/io/codecs/webp.d.ts +7 -0
- package/types/lib/io/export-ir/children.d.ts +2 -0
- package/types/lib/io/json-export.d.ts +11 -0
- package/types/lib/media-library/types.d.ts +39 -0
- package/types/lib/motion/audio-analysis.d.ts +44 -0
- package/types/lib/motion/audio-clips.d.ts +92 -0
- package/types/lib/motion/audio-onsets.d.ts +13 -0
- package/types/lib/motion/audio-signals.d.ts +59 -0
- package/types/lib/motion/author.d.ts +80 -0
- package/types/lib/motion/composition.d.ts +99 -0
- package/types/lib/motion/instances.d.ts +95 -0
- package/types/lib/motion/key-selection.d.ts +100 -0
- package/types/lib/motion/keys.d.ts +41 -0
- package/types/lib/motion/layer-time-edit.d.ts +40 -0
- package/types/lib/motion/markers.d.ts +31 -0
- package/types/lib/motion/modifier-edit.d.ts +84 -0
- package/types/lib/motion/modifiers.d.ts +44 -0
- package/types/lib/motion/morph.d.ts +14 -0
- package/types/lib/motion/pose-layout.d.ts +6 -0
- package/types/lib/motion/pose.d.ts +115 -0
- package/types/lib/motion/presets.d.ts +148 -0
- package/types/lib/motion/properties.d.ts +74 -0
- package/types/lib/motion/sample-keys.d.ts +8 -0
- package/types/lib/motion/sample.d.ts +51 -0
- package/types/lib/motion/sound.d.ts +25 -0
- package/types/lib/motion/spatial-curve.d.ts +15 -0
- package/types/lib/motion/spatial.d.ts +38 -0
- package/types/lib/motion/text-animators.d.ts +79 -0
- package/types/lib/motion/text-units.d.ts +47 -0
- package/types/lib/motion/time.d.ts +58 -0
- package/types/lib/motion/transitions.d.ts +99 -0
- package/types/lib/motion/values.d.ts +12 -0
- package/types/lib/motion/video-clip.d.ts +63 -0
- package/types/lib/presets/page-presets.d.ts +50 -0
- package/types/lib/storage/media-hash.d.ts +4 -0
- package/types/lib/storage/media-refs.d.ts +2 -0
- package/types/lib/storage/media-store.d.ts +70 -0
- package/types/lib/templates/apply.d.ts +38 -0
- package/types/lib/templates/capture.d.ts +25 -0
- package/types/lib/templates/groups.d.ts +82 -0
- package/types/lib/templates/layout.d.ts +20 -0
- package/types/lib/templates/quality.d.ts +59 -0
- package/types/lib/templates/resize.d.ts +34 -0
- package/types/lib/templates/safe-areas.d.ts +42 -0
- package/types/lib/templates/text-measurer.d.ts +10 -0
- package/types/lib/templates/thumbnail.d.ts +134 -0
- package/types/lib/templates/types.d.ts +95 -0
- package/types/lib/templates/vocabulary.d.ts +50 -0
- package/types/lib/units/units.d.ts +23 -0
- package/types/packages/kit/src/index.d.ts +59 -0
- package/types/packages/runtime/src/expressions.d.ts +41 -0
- package/types/templates/src/app/shared.d.ts +29 -0
- package/types/templates/src/audio/beat-loop.d.ts +9 -0
- package/types/templates/src/audio/media.d.ts +42 -0
- package/types/templates/src/audio/music-synth.d.ts +57 -0
- package/types/templates/src/audio/music-worlds.d.ts +8 -0
- package/types/templates/src/audio/music.d.ts +19 -0
- package/types/templates/src/audio/studio/deck.d.ts +340 -0
- package/types/templates/src/audio/studio/dsp.d.ts +151 -0
- package/types/templates/src/audio/studio/fx.d.ts +96 -0
- package/types/templates/src/audio/studio/mix.d.ts +84 -0
- package/types/templates/src/audio/studio/voices.d.ts +120 -0
- package/types/templates/src/data/geometry.d.ts +16 -0
- package/types/templates/src/effects/shared.d.ts +17 -0
- package/types/templates/src/kit.d.ts +582 -0
- package/types/templates/src/motion3d/devices.d.ts +42 -0
- package/types/templates/src/motion3d/ui.d.ts +48 -0
- package/types/templates/src/saas/video-shared.d.ts +114 -0
- package/types/templates/src/saas/web-shared.d.ts +74 -0
- package/types/templates/src/shared/beat.d.ts +24 -0
- package/types/templates/src/shared/captions.d.ts +24 -0
- package/types/templates/src/shared/devices.d.ts +188 -0
- package/types/templates/src/shared/draw.d.ts +43 -0
- package/types/templates/src/shared/fit.d.ts +73 -0
- package/types/templates/src/shared/marks.d.ts +51 -0
- package/types/templates/src/shared/motion.d.ts +15 -0
- package/types/templates/src/shared/overlays.d.ts +80 -0
- package/types/templates/src/shared/pointer.d.ts +46 -0
- package/types/templates/src/shared/texture.d.ts +41 -0
- package/types/templates/src/shared/type.d.ts +6 -0
- package/types/templates/src/shared/window.d.ts +50 -0
- package/types/templates/src/social/shared.d.ts +66 -0
- package/types/templates/src/web/shared.d.ts +64 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { type Sig, type Stereo } from './dsp.js';
|
|
2
|
+
/** An AudioParam's timeline: the four calls the voices schedule with, rendered to a value a sample. */
|
|
3
|
+
export declare class Auto {
|
|
4
|
+
private ev;
|
|
5
|
+
/** setValueAtTime */
|
|
6
|
+
set(v: number, t: number): this;
|
|
7
|
+
/** linearRampToValueAtTime */
|
|
8
|
+
lin(v: number, t: number): this;
|
|
9
|
+
/** exponentialRampToValueAtTime */
|
|
10
|
+
exp(v: number, t: number): this;
|
|
11
|
+
/** setTargetAtTime */
|
|
12
|
+
target(v: number, t: number, tau: number): this;
|
|
13
|
+
render(n: number): Sig;
|
|
14
|
+
}
|
|
15
|
+
export type Wave = 'sine' | 'square' | 'sawtooth' | 'triangle';
|
|
16
|
+
/** DrumSynth.tish `makeDriveCurve` (and the channel drive of Deckard's Engine.tish). */
|
|
17
|
+
export declare const driveCurve: (amount: number) => (x: number) => number;
|
|
18
|
+
export interface TineParams {
|
|
19
|
+
bark?: number;
|
|
20
|
+
tine?: number;
|
|
21
|
+
tremolo?: number;
|
|
22
|
+
decay?: number;
|
|
23
|
+
drive?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Tine.tish `playTine`: a Rhodes. A sine carrier phase-modulated by a sine at the same pitch, whose depth spikes on
|
|
27
|
+
* the strike (by bark × velocity) and falls to a floor: bright where the hammer lands, mellow as it rings. A fast
|
|
28
|
+
* inharmonic ping for the hammer on the tine, a bloom in the level, a tube curve, and the suitcase's tremolo: two
|
|
29
|
+
* paths in anti-phase, one to each side. Stereo.
|
|
30
|
+
*/
|
|
31
|
+
export declare function tine(freq: number, v: number, dur: number, p?: TineParams): Stereo;
|
|
32
|
+
export interface GuitarParams {
|
|
33
|
+
/** 0…1: how far the pluck's noise is smoothed before it goes into the string. As in the source, 0 leaves it white (the brightest pluck) and 1 is the darkest. */
|
|
34
|
+
tone?: number;
|
|
35
|
+
decay?: number;
|
|
36
|
+
damping?: number;
|
|
37
|
+
drive?: number;
|
|
38
|
+
/** Hz of the body / cabinet low-pass. */
|
|
39
|
+
body?: number;
|
|
40
|
+
mute?: number;
|
|
41
|
+
/** Seconds after which the string is stopped (a port's addition: the source always lets it ring out). */
|
|
42
|
+
stop?: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Guitar.tish `playGuitar`: a plucked string by Karplus–Strong. One period of noise (shaped by `tone`) in a delay
|
|
46
|
+
* line fed back through a damping low-pass, then drive (pickup and amp), then a body low-pass.
|
|
47
|
+
*
|
|
48
|
+
* The source rounds the delay to whole samples; at 32 kHz that is up to 30 cents out of tune at the top of a guitar,
|
|
49
|
+
* so here the loop has an all-pass that makes up the fraction of a sample.
|
|
50
|
+
*/
|
|
51
|
+
export declare function guitar(freq: number, v: number, seed: number, p?: GuitarParams): Sig;
|
|
52
|
+
export type ArcoVoice = 'violin' | 'viola' | 'cello' | 'bass' | 'fiddle';
|
|
53
|
+
export interface ArcoParams {
|
|
54
|
+
voice?: ArcoVoice;
|
|
55
|
+
pressure?: number;
|
|
56
|
+
bow?: number;
|
|
57
|
+
vibrato?: number;
|
|
58
|
+
rosin?: number;
|
|
59
|
+
body?: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Arco.tish `playArco`: a bowed string. Two saws a few cents apart (a bowed string's stick-slip motion is a saw), a
|
|
63
|
+
* low-pass that bow pressure opens, then the body: peaking resonances for the air, the wood and the bridge hill,
|
|
64
|
+
* scaled to the instrument's size. Rosin noise loud where the bow catches, then a quiet scratch. Vibrato that swells
|
|
65
|
+
* in after the attack. `rate` (a port's addition) sets each player's own vibrato speed, so a section does not wobble as one.
|
|
66
|
+
*/
|
|
67
|
+
export declare function arco(freq: number, v: number, dur: number, seed: number, p?: ArcoParams & {
|
|
68
|
+
rate?: number;
|
|
69
|
+
}): Sig;
|
|
70
|
+
/** Bell.tish `playBell`: two sines, the second at an inharmonic `partial`, through a high-pass, with a bell's fall. */
|
|
71
|
+
export declare function bell(freq: number, v: number, p?: {
|
|
72
|
+
partial?: number;
|
|
73
|
+
highpass?: number;
|
|
74
|
+
decay?: number;
|
|
75
|
+
}): Sig;
|
|
76
|
+
export interface HaloParams {
|
|
77
|
+
temper?: number;
|
|
78
|
+
ring?: number;
|
|
79
|
+
mallet?: number;
|
|
80
|
+
bloom?: number;
|
|
81
|
+
lows?: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Halo.tish `playHalo`: a handpan. Fundamental, octave and compound fifth, each a PAIR of sines a few cents apart so
|
|
85
|
+
* it beats; the octave and fifth tuned a little off and swelling after the strike before they fall (the bloom), faster
|
|
86
|
+
* than the fundamental; a warm sub under it, a fingertip's tick. Here each pair's two sines go one to each side (a
|
|
87
|
+
* port's addition), so the beating moves across the field.
|
|
88
|
+
*/
|
|
89
|
+
export declare function halo(freq: number, v: number, seed: number, p?: HaloParams): Stereo;
|
|
90
|
+
/** Cymbal.tish `playCymbal`: six squares at the TR-808's inharmonic ratios, mixed with noise, through a high-pass. */
|
|
91
|
+
export declare function cymbal(v: number, seed: number, p?: {
|
|
92
|
+
tune?: number;
|
|
93
|
+
metallic?: number;
|
|
94
|
+
decay?: number;
|
|
95
|
+
highpass?: number;
|
|
96
|
+
}): Sig;
|
|
97
|
+
export interface ClapParams {
|
|
98
|
+
hands?: number;
|
|
99
|
+
spread?: number;
|
|
100
|
+
size?: number;
|
|
101
|
+
tone?: number;
|
|
102
|
+
claps?: number;
|
|
103
|
+
gap?: number;
|
|
104
|
+
tail?: number;
|
|
105
|
+
body?: number;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Clap.tish `playClap`: a clap is a CLUSTER of very short band-passed bursts, one for each pair of hands, never quite
|
|
109
|
+
* together and never the same size, then the splat of the room and a soft thump under it.
|
|
110
|
+
*/
|
|
111
|
+
export declare function clap(v: number, seed: number, p?: ClapParams): Sig;
|
|
112
|
+
export interface DrumParams {
|
|
113
|
+
tone?: Wave;
|
|
114
|
+
pitchEnv?: number;
|
|
115
|
+
pitchDecay?: number;
|
|
116
|
+
decay?: number;
|
|
117
|
+
noise?: number;
|
|
118
|
+
noiseDecay?: number;
|
|
119
|
+
noiseHp?: number;
|
|
120
|
+
drive?: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* DrumSynth.tish `playDrumSynth`: a pitched body that DROPS (`pitchEnv` semitones above the note, falling over
|
|
124
|
+
* `pitchDecay`), its own decay, a noise layer for the snap, and drive. Kicks, snares, toms, timpani.
|
|
125
|
+
*/
|
|
126
|
+
export declare function drum(freq: number, v: number, seed: number, p?: DrumParams): Sig;
|
|
127
|
+
/** BuiltinMacros.tish `kick_edm`: a sine whose pitch falls exponentially from `pitch` Hz toward nothing over `decay`, the level with it. */
|
|
128
|
+
export declare function kickEdm(pitch?: number, decay?: number): Sig;
|
|
129
|
+
/** BuiltinMacros.tish `kick_deep`: a triangle from `pitch` down to `end` Hz. */
|
|
130
|
+
export declare function kickDeep(pitch?: number, end?: number, decay?: number): Sig;
|
|
131
|
+
/** NoiseBurst.tish `playNoiseBurst`: band-passed noise with a rise and a fall. Hats, and (with a long rise) risers. */
|
|
132
|
+
export declare function noiseBurst(freq: number, v: number, dur: number, seed: number, p?: {
|
|
133
|
+
decay?: number;
|
|
134
|
+
tone?: number;
|
|
135
|
+
pitchFollow?: number;
|
|
136
|
+
attack?: number;
|
|
137
|
+
}): Sig;
|
|
138
|
+
/** Sub808.tish `playSub808`: a sine that starts `punch` Hz high and settles, with a long tail and optional drive. */
|
|
139
|
+
export declare function sub808(freq: number, v: number, p?: {
|
|
140
|
+
punch?: number;
|
|
141
|
+
decay?: number;
|
|
142
|
+
drive?: number;
|
|
143
|
+
}): Sig;
|
|
144
|
+
/** Acid303.tish `playAcid303`: an oscillator through a resonant low-pass whose cutoff starts `envMod` × velocity up and falls. */
|
|
145
|
+
export declare function acid(freq: number, v: number, p?: {
|
|
146
|
+
wave?: Wave;
|
|
147
|
+
cutoff?: number;
|
|
148
|
+
resonance?: number;
|
|
149
|
+
envMod?: number;
|
|
150
|
+
decay?: number;
|
|
151
|
+
}): Sig;
|
|
152
|
+
/** ReeseBass.tish `playReeseBass`: detuned saws through a low-pass that an LFO can wobble. */
|
|
153
|
+
export declare function reese(freq: number, v: number, seed: number, p?: {
|
|
154
|
+
voices?: number;
|
|
155
|
+
detune?: number;
|
|
156
|
+
cutoff?: number;
|
|
157
|
+
wobble?: number;
|
|
158
|
+
decay?: number;
|
|
159
|
+
}): Sig;
|
|
160
|
+
/** Pad.tish `playPad`: two oscillators of different waves a few cents apart and a sub an octave down, detuned the other way, through a low-pass, slow in and out. */
|
|
161
|
+
export declare function pad(freq: number, v: number, dur: number, p?: {
|
|
162
|
+
detune?: number;
|
|
163
|
+
cutoff?: number;
|
|
164
|
+
attack?: number;
|
|
165
|
+
decay?: number;
|
|
166
|
+
sustain?: number;
|
|
167
|
+
release?: number;
|
|
168
|
+
wave1?: Wave;
|
|
169
|
+
wave2?: Wave;
|
|
170
|
+
}): Sig;
|
|
171
|
+
export interface AetherParams {
|
|
172
|
+
glide?: number;
|
|
173
|
+
waver?: number;
|
|
174
|
+
tone?: number;
|
|
175
|
+
swell?: number;
|
|
176
|
+
air?: number;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Aether.tish `playAether`: a theremin. Two sines a few cents apart (the heterodyne beat), swooping up into the note
|
|
180
|
+
* from below; a vibrato that builds in after the onset and whose depth is itself wobbled by a slow, unsteady hand; a
|
|
181
|
+
* tremolo on the same waver; odd harmonics for the throat; breath noise near the note; no transient anywhere.
|
|
182
|
+
*/
|
|
183
|
+
export declare function aether(freq: number, v: number, dur: number, seed: number, p?: AetherParams): Sig;
|
|
184
|
+
/** FormantVocal.tish `VOWEL_FORMANTS`: the first three formants (Hz) of each vowel. */
|
|
185
|
+
export declare const VOWELS: {
|
|
186
|
+
readonly I: readonly [270, 2290, 3010];
|
|
187
|
+
readonly IH: readonly [390, 1990, 2550];
|
|
188
|
+
readonly EY: readonly [400, 2100, 2800];
|
|
189
|
+
readonly E: readonly [530, 1840, 2480];
|
|
190
|
+
readonly AE: readonly [660, 1720, 2410];
|
|
191
|
+
readonly A: readonly [730, 1090, 2440];
|
|
192
|
+
readonly O: readonly [570, 840, 2410];
|
|
193
|
+
readonly OH: readonly [500, 910, 2450];
|
|
194
|
+
readonly OO: readonly [440, 1020, 2240];
|
|
195
|
+
readonly U: readonly [300, 870, 2240];
|
|
196
|
+
readonly UH: readonly [640, 1190, 2390];
|
|
197
|
+
readonly ER: readonly [490, 1350, 1690];
|
|
198
|
+
readonly UX: readonly [500, 1500, 2500];
|
|
199
|
+
};
|
|
200
|
+
export type Vowel = keyof typeof VOWELS;
|
|
201
|
+
/**
|
|
202
|
+
* FormantVocal.tish `playFormantVocal`: a voice. A saw for the glottis, gliding from the last note and with vibrato,
|
|
203
|
+
* through three narrow band-passes at the vowel's formants. `from` is the pitch it glides from.
|
|
204
|
+
*/
|
|
205
|
+
export declare function vocal(freq: number, v: number, dur: number, vowel?: Vowel, p?: {
|
|
206
|
+
release?: number;
|
|
207
|
+
vibDepth?: number;
|
|
208
|
+
vibRate?: number;
|
|
209
|
+
glide?: number;
|
|
210
|
+
from?: number;
|
|
211
|
+
phase?: number;
|
|
212
|
+
}): Sig;
|
|
213
|
+
export interface SyncChoirParams {
|
|
214
|
+
vowelShift?: number;
|
|
215
|
+
morphRate?: number;
|
|
216
|
+
morphAmt?: number;
|
|
217
|
+
ensembleDetune?: number;
|
|
218
|
+
vibRate?: number;
|
|
219
|
+
vibAmt?: number;
|
|
220
|
+
highpass?: number;
|
|
221
|
+
attack?: number;
|
|
222
|
+
decay?: number;
|
|
223
|
+
sustain?: number;
|
|
224
|
+
release?: number;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* SyncChoir.tish `playSyncChoir`: a choir from hard sync. Two sync oscillators, one to each side and a few cents
|
|
228
|
+
* apart; the slave sits `vowelShift` semitones over the note and an LFO moves it, so the formant it makes drifts from
|
|
229
|
+
* vowel to vowel; vibrato on the masters; a slow envelope. Stereo.
|
|
230
|
+
*/
|
|
231
|
+
export declare function syncChoir(freq: number, v: number, dur: number, p?: SyncChoirParams, phase?: number): Stereo;
|
|
232
|
+
/** FmTone.tish `playFmTone`: one modulator into one carrier, with an ADSR. */
|
|
233
|
+
export declare function fmTone(freq: number, v: number, dur: number, p?: {
|
|
234
|
+
ratio?: number;
|
|
235
|
+
modIndex?: number;
|
|
236
|
+
carrierWave?: Wave;
|
|
237
|
+
modWave?: Wave;
|
|
238
|
+
attack?: number;
|
|
239
|
+
decay?: number;
|
|
240
|
+
sustain?: number;
|
|
241
|
+
release?: number;
|
|
242
|
+
}): Sig;
|
|
243
|
+
interface MatrixGraph {
|
|
244
|
+
ops: Map<string, {
|
|
245
|
+
wave: Wave | 'noise';
|
|
246
|
+
ratio: number;
|
|
247
|
+
}>;
|
|
248
|
+
opEnv: Map<string, {
|
|
249
|
+
a: number;
|
|
250
|
+
d: number;
|
|
251
|
+
s: number;
|
|
252
|
+
r: number;
|
|
253
|
+
}>;
|
|
254
|
+
mods: {
|
|
255
|
+
type: 'fm' | 'rm';
|
|
256
|
+
src: string;
|
|
257
|
+
dst: string;
|
|
258
|
+
amount: number;
|
|
259
|
+
}[];
|
|
260
|
+
filters: Map<string, {
|
|
261
|
+
type: string;
|
|
262
|
+
cutoff: number;
|
|
263
|
+
res: number;
|
|
264
|
+
}>;
|
|
265
|
+
filterEnv: Map<string, {
|
|
266
|
+
a: number;
|
|
267
|
+
d: number;
|
|
268
|
+
s: number;
|
|
269
|
+
r: number;
|
|
270
|
+
amount: number;
|
|
271
|
+
}>;
|
|
272
|
+
routes: {
|
|
273
|
+
srcKind: 'op' | 'filter';
|
|
274
|
+
src: string;
|
|
275
|
+
dst: string | null;
|
|
276
|
+
volume: number;
|
|
277
|
+
}[];
|
|
278
|
+
}
|
|
279
|
+
/** A matrix-FM patch as its `gen_block matrix_fm` lines, parsed (MatrixFmGraph.tish). */
|
|
280
|
+
export declare function matrixPatch(lines: readonly string[]): MatrixGraph;
|
|
281
|
+
/**
|
|
282
|
+
* MatrixFm.tish `playMatrixFm`: a Sytrus-style operator matrix. Any number of operators (sine, saw, square, triangle
|
|
283
|
+
* or noise) at ratios of the note; FM edges (the source's depth: 0.12 × amount × the destination's frequency, in Hz)
|
|
284
|
+
* and ring-mod edges (× 0.4 × amount); an ADSR on every operator's output; low- and high-pass filters, 12 or 24 dB an
|
|
285
|
+
* octave, each with its own cutoff envelope; and a routing table of what is heard. As in the source, an operator
|
|
286
|
+
* modulates with its raw oscillator, before its envelope.
|
|
287
|
+
*/
|
|
288
|
+
export declare function matrixFm(freq: number, v: number, dur: number, g: MatrixGraph, seed?: number): Sig;
|
|
289
|
+
/**
|
|
290
|
+
* The factory patches used here, as Deckard ships them (tish-midi/src/model/MatrixFmPresets.tish `matrixFmPatches`).
|
|
291
|
+
* One line is added: `vibeMallet` routes its filter to the output. As shipped, the patch sends operator 1 (the bar's
|
|
292
|
+
* fundamental) into filter 1 and never takes the filter out, so only the ring-modulated click is heard.
|
|
293
|
+
*/
|
|
294
|
+
export declare const MATRIX: {
|
|
295
|
+
readonly drawbarOrgan: MatrixGraph;
|
|
296
|
+
readonly tubularBells: MatrixGraph;
|
|
297
|
+
readonly vibeMallet: MatrixGraph;
|
|
298
|
+
readonly fanfareSwell: MatrixGraph;
|
|
299
|
+
readonly choirOfTheVoid: MatrixGraph;
|
|
300
|
+
readonly supersawStack: MatrixGraph;
|
|
301
|
+
readonly neonPluck: MatrixGraph;
|
|
302
|
+
readonly chromePluck: MatrixGraph;
|
|
303
|
+
readonly stabChord: MatrixGraph;
|
|
304
|
+
readonly deepHouseBass: MatrixGraph;
|
|
305
|
+
readonly knockBass: MatrixGraph;
|
|
306
|
+
readonly airyPad: MatrixGraph;
|
|
307
|
+
readonly suitcase: MatrixGraph;
|
|
308
|
+
};
|
|
309
|
+
export interface NesParams {
|
|
310
|
+
type?: 'pulse' | 'triangle' | 'noise' | 'dpcm';
|
|
311
|
+
/** Percent of the cycle the pulse is high: the 2A03 has 12.5, 25, 50 and 75. */
|
|
312
|
+
duty?: 12.5 | 25 | 50 | 75;
|
|
313
|
+
envMode?: 'decay' | 'constant' | 'adsr';
|
|
314
|
+
/** 0…15, the hardware's volume. In `decay` mode it is also how long the note takes to fall. */
|
|
315
|
+
vol?: number;
|
|
316
|
+
/** Semitones the pitch slides by over the note. */
|
|
317
|
+
sweep?: number;
|
|
318
|
+
noiseMode?: 'long' | 'short';
|
|
319
|
+
attack?: number;
|
|
320
|
+
decay?: number;
|
|
321
|
+
sustain?: number;
|
|
322
|
+
release?: number;
|
|
323
|
+
vibRate?: number;
|
|
324
|
+
vibAmt?: number;
|
|
325
|
+
/** A two-note arpeggio: the pitch flips to `arpSemis` above and back, `arpRate` times a second. */
|
|
326
|
+
arpRate?: number;
|
|
327
|
+
arpSemis?: number;
|
|
328
|
+
pitchDrop?: number;
|
|
329
|
+
pitchDec?: number;
|
|
330
|
+
dpcm?: 'kick' | 'snare' | 'hihat';
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Nes2a03.tish `playNes2a03`: the NES's sound chip. Two pulse channels at the hardware's four duty cycles, the
|
|
334
|
+
* 4-bit stepped triangle (an octave down, as on the console), the shift-register noise at its sixteen periods, and the
|
|
335
|
+
* crunchy 4-bit sample channel; hardware-style envelopes, the two-note arpeggio, pitch drops and sweeps, vibrato.
|
|
336
|
+
* `midi` is the note (the noise channel maps it onto its periods). The pulses are band-limited here; the source plays
|
|
337
|
+
* their 8-step tables and lets them alias as the browser resamples them.
|
|
338
|
+
*/
|
|
339
|
+
export declare function nes(midi: number, v: number, dur: number, seed: number, p?: NesParams): Sig;
|
|
340
|
+
export {};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/** The rate everything here runs at (Hz). */
|
|
2
|
+
export declare const SR = 32000;
|
|
3
|
+
export type Sig = Float64Array;
|
|
4
|
+
export interface Stereo {
|
|
5
|
+
l: Sig;
|
|
6
|
+
r: Sig;
|
|
7
|
+
}
|
|
8
|
+
/** A number, or a value a sample. */
|
|
9
|
+
export type Param = number | Sig;
|
|
10
|
+
export declare const hz: (m: number) => number;
|
|
11
|
+
export declare const cents: (c: number) => number;
|
|
12
|
+
export declare const dbGain: (db: number) => number;
|
|
13
|
+
/** Seconds as whole samples (one at least). */
|
|
14
|
+
export declare const samples: (s: number) => number;
|
|
15
|
+
export declare const clamp: (v: number, lo: number, hi: number) => number;
|
|
16
|
+
export declare const stereo: (n: number) => Stereo;
|
|
17
|
+
/** A seeded generator of numbers in 0…1 (mulberry32). */
|
|
18
|
+
export declare function rand(seed: number): () => number;
|
|
19
|
+
/** `n` samples of white noise, −1…1. */
|
|
20
|
+
export declare function white(n: number, seed: number): Sig;
|
|
21
|
+
/** Pink noise (−3 dB an octave): white through Paul Kellet's filter. */
|
|
22
|
+
export declare function pink(n: number, seed: number): Sig;
|
|
23
|
+
/** A slow random wander, −1…1: noise smoothed to about `rate` Hz. What keeps a held pitch or level from sitting still. */
|
|
24
|
+
export declare function wander(n: number, rate: number, seed: number): Sig;
|
|
25
|
+
/** A sine at `freq`, from `phase` (turns). */
|
|
26
|
+
export declare function sine(n: number, freq: Param, phase?: number): Sig;
|
|
27
|
+
/** A band-limited sawtooth (PolyBLEP). */
|
|
28
|
+
export declare function saw(n: number, freq: Param, phase?: number): Sig;
|
|
29
|
+
/** A band-limited pulse whose width `pw` (0…1) may move. */
|
|
30
|
+
export declare function pulse(n: number, freq: Param, pw?: Param, phase?: number): Sig;
|
|
31
|
+
/** A band-limited triangle: a square, integrated. */
|
|
32
|
+
export declare function triangle(n: number, freq: Param, phase?: number): Sig;
|
|
33
|
+
/** One period of a tone built from `harmonics` (levels of 1×, 2×, 3×…), for `table`. Band-limited by what it holds. */
|
|
34
|
+
export declare function wavetable(harmonics: readonly number[], size?: number): Sig;
|
|
35
|
+
/** A wavetable played at `freq`. Only the harmonics under the Nyquist rate belong in the table (see `harmonicsUnder`). */
|
|
36
|
+
export declare function table(n: number, wave: Sig, freq: Param, phase?: number): Sig;
|
|
37
|
+
/** `levels` cut off where harmonic k of `freq` would pass 0.45 of the rate. */
|
|
38
|
+
export declare const harmonicsUnder: (freq: number, levels: readonly number[]) => number[];
|
|
39
|
+
export interface UnisonOptions {
|
|
40
|
+
/** Oscillators in the stack. */
|
|
41
|
+
voices?: number;
|
|
42
|
+
/** How far the outer two sit from the pitch, cents. */
|
|
43
|
+
detune?: number;
|
|
44
|
+
/** 0 (all centre) … 1 (spread edge to edge). */
|
|
45
|
+
spread?: number;
|
|
46
|
+
wave?: 'saw' | 'pulse';
|
|
47
|
+
pw?: number;
|
|
48
|
+
/** Each oscillator's own slow drift, cents. */
|
|
49
|
+
drift?: number;
|
|
50
|
+
seed?: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A unison stack: `voices` oscillators spread around `freq` and across the stereo field, each starting at its own
|
|
54
|
+
* phase and drifting a little on its own. What a "supersaw" is, and why it is wide.
|
|
55
|
+
*/
|
|
56
|
+
export declare function unison(n: number, freq: Param, o?: UnisonOptions): Stereo;
|
|
57
|
+
/** One FM operator: a sine at `ratio` × the note (or `fixed` Hz), its own level envelope, and feedback into itself. */
|
|
58
|
+
export interface FmOp {
|
|
59
|
+
ratio?: number;
|
|
60
|
+
fixed?: number;
|
|
61
|
+
detune?: number;
|
|
62
|
+
level: Param;
|
|
63
|
+
feedback?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Phase-modulation synthesis over a matrix: `mods` lists [from, to, index] edges (an operator may only be modulated by
|
|
67
|
+
* one with a higher number, or by itself through `feedback`), `carriers` the operators that are heard. An operator's
|
|
68
|
+
* level envelope is its index envelope when it modulates: a strike that starts bright and mellows as it rings.
|
|
69
|
+
*/
|
|
70
|
+
export declare function fm(n: number, freq: Param, ops: readonly FmOp[], mods: readonly (readonly [from: number, to: number, index: number])[], carriers: readonly number[]): Sig;
|
|
71
|
+
/** A bank of ringing modes: each [Hz, level, seconds to fall 60 dB], struck at sample 0. What a bar, bell or string is. */
|
|
72
|
+
export declare function modes(n: number, bank: readonly (readonly [freq: number, level: number, t60: number])[]): Sig;
|
|
73
|
+
export type FilterMode = 'lp' | 'hp' | 'bp' | 'notch';
|
|
74
|
+
/** A state-variable filter (trapezoidal: stable at any setting), 12 dB an octave. `q` 0.5 is flat; 10 rings. */
|
|
75
|
+
export declare function svf(x: Sig, cutoff: Param, q?: Param, mode?: FilterMode): Sig;
|
|
76
|
+
/**
|
|
77
|
+
* A four-pole ladder low-pass, 24 dB an octave, with resonance (0…1, singing near 1) and a driven input that
|
|
78
|
+
* saturates like the transistor ladder it is modelled on. The filter of a synth bass, pluck or lead.
|
|
79
|
+
*/
|
|
80
|
+
export declare function ladder(x: Sig, cutoff: Param, res?: Param, drive?: number): Sig;
|
|
81
|
+
/** A one-pole low-pass, 6 dB an octave: the gentlest filter, and what smooths a control so it never zips. */
|
|
82
|
+
export declare function lp1(x: Sig, cutoff: Param): Sig;
|
|
83
|
+
/** A one-pole high-pass. */
|
|
84
|
+
export declare function hp1(x: Sig, cutoff: number): Sig;
|
|
85
|
+
export interface Biquad {
|
|
86
|
+
b0: number;
|
|
87
|
+
b1: number;
|
|
88
|
+
b2: number;
|
|
89
|
+
a1: number;
|
|
90
|
+
a2: number;
|
|
91
|
+
}
|
|
92
|
+
/** A peaking band: `db` at `freq`, `q` wide. */
|
|
93
|
+
export declare function peaking(freq: number, q: number, db: number): Biquad;
|
|
94
|
+
/** A shelf: `db` below (`low`) or above `freq`. */
|
|
95
|
+
export declare function shelf(freq: number, db: number, low: boolean): Biquad;
|
|
96
|
+
/** `x` through a biquad. */
|
|
97
|
+
export declare function biquad(x: Sig, f: Biquad): Sig;
|
|
98
|
+
/** One band of an equaliser. */
|
|
99
|
+
export type EqBand = readonly [kind: 'peak' | 'low' | 'high' | 'hp' | 'lp', freq: number, db?: number, q?: number];
|
|
100
|
+
/** `x` through `bands`, in order. `hp` and `lp` are 12 dB an octave. */
|
|
101
|
+
export declare function eq(x: Sig, bands: readonly EqBand[]): Sig;
|
|
102
|
+
/**
|
|
103
|
+
* `x` through a body: resonances ([Hz, Q, level]) ringing in parallel beside the dry signal. The wood of a guitar or
|
|
104
|
+
* a bass, the mouth of a horn, the vowel of a voice.
|
|
105
|
+
*/
|
|
106
|
+
export declare function body(x: Sig, peaks: readonly (readonly [freq: number, q: number, level: number])[], dry?: number): Sig;
|
|
107
|
+
/**
|
|
108
|
+
* An ADSR with curved segments, the way an analogue envelope moves: a fast-then-settling attack over `a` s, a fall
|
|
109
|
+
* to `s` that is nearly there after `d` s, held to `gate` s, then a release that is 60 dB down after `r` s.
|
|
110
|
+
*/
|
|
111
|
+
export declare function adsr(n: number, a: number, d: number, s: number, gate: number, r: number): Sig;
|
|
112
|
+
/** A strike: up over `a` s, then falling 60 dB every `t60` s. */
|
|
113
|
+
export declare function strike(n: number, a: number, t60: number): Sig;
|
|
114
|
+
/** `from` to `to` across `n` samples; `curve` > 1 leaves late, < 1 leaves early. */
|
|
115
|
+
export declare function ramp(n: number, from: number, to: number, curve?: number): Sig;
|
|
116
|
+
/** A sine LFO, 0…1 by default, from `phase` (turns). */
|
|
117
|
+
export declare function lfo(n: number, rate: number, phase?: number, lo?: number, hi?: number): Sig;
|
|
118
|
+
/**
|
|
119
|
+
* A played pitch: `freq` with a scoop into the note (from `scoop` cents off, over `scoopS` s), a vibrato of `depth`
|
|
120
|
+
* cents at `rate` Hz that only comes in after `delay` s, and the small unsteadiness of a hand or a lip (`jitter` cents).
|
|
121
|
+
*/
|
|
122
|
+
export declare function pitch(n: number, freq: number, o?: {
|
|
123
|
+
scoop?: number;
|
|
124
|
+
scoopS?: number;
|
|
125
|
+
depth?: number;
|
|
126
|
+
rate?: number;
|
|
127
|
+
delay?: number;
|
|
128
|
+
fadeIn?: number;
|
|
129
|
+
jitter?: number;
|
|
130
|
+
seed?: number;
|
|
131
|
+
}): Sig;
|
|
132
|
+
export declare function mul(a: Sig, b: Param): Sig;
|
|
133
|
+
/** `b` added into `a` from sample `at`, times `gain` (in place). */
|
|
134
|
+
export declare function add(a: Sig, b: Sig, gain?: number, at?: number): Sig;
|
|
135
|
+
export declare function peakOf(x: Sig): number;
|
|
136
|
+
/** `x` scaled so its loudest sample is `to`: every voice leaves here at a known level, so a mix is set by its gains. */
|
|
137
|
+
export declare function norm(x: Sig, to?: number): Sig;
|
|
138
|
+
export declare function normStereo(x: Stereo, to?: number): Stereo;
|
|
139
|
+
/** A short fade at both ends of `x` (in place), so a voice never starts or stops on a step. */
|
|
140
|
+
export declare function declick(x: Sig, inS?: number, outS?: number): Sig;
|
|
141
|
+
/**
|
|
142
|
+
* `x` through the waveshaper `f` at twice the rate: raised, shaped, filtered and brought back down, so the harmonics a
|
|
143
|
+
* hard drive makes above the Nyquist rate are thrown away, not folded back into the music as a gritty, false tone.
|
|
144
|
+
*/
|
|
145
|
+
export declare function shape(x: Sig, f: (v: number) => number): Sig;
|
|
146
|
+
/** Soft saturation: `drive` 1 is nearly clean, 4 is thick. Level-compensated. */
|
|
147
|
+
export declare const saturate: (x: Sig, drive: number, bias?: number) => Sig;
|
|
148
|
+
/** A mono signal placed in the stereo field: `pan` −1 (left) … 1 (right), equal power. */
|
|
149
|
+
export declare function place(x: Sig, pan?: number): Stereo;
|
|
150
|
+
/** `x` played backwards. */
|
|
151
|
+
export declare function reverse(x: Sig): Sig;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { type Sig, type Stereo } from './dsp.js';
|
|
2
|
+
export interface ReverbOptions {
|
|
3
|
+
/** Seconds the tail takes to fall 60 dB (mid frequencies). */
|
|
4
|
+
rt60: number;
|
|
5
|
+
/** The room's scale: 1 is a studio room, 2 a hall, 3 a cathedral. Sets how far apart its echoes are. */
|
|
6
|
+
size?: number;
|
|
7
|
+
/** Hz above which the tail dies faster (air and soft walls): low is dark and warm. */
|
|
8
|
+
damp?: number;
|
|
9
|
+
/** Hz below which nothing is sent in, so the tail never muddies the bass. */
|
|
10
|
+
lowCut?: number;
|
|
11
|
+
/** Seconds before the room answers: what keeps a close sound close in a big room. */
|
|
12
|
+
predelay?: number;
|
|
13
|
+
/** 0…1: how much the tail's delays drift, which stops it ringing like metal. */
|
|
14
|
+
mod?: number;
|
|
15
|
+
/** Level of the first reflections against the tail. */
|
|
16
|
+
early?: number;
|
|
17
|
+
seed?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A room: the wet signal of `x`. First reflections off the walls, then a feedback delay network of eight lines mixed
|
|
21
|
+
* through a Hadamard matrix (every line feeds every other, so the echoes multiply into a smooth tail), each line losing
|
|
22
|
+
* its highs a little on every pass and drifting slowly in length so no pitch rings out. This is what the old four-comb
|
|
23
|
+
* reverb lacked: density, a tail that darkens as it falls, a width, and a time before it answers.
|
|
24
|
+
*/
|
|
25
|
+
export declare function reverb(x: Stereo, o: ReverbOptions): Stereo;
|
|
26
|
+
export interface EchoOptions {
|
|
27
|
+
/** Seconds each side waits. */
|
|
28
|
+
left: number;
|
|
29
|
+
right: number;
|
|
30
|
+
/** 0…0.9: how much of each repeat comes round again. */
|
|
31
|
+
feedback: number;
|
|
32
|
+
/** The repeats lose everything above this (Hz) each time round: a tape or a bucket-brigade echo darkens as it fades. */
|
|
33
|
+
highCut?: number;
|
|
34
|
+
lowCut?: number;
|
|
35
|
+
/** Repeats bounce side to side. */
|
|
36
|
+
ping?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** A stereo echo with filters in its feedback path: the wet signal. Give it times that are note lengths of the track. */
|
|
39
|
+
export declare function echo(x: Stereo, o: EchoOptions): Stereo;
|
|
40
|
+
/**
|
|
41
|
+
* A chorus / string ensemble: each side hears `voices` copies of `x` a few ms late, each delay swaying on its own
|
|
42
|
+
* phase, so one voice becomes several and a mono part becomes wide. `depth` and `delay` are seconds.
|
|
43
|
+
*/
|
|
44
|
+
export declare function chorus(x: Stereo, o?: {
|
|
45
|
+
rate?: number;
|
|
46
|
+
depth?: number;
|
|
47
|
+
delay?: number;
|
|
48
|
+
mix?: number;
|
|
49
|
+
voices?: number;
|
|
50
|
+
}): Stereo;
|
|
51
|
+
/** A phaser: all-pass stages sweeping between `lo` and `hi` Hz, the two sides a quarter turn apart. */
|
|
52
|
+
export declare function phaser(x: Stereo, o?: {
|
|
53
|
+
rate?: number;
|
|
54
|
+
lo?: number;
|
|
55
|
+
hi?: number;
|
|
56
|
+
stages?: number;
|
|
57
|
+
feedback?: number;
|
|
58
|
+
mix?: number;
|
|
59
|
+
}): Stereo;
|
|
60
|
+
/**
|
|
61
|
+
* A rotary speaker: the treble through a spinning horn (louder, and higher in pitch, as it swings toward each of two
|
|
62
|
+
* microphones), the bass through a slower drum. `speed` is the horn's turns a second: about 0.8 is "chorale", 6.7
|
|
63
|
+
* "tremolo"; an array lets it spin up.
|
|
64
|
+
*/
|
|
65
|
+
export declare function rotary(x: Sig, speed: number | Sig, phase0?: number): Stereo;
|
|
66
|
+
/** `x` at `bits` of depth, each value held for `hold` samples: a console's converter. For chiptune only. */
|
|
67
|
+
export declare function crush(x: Sig, bits: number, hold?: number): Sig;
|
|
68
|
+
/**
|
|
69
|
+
* Sidechain ducking: a gain curve that dips by `depth` at each of `times` (s) and comes back over `release` s. What a
|
|
70
|
+
* compressor keyed from the kick does to a pad or a bass: the kick gets the room, and the part breathes with the beat.
|
|
71
|
+
*/
|
|
72
|
+
export declare function duck(n: number, times: readonly number[], depth: number, release?: number, attack?: number, hold?: number): Sig;
|
|
73
|
+
export interface CompressorOptions {
|
|
74
|
+
/** dB above which gain falls. */
|
|
75
|
+
threshold: number;
|
|
76
|
+
ratio: number;
|
|
77
|
+
/** Seconds. */
|
|
78
|
+
attack?: number;
|
|
79
|
+
release?: number;
|
|
80
|
+
/** dB over which the knee bends. */
|
|
81
|
+
knee?: number;
|
|
82
|
+
/** dB added after. */
|
|
83
|
+
makeup?: number;
|
|
84
|
+
/** Hz: the detector ignores what is under this, so a kick does not pump the whole mix. */
|
|
85
|
+
sidechainHp?: number;
|
|
86
|
+
}
|
|
87
|
+
/** A stereo compressor: one gain for both sides, taken from the louder. Glue for a bus, weight for a drum kit. */
|
|
88
|
+
export declare function compress(x: Stereo, o: CompressorOptions): Stereo;
|
|
89
|
+
/** Transient shaping: `attack` > 0 sharpens the front of every hit (dB at most), < 0 softens it. */
|
|
90
|
+
export declare function transient(x: Sig, attack: number): Sig;
|
|
91
|
+
/** The difference between the sides scaled by `amount`: 0 is mono, 1 unchanged, 1.5 wider. */
|
|
92
|
+
export declare function widen(x: Stereo, amount: number): Stereo;
|
|
93
|
+
/** Everything under `freq` made mono: the bass in the middle, where it hits hardest and survives any speaker. */
|
|
94
|
+
export declare function monoBelow(x: Stereo, freq: number): Stereo;
|
|
95
|
+
/** A mono part made two: the right side a few ms late and filtered a little differently. A cheap double-track. */
|
|
96
|
+
export declare function double(x: Sig, ms?: number, tilt?: number): Stereo;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type EqBand, type Sig, type Stereo } from './dsp.js';
|
|
2
|
+
import { type CompressorOptions, type EchoOptions, type ReverbOptions } from './fx.js';
|
|
3
|
+
export interface TrackOptions {
|
|
4
|
+
/** The fader (linear). */
|
|
5
|
+
gain?: number;
|
|
6
|
+
eq?: readonly EqBand[];
|
|
7
|
+
/** Level sent to the session's room. */
|
|
8
|
+
room?: number;
|
|
9
|
+
/** Level sent to the session's echo. */
|
|
10
|
+
echo?: number;
|
|
11
|
+
/** 0…1: how far the part dips under each kick. */
|
|
12
|
+
duck?: number;
|
|
13
|
+
/** Seconds the dip takes to come back. */
|
|
14
|
+
duckRelease?: number;
|
|
15
|
+
/** Stereo width: 0 mono, 1 as played. */
|
|
16
|
+
width?: number;
|
|
17
|
+
/** An effect over the whole track (a chorus, a rotary speaker, a compressor). */
|
|
18
|
+
insert?: (x: Stereo) => Stereo;
|
|
19
|
+
}
|
|
20
|
+
/** One part of the mix. */
|
|
21
|
+
export declare class Track {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
private readonly loop;
|
|
24
|
+
readonly o: TrackOptions;
|
|
25
|
+
readonly l: Sig;
|
|
26
|
+
readonly r: Sig;
|
|
27
|
+
constructor(name: string, n: number, loop: number, o: TrackOptions);
|
|
28
|
+
/**
|
|
29
|
+
* `x` from `at` s, times `gain`, at `pan` (−1 left … 1 right; a stereo `x` is balanced toward it). A time before 0
|
|
30
|
+
* (a bow that starts ahead of the downbeat) is that long before the loop's end: the loop comes round.
|
|
31
|
+
*/
|
|
32
|
+
add(at: number, x: Sig | Stereo, gain?: number, pan?: number): void;
|
|
33
|
+
}
|
|
34
|
+
export interface MasterOptions {
|
|
35
|
+
/** The room every track's `room` send goes to. */
|
|
36
|
+
room: ReverbOptions;
|
|
37
|
+
/** Level of the room in the mix. */
|
|
38
|
+
roomLevel?: number;
|
|
39
|
+
/** The echo every track's `echo` send goes to. */
|
|
40
|
+
echo?: EchoOptions;
|
|
41
|
+
/** How much of the echo also goes to the room. */
|
|
42
|
+
echoToRoom?: number;
|
|
43
|
+
/** The bus compressor. */
|
|
44
|
+
glue?: CompressorOptions;
|
|
45
|
+
/** Tape-style saturation on the bus: 1 is clean. */
|
|
46
|
+
drive?: number;
|
|
47
|
+
eq?: readonly EqBand[];
|
|
48
|
+
/** Integrated loudness to finish at (LUFS), and the true peak never crossed (dBTP). */
|
|
49
|
+
lufs?: number;
|
|
50
|
+
ceiling?: number;
|
|
51
|
+
/** A last effect over the whole mix, before the loudness stage. */
|
|
52
|
+
insert?: (x: Stereo) => Stereo;
|
|
53
|
+
}
|
|
54
|
+
/** What a render measured, for whoever is mixing without ears (scripts only: nothing reads it at run time). */
|
|
55
|
+
export declare const studioLog: {
|
|
56
|
+
on: boolean;
|
|
57
|
+
rows: {
|
|
58
|
+
track: string;
|
|
59
|
+
rmsDb: number;
|
|
60
|
+
peakDb: number;
|
|
61
|
+
}[];
|
|
62
|
+
};
|
|
63
|
+
/** A piece: its tempo, its length in bars, and its tracks. */
|
|
64
|
+
export declare class Session {
|
|
65
|
+
readonly bpm: number;
|
|
66
|
+
readonly bars: number;
|
|
67
|
+
readonly seed: number;
|
|
68
|
+
readonly beat: number;
|
|
69
|
+
readonly bar: number;
|
|
70
|
+
/** Samples in the loop, and in the loop with the tail that is folded back. */
|
|
71
|
+
readonly n: number;
|
|
72
|
+
readonly total: number;
|
|
73
|
+
private readonly tracks;
|
|
74
|
+
/** When the kick hits (s): what `duck` follows. */
|
|
75
|
+
readonly kicks: number[];
|
|
76
|
+
constructor(bpm: number, bars: number, seed: number, tail?: number);
|
|
77
|
+
/** Seconds at bar `b` (from 0), beat `q` (from 0, fractions allowed). */
|
|
78
|
+
T: (b: number, q?: number) => number;
|
|
79
|
+
track(name: string, o?: TrackOptions): Track;
|
|
80
|
+
/** The mix: both sides at `SR`, exactly the loop's length, as the 16-bit values the file will hold. */
|
|
81
|
+
render(m: MasterOptions): [Float32Array, Float32Array];
|
|
82
|
+
/** The kick's hits, and the ones a loop before and after (the tail folds, so a duck must too). */
|
|
83
|
+
private loopedKicks;
|
|
84
|
+
}
|