1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-13 15:38:56 +02:00
2010-01-24 09:19:39 +00:00

18 lines
633 B
Plaintext

(CONGEN
(NAME "congen")
(ARGUMENTS ("sound_type" "sndin") ("double" "risetime") ("double" "falltime"))
(START (MIN sndin))
(STATE ("double" "value" "0")
("double" "rise_factor" "exp(log(0.5) / (sndin->sr * risetime))")
("double" "fall_factor" "exp(log(0.5) / (sndin->sr * falltime))"))
(CONSTANT "fall_factor" "rise_factor")
(ALWAYS-SCALE sndin)
(TERMINATE (MIN sndin))
(INNER-LOOP " sample_type current = sndin;
if (current > value) {
value = current - (current - value) * rise_factor;
} else {
value = current - (current - value) * fall_factor;
}
output = (sample_type) value;"))