Fully working version

This commit is contained in:
Aria
2025-10-22 22:32:14 -05:00
parent 837b87e13a
commit 29ee90f994
2 changed files with 8 additions and 9 deletions
+5 -7
View File
@@ -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));
};
/**
+3 -2
View File
@@ -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;