This commit is contained in:
Jade (Rose) Rowland
2025-06-27 16:12:00 -04:00
parent 39b9d2b9b5
commit 0df20ca5bf
3 changed files with 86 additions and 1 deletions
+12
View File
@@ -160,6 +160,18 @@ export const { velocity } = registerControl('velocity');
*
*/
export const { gain } = registerControl('gain');
/**
* Applies a linear gain adjustment
*
* @name gainlinear
* @synonyms gainlin
* @param {number | Pattern} amount gainl.
* @example
* s("hh*8").gainlin(".4!2 1 .4!2 1 .4 1").fast(2)
*
*/
export const { gainlinear, gainlin } = registerControl('gainlinear', 'gainlin');
/**
* Gain applied after all effects have been processed.
*
+5 -1
View File
@@ -35,7 +35,7 @@ export function registerSound(key, onTrigger, data = {}) {
soundMap.setKey(key, { onTrigger, data });
}
let gainCurveFunc = (val) => val;
let gainCurveFunc = (val) => Math.pow(val, 2);
export function applyGainCurve(val) {
return gainCurveFunc(val);
@@ -482,6 +482,7 @@ export const superdough = async (value, t, hapDuration, cps) => {
bank,
source,
gain = getDefaultValue('gain'),
gainlinear,
postgain = getDefaultValue('postgain'),
density = getDefaultValue('density'),
// filters
@@ -559,6 +560,9 @@ export const superdough = async (value, t, hapDuration, cps) => {
delay = applyGainCurve(delay);
velocity = applyGainCurve(velocity);
gain *= velocity; // velocity currently only multiplies with gain. it might do other things in the future
if (gainlinear != null) {
gain *= gainlinear;
}
const chainID = Math.round(Math.random() * 1000000);