@adatechnology/game-audio 0.5.0 → 0.6.1
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/assets/sfx/CREDITOS.md +11 -0
- package/assets/sfx/explosoes-fogo/fire_loop_gas_01.ogg +0 -0
- package/assets/sfx/explosoes-fogo/fire_loop_gas_02.ogg +0 -0
- package/assets/sfx/explosoes-fogo/fire_loop_gas_03.ogg +0 -0
- package/assets/sfx/explosoes-fogo/fire_loop_gas_04.ogg +0 -0
- package/assets/sfx/explosoes-fogo/fire_loop_liquid_01.ogg +0 -0
- package/assets/sfx/explosoes-fogo/fire_loop_liquid_02.ogg +0 -0
- package/assets/sfx/explosoes-fogo/fire_loop_liquid_03.ogg +0 -0
- package/assets/sfx/explosoes-fogo/fire_loop_plastic_01.ogg +0 -0
- package/assets/sfx/explosoes-fogo/fire_loop_plastic_02.ogg +0 -0
- package/assets/sfx/explosoes-fogo/fire_loop_plastic_03.ogg +0 -0
- package/assets/sfx/explosoes-fogo/fire_loop_plastic_04.ogg +0 -0
- package/assets/sfx/manifest.json +134 -0
- package/dist/{chunk-7TLFY7VO.js → chunk-KBTUANNG.js} +267 -8
- package/dist/chunk-KBTUANNG.js.map +1 -0
- package/dist/index.d.ts +10 -80
- package/dist/index.global.js +167 -4
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +104 -138
- package/dist/index.js.map +1 -1
- package/dist/{locale-BugSe8dA.d.ts → locale-CJfDpWnI.d.ts} +180 -1
- package/dist/testing.d.ts +7 -5
- package/dist/testing.js +1 -1
- package/package.json +4 -3
- package/dist/chunk-7TLFY7VO.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SampleSound, a as SampleLoader, B as BusId, b as
|
|
2
|
-
export {
|
|
1
|
+
import { S as SampleSound, a as SampleLoader, B as BusId, b as SfxManifest, c as SoundBank, d as SampleDefaults, F as Falloff, L as LoopRecipe, e as SoundRecipe, P as ParamRef, R as Range, f as Layer, g as SoundSet, h as SoundPlan, i as SamplePlan, A as AudioLoopHandle, j as LoopEntry, M as MixProfile, k as AudioEngine } from './locale-CJfDpWnI.js';
|
|
2
|
+
export { l as ActionCheck, m as AudioBenchText, n as AudioChannel, o as AudioEngineOptions, p as AudioScenarioLike, q as AudioStats, r as AudioTestModule, s as AudioTestModuleOptions, t as Automation, u as BENCH_BANK, v as BUILD_ORDERS, w as BUS_IDS, x as BUS_PRIORITY, y as BuildOrder, z as BusSetting, C as CRITERIA, D as CRITERIA_TARGETS, E as CriterionId, G as CriterionResult, H as Curve, I as DEFAULT_CROSSOVER, J as DEFAULT_LISTENER, K as DEFAULT_MAX_VOICES, N as DEFAULT_MIX, O as DEFAULT_SAMPLE_CUTOFF_K, Q as DEFAULT_SAMPLE_FALLOFF, T as DEFAULT_SAMPLE_PITCH, U as DEFAULT_TAIL_GAIN, V as DeepPartial, W as DistanceMode, X as Envelope, Y as EnvelopePoint, Z as FilterBank, _ as FilterSpec, $ as FormantVoiceSource, a0 as KIT_SAMPLES_BANK, a1 as LAYER_FLOOR, a2 as LayerSource, a3 as Listener, a4 as LoadUserSamplesOptions, a5 as LoopOrder, a6 as LoopSet, a7 as MIX_PROFILES, a8 as MeasureOptions, a9 as Modulator, aa as NoiseSource, ab as OPEN_CUTOFF, ac as OscSource, ad as PAN_LIMIT, ae as PAN_MIN_DISTANCE, af as PlanInput, ag as PlannedAutomation, ah as PlannedEnvelopePoint, ai as PlannedFilter, aj as PlannedLayer, ak as PlannedModulator, al as PlannedSampleLayer, am as PlannedSource, an as PlayOptions, ao as SAMPLE_ENVIRONMENTS, ap as SDK_LICENSES, aq as SFX_BLOWS, ar as SFX_CATALOG, as as SFX_CATEGORIES, at as SFX_IMPACTS, au as SFX_LAYERS, av as SFX_MATERIALS, aw as SFX_TIERS, ax as SampleBankOptions, ay as SampleCrossover, az as SampleEnvironment, aA as SampleLayerRole, aB as SampleLoadReport, aC as SampleMemory, aD as SampleOptions, aE as SamplePlanInput, aF as SampleRef, aG as SampleStatus, aH as SampleStore, aI as SampleTail, aJ as SampleTier, aK as SdkLicense, aL as SfxBlow, aM as SfxCategory, aN as SfxEntry, aO as SfxFileEntry, aP as SfxLayer, aQ as SfxManifestLike, aR as SfxManifestSound, aS as SfxMaterial, aT as SfxPriority, aU as SfxState, aV as SoundRegistry, aW as SoundSource, aX as StartQueueOptions, aY as Time, aZ as USER_SAMPLES_BANK, a_ as USER_SOUND_PREFIX, a$ as UserSampleBankOptions, b0 as UserSampleBankResult, b1 as UserSfxFile, b2 as UserSfxManifest, b3 as UserSfxSound, b4 as UserSoundPick, b5 as UserSoundPicks, b6 as UserSoundRole, b7 as VOICE_GROUPS, b8 as VoiceDecision, b9 as VoiceGroup, ba as VoiceHandle, bb as VoiceManager, bc as VoiceManagerOptions, bd as VoiceRefusal, be as VoiceRequest, bf as VoiceStartEvent, bg as VoiceStats, bh as audioBenchTextOf, bi as busGain, bj as busPriority, bk as createAudioEngine, bl as createAudioTestModule, bm as createSampleStore, bn as createSoundRegistry, bo as createVoiceManager, bp as crossGains, bq as farMixAt, br as fetchLoader, bs as impactSoundId, bt as inlineLoader, bu as limiterCurve, bv as listenerDistance, bw as loadUserSamples, bx as measureCriteria, by as panFor, bz as parseSfxName, bA as pickTake, bB as planSample, bC as planSound, bD as recordOutput, bE as resolveMix, bF as sampleBankFromManifest, bG as sampleCutoff, bH as sampleUrls, bI as sfxState, bJ as soundSourceOf, bK as splitTier, bL as tierFor, bM as userSampleBank } from './locale-CJfDpWnI.js';
|
|
3
3
|
import { AudioSink } from '@adatechnology/game-contracts';
|
|
4
4
|
|
|
5
5
|
/** Deterministic mulberry32 generator; floats in [0, 1). The same generator the golden tool seeds `Math.random` with, so a team routine and its recipe draw the same numbers. */
|
|
@@ -52,82 +52,6 @@ declare function countHits(channels: Channels, sampleRate: number, threshold: nu
|
|
|
52
52
|
/** Peak of the last `seconds` of a file against its own peak, dB (≤ −40: it fades out, it does not end on a cut). */
|
|
53
53
|
declare function endDropDb(channels: Channels, sampleRate: number, seconds?: number): number;
|
|
54
54
|
|
|
55
|
-
/**
|
|
56
|
-
* The manifest the converter (`scripts/sfx-convert.mjs`) writes next to the converted files: every sound id with its takes per layer, the file
|
|
57
|
-
* facts the criteria check (rate, channels, peak, length) and where each file came from. `sampleBankFromManifest` turns it into a `SoundBank`
|
|
58
|
-
* of `SampleSound`s, with the bus and the numbers of each sound given by the caller.
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
/** Licences the SDK accepts (the files are redistributed on npm): public domain or attribution only. */
|
|
62
|
-
declare const SDK_LICENSES: readonly ["CC0", "CC-BY"];
|
|
63
|
-
type SdkLicense = (typeof SDK_LICENSES)[number];
|
|
64
|
-
type SfxFileEntry = {
|
|
65
|
-
/** Path from the manifest's folder: `armas/pistol_9mm_close_01.ogg`. */
|
|
66
|
-
readonly file: string;
|
|
67
|
-
readonly sampleRate: number;
|
|
68
|
-
readonly channels: number;
|
|
69
|
-
/** dBFS. */
|
|
70
|
-
readonly peak: number;
|
|
71
|
-
readonly seconds: number;
|
|
72
|
-
readonly source: string;
|
|
73
|
-
readonly author: string;
|
|
74
|
-
readonly license: SdkLicense;
|
|
75
|
-
};
|
|
76
|
-
/** The layers a file name can end in: `<id>_<layer>_<nn>` (`pistol_9mm_close_01`); a name without one is a `close` take. */
|
|
77
|
-
declare const SFX_LAYERS: readonly ["close", "far", "tail_in", "tail_out"];
|
|
78
|
-
type SfxLayer = (typeof SFX_LAYERS)[number];
|
|
79
|
-
type SfxManifestSound = {
|
|
80
|
-
readonly id: string;
|
|
81
|
-
readonly category: string;
|
|
82
|
-
readonly layers: Partial<Readonly<Record<SfxLayer, readonly SfxFileEntry[]>>>;
|
|
83
|
-
};
|
|
84
|
-
type SfxManifest = {
|
|
85
|
-
readonly version: 1;
|
|
86
|
-
readonly format: {
|
|
87
|
-
readonly codec: 'vorbis';
|
|
88
|
-
readonly sampleRate: number;
|
|
89
|
-
readonly channels: number;
|
|
90
|
-
readonly peakDb: number;
|
|
91
|
-
};
|
|
92
|
-
readonly sounds: readonly SfxManifestSound[];
|
|
93
|
-
};
|
|
94
|
-
/** The numbers of one sound that the files do not say (bus, curve, pitch...). */
|
|
95
|
-
type SampleDefaults = {
|
|
96
|
-
readonly bus: BusId;
|
|
97
|
-
readonly gain?: number;
|
|
98
|
-
readonly pitch?: number;
|
|
99
|
-
readonly crossover?: SampleCrossover;
|
|
100
|
-
readonly tailGain?: number;
|
|
101
|
-
readonly falloff?: Falloff;
|
|
102
|
-
readonly cutoffK?: number;
|
|
103
|
-
readonly group?: string;
|
|
104
|
-
readonly priority?: number;
|
|
105
|
-
readonly fallback?: string;
|
|
106
|
-
};
|
|
107
|
-
type SampleBankOptions = {
|
|
108
|
-
readonly id: string;
|
|
109
|
-
/** Prefix of every url (where the manifest's folder is served: `/sfx/`). Default ''. */
|
|
110
|
-
readonly baseUrl?: string;
|
|
111
|
-
/** Numbers per sound id, or one function; a sound with neither is left out (it has no bus). */
|
|
112
|
-
readonly sounds?: Readonly<Record<string, SampleDefaults>>;
|
|
113
|
-
readonly defaults?: (sound: SfxManifestSound) => SampleDefaults | undefined;
|
|
114
|
-
};
|
|
115
|
-
/** The strength suffixes of a sound id (`kick_hit_heavy`): takes of the tiers of `kick_hit`, from these intensities. */
|
|
116
|
-
declare const SFX_TIERS: Readonly<Record<string, number>>;
|
|
117
|
-
/** Splits a file name (no extension) into its sound id, layer and take number. */
|
|
118
|
-
declare function parseSfxName(name: string): {
|
|
119
|
-
readonly id: string;
|
|
120
|
-
readonly layer: SfxLayer;
|
|
121
|
-
readonly take: number;
|
|
122
|
-
};
|
|
123
|
-
/** The base id and tier of a sound id: `kick_hit_heavy` → `kick_hit`, `heavy`. */
|
|
124
|
-
declare function splitTier(id: string): {
|
|
125
|
-
readonly base: string;
|
|
126
|
-
readonly tier?: string;
|
|
127
|
-
};
|
|
128
|
-
/** A bank of sample sounds from a manifest. */
|
|
129
|
-
declare function sampleBankFromManifest(manifest: SfxManifest, options: SampleBankOptions): SoundBank;
|
|
130
|
-
|
|
131
55
|
/** The bus of a manifest category (the folder the file sits in). */
|
|
132
56
|
declare const KIT_CATEGORY_BUS: Readonly<Record<string, BusId>>;
|
|
133
57
|
/**
|
|
@@ -136,7 +60,10 @@ declare const KIT_CATEGORY_BUS: Readonly<Record<string, BusId>>;
|
|
|
136
60
|
*/
|
|
137
61
|
declare const KIT_SAMPLE_ALIASES: Readonly<Record<string, string>>;
|
|
138
62
|
/** The numbers of a sound the files do not say: the bus of its folder, a little pitch spread. */
|
|
139
|
-
declare function kitSampleDefaults(sound:
|
|
63
|
+
declare function kitSampleDefaults(sound: {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
readonly category: string;
|
|
66
|
+
}): SampleDefaults | undefined;
|
|
140
67
|
type KitSampleBankOptions = {
|
|
141
68
|
/** Where the `assets/sfx/` folder is served (`./sfx/`). */
|
|
142
69
|
readonly baseUrl?: string;
|
|
@@ -326,6 +253,9 @@ declare const LIBRARY_SOUNDS: readonly SoundRecipe[];
|
|
|
326
253
|
declare const LIBRARY_LOOPS: readonly LoopRecipe[];
|
|
327
254
|
declare const LIBRARY_BANK: SoundBank;
|
|
328
255
|
|
|
256
|
+
declare const CABIN_SOUNDS: readonly SoundRecipe[];
|
|
257
|
+
declare const CABIN_BANK: SoundBank;
|
|
258
|
+
|
|
329
259
|
/** Small sounds of the hand: `vol / (1 + d² × 0.02)`, lowpass cutoffs `/ (1 + d × 0.04)`, silent below 0.004 (a latch at 10 m is a third, at 50 m gone). */
|
|
330
260
|
declare const FOLEY_FALLOFF: Falloff;
|
|
331
261
|
/** The doors and lids of furniture and vehicles, by what the leaf is (the room picks one from the item, else from the leaf's material). */
|
|
@@ -479,4 +409,4 @@ type EngineSink = AudioSink & {
|
|
|
479
409
|
/** Lends an engine as the host's `audio`: sounds by key, loops, the listener, and banks registered into the same engine. */
|
|
480
410
|
declare function createAudioSink(engine: AudioEngine): EngineSink;
|
|
481
411
|
|
|
482
|
-
export { AudioEngine, AudioLoopHandle, BODY_FALLOFF, BODY_FOLEY_BANK, BODY_FOLEY_SET_IDS, BODY_FOLEY_TAKES, BusId, CALIBRATION_ID, CALIBRATION_LOOP_ID, CALIBRATION_LOOP_SOUND, CALIBRATION_SOUND, CROSSFADE_STEPS, DEFAULT_LOOP_CROSSFADE, DISTANCE_CURVES, type DistanceCurveName, type EngineSink, FOLEY_BANK, FOLEY_FALLOFF, FOOTSTEP_FALLOFF, Falloff, GAME_SFX_BANK, GAME_SFX_CLASSES, GAME_SFX_FALLBACK, ITEM_FOLEY, KIT_CATEGORY_BUS, KIT_SAMPLE_ALIASES, type KitSampleBankOptions, LEAF_FOLEY, LEAF_FOLEY_SETS, LIBRARY_BANK, LIBRARY_LOOPS, LIBRARY_SOUNDS, LOOP_SMOOTHING, LOOP_START_ABOVE, Layer, type LeafFoley, type LoadKitSamplesOptions, type LoopAction, LoopRecipe, type LoopState, type MixChain, MixProfile, type NoiseClass, PICKUP_CLASSES, ParamRef, type PickupClass, Range, type RealizeTarget, type RealizedSampleVoice, type RealizedVoice,
|
|
412
|
+
export { AudioEngine, AudioLoopHandle, BODY_FALLOFF, BODY_FOLEY_BANK, BODY_FOLEY_SET_IDS, BODY_FOLEY_TAKES, BusId, CABIN_BANK, CABIN_SOUNDS, CALIBRATION_ID, CALIBRATION_LOOP_ID, CALIBRATION_LOOP_SOUND, CALIBRATION_SOUND, CROSSFADE_STEPS, DEFAULT_LOOP_CROSSFADE, DISTANCE_CURVES, type DistanceCurveName, type EngineSink, FOLEY_BANK, FOLEY_FALLOFF, FOOTSTEP_FALLOFF, Falloff, GAME_SFX_BANK, GAME_SFX_CLASSES, GAME_SFX_FALLBACK, ITEM_FOLEY, KIT_CATEGORY_BUS, KIT_SAMPLE_ALIASES, type KitSampleBankOptions, LEAF_FOLEY, LEAF_FOLEY_SETS, LIBRARY_BANK, LIBRARY_LOOPS, LIBRARY_SOUNDS, LOOP_SMOOTHING, LOOP_START_ABOVE, Layer, type LeafFoley, type LoadKitSamplesOptions, type LoopAction, LoopRecipe, type LoopState, type MixChain, MixProfile, type NoiseClass, PICKUP_CLASSES, ParamRef, type PickupClass, Range, type RealizeTarget, type RealizedSampleVoice, type RealizedVoice, SampleDefaults, SampleLoader, type SampleLoopHost, SamplePlan, SampleSound, type SampleTarget, type SceneLength, type SceneNoise, type SceneRecipeOptions, type SceneTone, type SceneVoice, type SetPicker, SfxManifest, SoundBank, SoundPlan, SoundRecipe, SoundSet, balanceOf, bufferOf, buildChain, calibrationLoader, centroidHz, countHits, createAudioSink, createLoopState, createRng, createSetPicker, cutoffDivisor, dbOf, drawBetween, encodeWav, endDropDb, equalPowerIn, falloffGain, fillImpulse, fillNoise, globalContext, isCalibrationUrl, isSilent, kitSampleBank, kitSampleDefaults, loadKitSamples, loopCrossfade, noiseClassRecipe, onsetIndex, peakIndex, peakOf, realize, realizeSample, retunePlan, ringSeconds, rmsDb, sampleLength, sceneMany, sceneNoise, sceneRecipe, sceneTone, sceneVoice, streamFor, streamSeed, unlockContext, withAliases };
|
package/dist/index.global.js
CHANGED
|
@@ -29,6 +29,8 @@ var GameAudio = (() => {
|
|
|
29
29
|
BUILD_ORDERS: () => BUILD_ORDERS,
|
|
30
30
|
BUS_IDS: () => BUS_IDS,
|
|
31
31
|
BUS_PRIORITY: () => BUS_PRIORITY,
|
|
32
|
+
CABIN_BANK: () => CABIN_BANK,
|
|
33
|
+
CABIN_SOUNDS: () => CABIN_SOUNDS,
|
|
32
34
|
CALIBRATION_ID: () => CALIBRATION_ID,
|
|
33
35
|
CALIBRATION_LOOP_ID: () => CALIBRATION_LOOP_ID,
|
|
34
36
|
CALIBRATION_LOOP_SOUND: () => CALIBRATION_LOOP_SOUND,
|
|
@@ -54,6 +56,7 @@ var GameAudio = (() => {
|
|
|
54
56
|
GAME_SFX_FALLBACK: () => GAME_SFX_FALLBACK,
|
|
55
57
|
ITEM_FOLEY: () => ITEM_FOLEY,
|
|
56
58
|
KIT_CATEGORY_BUS: () => KIT_CATEGORY_BUS,
|
|
59
|
+
KIT_SAMPLES_BANK: () => KIT_SAMPLES_BANK,
|
|
57
60
|
KIT_SAMPLE_ALIASES: () => KIT_SAMPLE_ALIASES,
|
|
58
61
|
LAYER_FLOOR: () => LAYER_FLOOR,
|
|
59
62
|
LEAF_FOLEY: () => LEAF_FOLEY,
|
|
@@ -77,6 +80,8 @@ var GameAudio = (() => {
|
|
|
77
80
|
SFX_LAYERS: () => SFX_LAYERS,
|
|
78
81
|
SFX_MATERIALS: () => SFX_MATERIALS,
|
|
79
82
|
SFX_TIERS: () => SFX_TIERS,
|
|
83
|
+
USER_SAMPLES_BANK: () => USER_SAMPLES_BANK,
|
|
84
|
+
USER_SOUND_PREFIX: () => USER_SOUND_PREFIX,
|
|
80
85
|
VOICE_GROUPS: () => VOICE_GROUPS,
|
|
81
86
|
audioBenchTextOf: () => audioBenchTextOf,
|
|
82
87
|
balanceOf: () => balanceOf,
|
|
@@ -118,6 +123,7 @@ var GameAudio = (() => {
|
|
|
118
123
|
limiterCurve: () => limiterCurve2,
|
|
119
124
|
listenerDistance: () => listenerDistance,
|
|
120
125
|
loadKitSamples: () => loadKitSamples,
|
|
126
|
+
loadUserSamples: () => loadUserSamples,
|
|
121
127
|
loopCrossfade: () => loopCrossfade,
|
|
122
128
|
measureCriteria: () => measureCriteria,
|
|
123
129
|
noiseClassRecipe: () => noiseClassRecipe,
|
|
@@ -146,11 +152,13 @@ var GameAudio = (() => {
|
|
|
146
152
|
sceneTone: () => sceneTone,
|
|
147
153
|
sceneVoice: () => sceneVoice,
|
|
148
154
|
sfxState: () => sfxState,
|
|
155
|
+
soundSourceOf: () => soundSourceOf,
|
|
149
156
|
splitTier: () => splitTier,
|
|
150
157
|
streamFor: () => streamFor,
|
|
151
158
|
streamSeed: () => streamSeed,
|
|
152
159
|
tierFor: () => tierFor,
|
|
153
160
|
unlockContext: () => unlockContext,
|
|
161
|
+
userSampleBank: () => userSampleBank,
|
|
154
162
|
withAliases: () => withAliases
|
|
155
163
|
});
|
|
156
164
|
|
|
@@ -1375,6 +1383,7 @@ var GameAudio = (() => {
|
|
|
1375
1383
|
}
|
|
1376
1384
|
|
|
1377
1385
|
// ../game-contracts/dist/index.js
|
|
1386
|
+
var DEFAULT_BLAST_IMPULSE = { bodyArea: 0.7, lift: 0.15, minSpeed: 0.3, tntPerJoule: 0.24 / 2e5 };
|
|
1378
1387
|
var DEFAULT_COST_ALLOCATION_BYTES = 1024 * 1024;
|
|
1379
1388
|
var DEFERRED_QUEUE_ID = {
|
|
1380
1389
|
DESTRUCTION_EVENTS: "destruction.events",
|
|
@@ -2213,10 +2222,12 @@ var GameAudio = (() => {
|
|
|
2213
2222
|
noise: () => noiseBuffer(store, audio, mix.noise.seconds),
|
|
2214
2223
|
time
|
|
2215
2224
|
});
|
|
2225
|
+
const recipeBank = registry.bankOf(plan.id);
|
|
2216
2226
|
announce({
|
|
2217
2227
|
id: plan.id,
|
|
2218
2228
|
kind: "recipe",
|
|
2219
2229
|
...fallbackOf ? { fallbackOf } : {},
|
|
2230
|
+
...recipeBank ? { bank: recipeBank } : {},
|
|
2220
2231
|
requestedAt,
|
|
2221
2232
|
startAt: time,
|
|
2222
2233
|
outputLatency: latencyOf(audio),
|
|
@@ -2318,9 +2329,11 @@ var GameAudio = (() => {
|
|
|
2318
2329
|
const time = requestedAt + (playOptions.delay ?? 0);
|
|
2319
2330
|
const chokeList = sample.choke ? choked(sample.id) : void 0;
|
|
2320
2331
|
const realized = realizeSample(plan, { context: audio, output: sampleOutput(plan.bus), buffer: (url2) => sampleStore.buffer(url2), time });
|
|
2332
|
+
const sampleBank = registry.bankOf(plan.id);
|
|
2321
2333
|
announce({
|
|
2322
2334
|
id: plan.id,
|
|
2323
2335
|
kind: "sample",
|
|
2336
|
+
...sampleBank ? { bank: sampleBank } : {},
|
|
2324
2337
|
requestedAt,
|
|
2325
2338
|
startAt: time,
|
|
2326
2339
|
outputLatency: latencyOf(audio),
|
|
@@ -3009,7 +3022,11 @@ var GameAudio = (() => {
|
|
|
3009
3022
|
["casing_drop_terra_pistol", 1],
|
|
3010
3023
|
["casing_drop_terra_rifle", 1],
|
|
3011
3024
|
["casing_drop_terra_shell", 1],
|
|
3012
|
-
["rocket_fire", 2]
|
|
3025
|
+
["rocket_fire", 2],
|
|
3026
|
+
["smg_45_auto", 2, "sfx_pistol"],
|
|
3027
|
+
["weapon_draw", 2],
|
|
3028
|
+
["suppressor_attach", 3],
|
|
3029
|
+
["suppressor_detach", 3]
|
|
3013
3030
|
]),
|
|
3014
3031
|
...entries("explosoes-fogo", [
|
|
3015
3032
|
["explosion_grenade", 1, "boom"],
|
|
@@ -3023,7 +3040,11 @@ var GameAudio = (() => {
|
|
|
3023
3040
|
["fire_loop_large", 1],
|
|
3024
3041
|
["fire_extinguish", 2, "hiss"],
|
|
3025
3042
|
["gas_leak_hiss", 2],
|
|
3026
|
-
["structure_collapse", 2, "crumble"]
|
|
3043
|
+
["structure_collapse", 2, "crumble"],
|
|
3044
|
+
["grenade_bounce", 1],
|
|
3045
|
+
["c4_plant", 2],
|
|
3046
|
+
["c4_beep", 2],
|
|
3047
|
+
["c4_disarm", 2]
|
|
3027
3048
|
]),
|
|
3028
3049
|
...entries("personagem", [
|
|
3029
3050
|
["footstep_concrete_walk", 1, "sfx_step"],
|
|
@@ -3039,7 +3060,19 @@ var GameAudio = (() => {
|
|
|
3039
3060
|
["blunt_hit", 1],
|
|
3040
3061
|
["bite", 1, "sfx_flesh"],
|
|
3041
3062
|
["body_fall", 1],
|
|
3042
|
-
["player_hurt", 2]
|
|
3063
|
+
["player_hurt", 2],
|
|
3064
|
+
["footstep_tile_walk", 1, "sfx_step"],
|
|
3065
|
+
["footstep_water_walk", 1, "sfx_step"],
|
|
3066
|
+
["footstep_grate_walk", 2, "sfx_step"],
|
|
3067
|
+
["footstep_duct_walk", 3, "sfx_step"],
|
|
3068
|
+
["ladder_climb", 2],
|
|
3069
|
+
["swim", 2],
|
|
3070
|
+
["zombie_groan", 1],
|
|
3071
|
+
["zombie_alert", 1],
|
|
3072
|
+
["zombie_attack", 1],
|
|
3073
|
+
["zombie_pain", 1],
|
|
3074
|
+
["zombie_claw_hit", 1, "sfx_flesh"],
|
|
3075
|
+
["zombie_claw_miss", 2]
|
|
3043
3076
|
]),
|
|
3044
3077
|
...entries("veiculos", [
|
|
3045
3078
|
["engine_loop_car", 1],
|
|
@@ -3067,7 +3100,8 @@ var GameAudio = (() => {
|
|
|
3067
3100
|
["wind_loop", 2],
|
|
3068
3101
|
["thunder_near", 2],
|
|
3069
3102
|
["thunder_far", 2],
|
|
3070
|
-
["water_splash", 2]
|
|
3103
|
+
["water_splash", 2],
|
|
3104
|
+
["helicopter_loop", 3]
|
|
3071
3105
|
])
|
|
3072
3106
|
];
|
|
3073
3107
|
var SFX_MATERIALS = [
|
|
@@ -3246,6 +3280,59 @@ var GameAudio = (() => {
|
|
|
3246
3280
|
return bank;
|
|
3247
3281
|
}
|
|
3248
3282
|
|
|
3283
|
+
// src/user-samples.ts
|
|
3284
|
+
var USER_SAMPLES_BANK = "user_samples";
|
|
3285
|
+
var KIT_SAMPLES_BANK = "kit_samples";
|
|
3286
|
+
var USER_SOUND_PREFIX = "user:";
|
|
3287
|
+
function soundSourceOf(event) {
|
|
3288
|
+
if (event.kind === "recipe") return "synth";
|
|
3289
|
+
return event.bank === USER_SAMPLES_BANK ? "user" : "sdk";
|
|
3290
|
+
}
|
|
3291
|
+
function userSampleBank(manifest, options = {}) {
|
|
3292
|
+
const playing = [];
|
|
3293
|
+
const behindKit = [];
|
|
3294
|
+
const sounds = [];
|
|
3295
|
+
for (const picked of manifest.sounds) {
|
|
3296
|
+
const sound = { ...picked, id: splitTier(picked.id).base };
|
|
3297
|
+
sounds.push({ ...sound, id: `${USER_SOUND_PREFIX}${sound.id}` });
|
|
3298
|
+
if (sound.role === "fallback" && options.kitHas?.(sound.id)) {
|
|
3299
|
+
behindKit.push(sound.id);
|
|
3300
|
+
continue;
|
|
3301
|
+
}
|
|
3302
|
+
sounds.push(sound);
|
|
3303
|
+
playing.push(sound.id);
|
|
3304
|
+
}
|
|
3305
|
+
const bank = sampleBankFromManifest(
|
|
3306
|
+
{ sounds },
|
|
3307
|
+
{
|
|
3308
|
+
id: USER_SAMPLES_BANK,
|
|
3309
|
+
baseUrl: options.baseUrl ?? "",
|
|
3310
|
+
defaults: (sound) => kitSampleDefaults({ id: sound.id.replace(USER_SOUND_PREFIX, ""), category: sound.category })
|
|
3311
|
+
}
|
|
3312
|
+
);
|
|
3313
|
+
return { bank, playing, behindKit };
|
|
3314
|
+
}
|
|
3315
|
+
var fetchManifestJson = async (url2) => {
|
|
3316
|
+
const page = globalThis.location?.href;
|
|
3317
|
+
if (new URL(url2, page ?? "http://localhost/").protocol === "file:") throw new Error(`${url2}: file:// is not fetched`);
|
|
3318
|
+
const response = await fetch(url2);
|
|
3319
|
+
if (!response.ok) throw new Error(`${url2}: ${response.status}`);
|
|
3320
|
+
return await response.json();
|
|
3321
|
+
};
|
|
3322
|
+
async function loadUserSamples(engine, options = {}) {
|
|
3323
|
+
const baseUrl = options.baseUrl ?? "./sfx-local/";
|
|
3324
|
+
let manifest;
|
|
3325
|
+
try {
|
|
3326
|
+
manifest = await (options.fetchManifest ?? fetchManifestJson)(`${baseUrl}manifest.json`);
|
|
3327
|
+
} catch {
|
|
3328
|
+
return null;
|
|
3329
|
+
}
|
|
3330
|
+
const kitHas = options.kitHas ?? ((id) => Boolean(engine.registry?.sample(id)));
|
|
3331
|
+
const result = userSampleBank(manifest, { baseUrl, kitHas });
|
|
3332
|
+
engine.register(result.bank);
|
|
3333
|
+
return result;
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3249
3336
|
// src/data/game-sfx.json
|
|
3250
3337
|
var game_sfx_default = {
|
|
3251
3338
|
sources: ["jogo:L62089-62107"],
|
|
@@ -3473,6 +3560,82 @@ var GameAudio = (() => {
|
|
|
3473
3560
|
var LIBRARY_LOOPS = [engine_saw_default, rotor_blades_default, crowd_rumble_default];
|
|
3474
3561
|
var LIBRARY_BANK = { id: "library", sounds: LIBRARY_SOUNDS, loops: LIBRARY_LOOPS };
|
|
3475
3562
|
|
|
3563
|
+
// src/library/cabin.ts
|
|
3564
|
+
var CABIN_SOUNDS = [
|
|
3565
|
+
{
|
|
3566
|
+
id: "blinker_tick",
|
|
3567
|
+
bus: "world",
|
|
3568
|
+
duration: 0.03,
|
|
3569
|
+
layers: [
|
|
3570
|
+
// the relay: a click of bright noise and a short low knock
|
|
3571
|
+
{ source: { kind: "noise", offset: "random" }, filters: { mode: "serial", bank: [{ type: "highpass", frequency: { set: 2600 } }] }, envelope: [[0, 0.22, "set"], [0.025, 1e-4, "exp", "fixed"]] },
|
|
3572
|
+
{ source: { kind: "osc", wave: "triangle", frequency: { set: 180 } }, envelope: [[0, 0.12, "set"], [0.03, 1e-4, "exp", "fixed"]] }
|
|
3573
|
+
],
|
|
3574
|
+
falloff: { model: "none" }
|
|
3575
|
+
},
|
|
3576
|
+
{
|
|
3577
|
+
id: "starter_crank",
|
|
3578
|
+
bus: "world",
|
|
3579
|
+
duration: 0.9,
|
|
3580
|
+
layers: [
|
|
3581
|
+
// the starter motor turning the engine over: low noise chopped at the compression strokes
|
|
3582
|
+
{
|
|
3583
|
+
source: { kind: "noise", offset: "random" },
|
|
3584
|
+
filters: { mode: "serial", bank: [{ type: "lowpass", frequency: { set: 420 } }] },
|
|
3585
|
+
modulators: [{ target: "gain", wave: "square", rate: 11, depth: 0.08, base: 0.1 }],
|
|
3586
|
+
envelope: [[0, 1e-4, "set", "fixed"], [0.05, 0.25, "linear"], [0.8, 0.22, "set"], [0.9, 1e-4, "exp", "fixed"]]
|
|
3587
|
+
},
|
|
3588
|
+
{ source: { kind: "osc", wave: "sawtooth", frequency: { set: 95, to: 120, curve: "linear", over: 0.9 } }, filters: { mode: "serial", bank: [{ type: "lowpass", frequency: { set: 300 } }] }, envelope: [[0, 0.04, "set"], [0.9, 1e-4, "exp", "fixed"]] }
|
|
3589
|
+
],
|
|
3590
|
+
falloff: { model: "none" }
|
|
3591
|
+
},
|
|
3592
|
+
{
|
|
3593
|
+
id: "car_alarm",
|
|
3594
|
+
bus: "world",
|
|
3595
|
+
order: "siren",
|
|
3596
|
+
duration: 3,
|
|
3597
|
+
tail: 0.1,
|
|
3598
|
+
layers: [
|
|
3599
|
+
// the whoop of a car alarm: a square swept up and down three times a second
|
|
3600
|
+
{
|
|
3601
|
+
source: { kind: "osc", wave: "square", frequency: { set: 1100 } },
|
|
3602
|
+
modulators: [{ target: "frequency", wave: "triangle", rate: 3, depth: 420 }],
|
|
3603
|
+
filters: { mode: "serial", bank: [{ type: "lowpass", frequency: { set: 2600 } }] },
|
|
3604
|
+
envelope: [[0, 1e-4, "set", "fixed"], [0.05, 0.05, "linear"], [2.9, 0.05, "set"], [3, 1e-4, "exp", "fixed"]]
|
|
3605
|
+
}
|
|
3606
|
+
],
|
|
3607
|
+
falloff: { model: "none" }
|
|
3608
|
+
},
|
|
3609
|
+
{
|
|
3610
|
+
id: "alarm_chirp",
|
|
3611
|
+
bus: "world",
|
|
3612
|
+
duration: 0.1,
|
|
3613
|
+
layers: [{ source: { kind: "osc", wave: "square", frequency: { set: 2300 } }, repeat: { count: 2, spacing: 0.16 }, envelope: [[0, 0.05, "set"], [0.09, 1e-4, "exp", "fixed"]] }],
|
|
3614
|
+
falloff: { model: "none" }
|
|
3615
|
+
},
|
|
3616
|
+
{
|
|
3617
|
+
id: "wiper_swish",
|
|
3618
|
+
bus: "world",
|
|
3619
|
+
duration: 0.45,
|
|
3620
|
+
layers: [
|
|
3621
|
+
{
|
|
3622
|
+
source: { kind: "noise", offset: "random" },
|
|
3623
|
+
filters: { mode: "serial", bank: [{ type: "bandpass", frequency: { set: 700, to: 1100, curve: "linear", over: 0.45 }, q: 1.2 }] },
|
|
3624
|
+
envelope: [[0, 1e-4, "set", "fixed"], [0.2, 0.06, "linear"], [0.45, 1e-4, "exp", "fixed"]]
|
|
3625
|
+
}
|
|
3626
|
+
],
|
|
3627
|
+
falloff: { model: "none" }
|
|
3628
|
+
},
|
|
3629
|
+
{
|
|
3630
|
+
id: "seatbelt_chime",
|
|
3631
|
+
bus: "world",
|
|
3632
|
+
duration: 0.5,
|
|
3633
|
+
layers: [{ source: { kind: "osc", wave: "sine", frequency: { set: 880 } }, repeat: { count: 3, spacing: 0.7 }, envelope: [[0, 0.06, "set"], [0.5, 1e-4, "exp", "fixed"]] }],
|
|
3634
|
+
falloff: { model: "none" }
|
|
3635
|
+
}
|
|
3636
|
+
];
|
|
3637
|
+
var CABIN_BANK = { id: "vehicle_cabin", sounds: CABIN_SOUNDS, loops: [] };
|
|
3638
|
+
|
|
3476
3639
|
// src/recipes/foley.ts
|
|
3477
3640
|
var FOLEY_FALLOFF = {
|
|
3478
3641
|
model: "inverse_square",
|