From 4c744da3e2ca73fd06eb78e3d67284fc9690387e Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 31 Aug 2023 10:52:36 +0200 Subject: [PATCH] add zzfx sound + zzfx control to override params --- packages/core/controls.mjs | 1 + packages/superdough/zzfx.mjs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 4982ec53..92eda843 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -816,6 +816,7 @@ const generic_params = [ ['zcrush'], // like crush but scaled differently ['zdelay'], ['tremolo'], + ['zzfx'], ]; // TODO: slice / splice https://www.youtube.com/watch?v=hKhPdO0RKDQ&list=PL2lW1zNIIwj3bDkh-Y3LUGDuRcoUigoDs&index=13 diff --git a/packages/superdough/zzfx.mjs b/packages/superdough/zzfx.mjs index be2c479a..da505d74 100644 --- a/packages/superdough/zzfx.mjs +++ b/packages/superdough/zzfx.mjs @@ -26,6 +26,7 @@ export const getZZFX = (value, t) => { zdelay = 0, tremolo = 0, duration = 0.2, + zzfx, } = value; const sustainTime = Math.max(duration - attack - decay, 0); if (typeof note === 'string') { @@ -39,7 +40,7 @@ export const getZZFX = (value, t) => { const shape = ['sine', 'triangle', 'sawtooth', 'tan', 'noise'].indexOf(s) || 0; curve = s === 'square' ? 0 : curve; - const params = [ + const params = zzfx || [ 0.25, // volume zrand, freq, @@ -76,7 +77,7 @@ export const getZZFX = (value, t) => { }; export function registerZZFXSounds() { - ['z_sine', 'z_sawtooth', 'z_triangle', 'z_square', 'z_tan', 'z_noise'].forEach((wave) => { + ['zzfx', 'z_sine', 'z_sawtooth', 'z_triangle', 'z_square', 'z_tan', 'z_noise'].forEach((wave) => { registerSound( wave, (t, value, onended) => {