basic pitch envelope

This commit is contained in:
Felix Roos 2024-01-15 23:25:22 +01:00
parent a7daf41934
commit bdc2af9733
2 changed files with 19 additions and 0 deletions

View File

@ -891,6 +891,13 @@ const generic_params = [
*
*/
['freq'],
// pitch envelope
['pattack', 'patt'],
['pdecay', 'pdec'],
['psustain', 'psus'],
['prelease', 'prel'],
['penv'],
['panchor'], // TODO
// TODO: https://tidalcycles.org/docs/configuration/MIDIOSC/control-voltage/#gate
['gate', 'gat'],
// ['hatgrain'],

View File

@ -126,6 +126,12 @@ export function getOscillator(
fmvelocity: fmVelocity,
fmwave: fmWaveform = 'sine',
duration,
penv,
// panchor = 0, // TODO
pattack,
pdecay,
psustain,
prelease,
},
) {
let ac = getAudioContext();
@ -196,6 +202,12 @@ export function getOscillator(
vibratoOscillator.start(t);
}
// pitch envelope
if (penv) {
const holdEnd = t + duration;
getParamADSR(o.detune, pattack, pdecay, psustain, prelease, 0, penv * 100, t, holdEnd, 'linear');
}
let noiseMix;
if (noise) {
noiseMix = getNoiseMix(o, noise, t);