Is it possible to create an envelope that doesn’t start and/or end with a 0?
(pwl t1 l1 t2 l2 … tn) and (env t1 t2 t4 l1 l2 l3 dur) - start and end with 0, so I found (pwlv l1 t2 l2 t3 l3 … tn ln)
(pwlv l1 t2 l2 t3 l3 … tn ln) - Creates a piece-wise linear envelope with breakpoints at (0, l1), (t2, l2), etc., ending with (tn, ln)
I thought this one should work, but it didn’t. It also produces little fade-in in the beginning and little fade-out in the end.
And one more thing. Using pwl, env and pwlv in Nyquist prompt makes the sound smaller with a few samples.
For example: my source sound contains 140304 samples, after I apply:
(mult s (pwlv 0 1 1))
Audacity says the “new” sound contains 140300 samples.
Pwl works at a sample-rate “control-srate” thich is normally a 20th of the actual sample rate.
This produces a fade-in over 20 samples and does also shorten the sound in some cases (where the remaining samples falls under 10 samples or so)
You can use (control-srate-abs sound-srate ) to work at sample-level.
You are welcome.
I usually use the low-level function ‘snd-pwl’, especially for cases where accuracy and independence from the selected audio is demanded.
Providing the start time and sample rate is required.
(snd-pwl 0 44100 '(0 0.0 88200 1.0 88200))
The times are in samples and integers, whereas the sample values have to be flonums.
Calculations have to be enclosed in a list:
I decided not to start a new thread, but to continue here, because it’s related, I think.
I want to make a plugin (so I can call it with a keyboard shortcut) to “interpolate” the sound.
I read that I can’t access the sound beyond selection with nyquist, so I decided to use the first half of selection as source and to crossfade out/in its sound to the second half (to repair some “problem”).
The result wasn’t what you wanted because your “fade-in” and “fade-out” control signals faded over a duration of “1” (the full duration of the selection) which is double the length of S1 and S2.