add pcurve

This commit is contained in:
Felix Roos 2024-01-17 17:35:35 +01:00
parent 3fc0fdbe62
commit 0655af4d4f
2 changed files with 4 additions and 1 deletions

View File

@ -897,6 +897,7 @@ const generic_params = [
['psustain', 'psus'],
['prelease', 'prel'],
['penv'],
['pcurve'],
['panchor'],
// TODO: https://tidalcycles.org/docs/configuration/MIDIOSC/control-voltage/#gate
['gate', 'gat'],

View File

@ -145,6 +145,7 @@ export function drywet(dry, wet, wetAmount = 0) {
return mix;
}
let curves = ['linear', 'exponential'];
export function getPitchEnvelope(param, value, t, holdEnd) {
if (value.penv) {
let [pattack, pdecay, psustain, prelease] = getADSRValues([
@ -157,7 +158,8 @@ export function getPitchEnvelope(param, value, t, holdEnd) {
const cents = value.penv * 100; // penv is in semitones
const min = 0 - cents * panchor;
const max = cents - cents * panchor;
getParamADSR(param, pattack, pdecay, psustain, prelease, min, max, t, holdEnd, 'linear');
const curve = curves[value.pcurve ?? 0];
getParamADSR(param, pattack, pdecay, psustain, prelease, min, max, t, holdEnd, curve);
}
}