diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index fe691c365..f9207afad 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -3537,7 +3537,7 @@ export const morph = (frompat, topat, bypat) => { const _asArrayPattern = (pats) => { const pack = (...xs) => xs; let acc = pure(curry(pack, null, pats.length)); - for (const p of pats) acc = acc.appLeft(p); + for (const p of pats) acc = acc.appBoth(p); return acc; }; @@ -3551,12 +3551,10 @@ const _asArrayPattern = (pats) => { */ Pattern.prototype.FX = function (...effects) { effects = effects.map(reify); - return this.outerBind((v) => { - return _asArrayPattern(effects).withValue((vEff) => { - const currFX = v.FX ?? []; - return { ...v, FX: currFX.concat(vEff) }; - }); - }); + return this.withValue((v) => (vEff) => { + const currFX = v.FX ?? []; + return { ...v, FX: currFX.concat(vEff) }; + }).appLeft(_asArrayPattern(effects)); }; /** diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index 738cbf48f..36c6d5129 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -523,6 +523,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) velocity = getDefaultValue('velocity'), shapevol = getDefaultValue('shapevol'), drive = getDefaultValue('drive'), + distorttype = getDefaultValue('distorttype'), distortvol = getDefaultValue('distortvol'), tremolodepth = getDefaultValue('tremolodepth'), phaserdepth = getDefaultValue('phaserdepth'), @@ -623,7 +624,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) fx.coarse !== undefined && chain.push(getWorklet(ac, 'coarse-processor', { coarse: fx.coarse })); fx.crush !== undefined && chain.push(getWorklet(ac, 'crush-processor', { crush: fx.crush })); fx.shape !== undefined && chain.push(getWorklet(ac, 'shape-processor', { shape: fx.shape, postgain: shapevol })); - fx.distort !== undefined && chain.push(getDistortion(fx.distort, distortvol, fx.distorttype)); + fx.distort !== undefined && chain.push(getDistortion(fx.distort, distortvol, distorttype)); let tremolo = fx.tremolo; if (fx.tremolosync != null) { @@ -633,7 +634,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) if (tremolo !== undefined) { // Allow clipping of modulator for more dynamic possiblities, and to prevent speaker overload // EX: a triangle waveform will clip like this /-\ when the depth is above 1 - const gain = Math.max(1 - fx.tremolodepth, 0); + const gain = Math.max(1 - tremolodepth, 0); const amGain = new GainNode(ac, { gain }); const time = cycle / cps;