Merge remote-tracking branch 'origin/pump' into 25.8.1

This commit is contained in:
Jade (Rose) Rowland
2025-07-27 15:44:12 -04:00
2 changed files with 13 additions and 14 deletions
+1 -1
View File
@@ -561,7 +561,7 @@ export const { tremoloshape } = registerControl('tremoloshape', 'tremshape');
* stack( n(run(8)).scale("c:minor").s("sawtooth").delay(.7).orbit(2), s("bd:4!4").beat("0,4,8,11,14",16).duckorbit(2).duckattack(0.2).duckdepth(1))
*
*/
export const { duck } = registerControl(['duckorbit', 'duckattack', 'duckdepth'], 'duck');
export const { duck } = registerControl('duckorbit', 'duck');
/**
* the amount of ducking applied to target orbit
+12 -13
View File
@@ -420,20 +420,19 @@ function setOrbit(audioContext, orbit, channels) {
}
}
function duckOrbit(targetOrbit, t, attacktime = 0.1, duckdepth = 1) {
const targetArr = [targetOrbit].flat()
targetArr.forEach(target => {
if (orbits[target] == null) {
errorLogger(new Error('duck target orbit does not exist'), 'superdough');
}
orbits[target].gain.gain.cancelAndHoldAtTime(t);
const currVal = orbits[target].gain.gain.value;
orbits[target].gain.gain.setValueAtTime(currVal, t);
orbits[target].gain.gain.linearRampToValueAtTime(clamp(1 - duckdepth, 0.01, currVal), t + 0.002);
orbits[target].gain.gain.exponentialRampToValueAtTime(1, t + Math.max(0.002, attacktime));
})
const targetArr = [targetOrbit].flat();
targetArr.forEach((target) => {
if (orbits[target] == null) {
errorLogger(new Error(`duck target orbit ${target} does not exist`), 'superdough');
return;
}
orbits[target].gain.gain.cancelAndHoldAtTime(t);
const currVal = orbits[target].gain.gain.value;
orbits[target].gain.gain.setValueAtTime(currVal, t);
orbits[target].gain.gain.linearRampToValueAtTime(clamp(1 - Math.pow(duckdepth, 0.5), 0.01, currVal), t + 0.002);
orbits[target].gain.gain.exponentialRampToValueAtTime(1, t + Math.max(0.002, attacktime));
});
}
let hasChanged = (now, before) => now !== undefined && now !== before;