fix lookahead
This commit is contained in:
parent
a20468b85f
commit
5ff59a878d
2 changed files with 4 additions and 3 deletions
|
|
@ -547,7 +547,8 @@ export const { tremoloshape } = registerControl('tremoloshape', 'tremshape');
|
||||||
* @name duckorbit
|
* @name duckorbit
|
||||||
* @param {number | Pattern} orbit target orbit
|
* @param {number | Pattern} orbit target orbit
|
||||||
* @example
|
* @example
|
||||||
* 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))
|
* $: n(run(16)).scale("c:minor:pentatonic").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', 'duck');
|
export const { duck } = registerControl('duckorbit', 'duck');
|
||||||
|
|
|
||||||
|
|
@ -432,11 +432,11 @@ function duckOrbit(audioContext, targetOrbit, t, attacktime = 0.1, duckdepth = 1
|
||||||
() => {
|
() => {
|
||||||
orbits[target].gain.gain.cancelScheduledValues(t);
|
orbits[target].gain.gain.cancelScheduledValues(t);
|
||||||
const currVal = orbits[target].gain.gain.value;
|
const currVal = orbits[target].gain.gain.value;
|
||||||
orbits[target].gain.gain.linearRampToValueAtTime(clamp(1 - Math.pow(duckdepth, 0.5), 0.01, currVal), t + 0.002);
|
orbits[target].gain.gain.linearRampToValueAtTime(clamp(1 - Math.pow(duckdepth, 0.5), 0.01, currVal), t);
|
||||||
orbits[target].gain.gain.exponentialRampToValueAtTime(1, t + Math.max(0.002, attacktime));
|
orbits[target].gain.gain.exponentialRampToValueAtTime(1, t + Math.max(0.002, attacktime));
|
||||||
},
|
},
|
||||||
0,
|
0,
|
||||||
t,
|
t - 0.01,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue