games: widen foley pitch variance so takes are actually distinct
vary was a per-step multiplier of ~0.05, capping the swing at a barely audible +/-0.10. Redefine vary as the max deviation itself (chips +/-0.22, cards +/-0.20) and spread it over seven pitch steps; give the single-take shuffle a wobble too.
This commit is contained in:
@@ -127,18 +127,20 @@
|
|||||||
|
|
||||||
var SAMPLE_BASE = "/static/audio/casino/";
|
var SAMPLE_BASE = "/static/audio/casino/";
|
||||||
var SAMPLES = {
|
var SAMPLES = {
|
||||||
// A card thrown down onto the table.
|
// A card thrown down onto the table. `vary` is the largest fraction a take is
|
||||||
card: { files: ["cardPlace1", "cardPlace2", "cardPlace3", "cardPlace4"], gain: 0.6, vary: 0.04 },
|
// ever pitched by, up or down — 0.20 means a play can land anywhere from a fifth
|
||||||
|
// slower (deeper) to a fifth faster (brighter).
|
||||||
|
card: { files: ["cardPlace1", "cardPlace2", "cardPlace3", "cardPlace4"], gain: 0.6, vary: 0.20 },
|
||||||
// A card slid into place — softer, longer than a throw.
|
// A card slid into place — softer, longer than a throw.
|
||||||
deal: { files: ["cardSlide1", "cardSlide2", "cardSlide3", "cardSlide4", "cardSlide5", "cardSlide6"], gain: 0.5, vary: 0.05 },
|
deal: { files: ["cardSlide1", "cardSlide2", "cardSlide3", "cardSlide4", "cardSlide5", "cardSlide6"], gain: 0.5, vary: 0.20 },
|
||||||
// A card flicked over.
|
// A card flicked over.
|
||||||
flip: { files: ["cardFan1", "cardFan2"], gain: 0.5, vary: 0.04 },
|
flip: { files: ["cardFan1", "cardFan2"], gain: 0.5, vary: 0.18 },
|
||||||
// The riffle.
|
// The riffle — one take, so the pitch wobble is all that keeps two shuffles apart.
|
||||||
shuffle: { files: ["cardShuffle"], gain: 0.6 },
|
shuffle: { files: ["cardShuffle"], gain: 0.6, vary: 0.10 },
|
||||||
// A clay chip set down on a stack.
|
// A clay chip set down on a stack.
|
||||||
chip: { files: ["chipLay1", "chipLay2"], gain: 0.6, vary: 0.05 },
|
chip: { files: ["chipLay1", "chipLay2"], gain: 0.6, vary: 0.22 },
|
||||||
// Chips gathered and slid away.
|
// Chips gathered and slid away.
|
||||||
sweep: { files: ["chipsHandle2", "chipsHandle4", "chipsHandle6"], gain: 0.5, vary: 0.03 },
|
sweep: { files: ["chipsHandle2", "chipsHandle4", "chipsHandle6"], gain: 0.5, vary: 0.14 },
|
||||||
};
|
};
|
||||||
|
|
||||||
// Decoded buffers by filename. A value of null means "claimed, in flight or
|
// Decoded buffers by filename. A value of null means "claimed, in flight or
|
||||||
@@ -194,9 +196,10 @@
|
|||||||
if (!buf) return false; // not decoded yet, or failed: let synth cover it
|
if (!buf) return false; // not decoded yet, or failed: let synth cover it
|
||||||
var src = ctx.createBufferSource();
|
var src = ctx.createBufferSource();
|
||||||
src.buffer = buf;
|
src.buffer = buf;
|
||||||
// A few percent off pitch, walking with the same cursor, so even a single-take
|
// Pitch, walking with the same cursor across seven steps between -vary and
|
||||||
// sound like the shuffle isn't pitch-identical twice in a row.
|
// +vary, so even a single-take sound like the shuffle isn't identical twice in
|
||||||
if (cfg.vary) src.playbackRate.value = 1 + (((k % 5) - 2) * cfg.vary);
|
// a row. Seven steps rather than a couple means the runs don't read as a loop.
|
||||||
|
if (cfg.vary) src.playbackRate.value = 1 + (((k % 7) - 3) / 3) * cfg.vary;
|
||||||
var g = ctx.createGain();
|
var g = ctx.createGain();
|
||||||
g.gain.value = cfg.gain == null ? 0.6 : cfg.gain;
|
g.gain.value = cfg.gain == null ? 0.6 : cfg.gain;
|
||||||
src.connect(g).connect(master);
|
src.connect(g).connect(master);
|
||||||
|
|||||||
Reference in New Issue
Block a user