i’d like to make effects be applied softly fading in and out of an audio track, so i don’t have to duplicate tracks and use cross fade (which is what i’ve done for years). is there a code that does that or gives the options to do that, that i can write on a .ny file? or, would it work if i pasted compressor (attack, release) options? or would i have to do an effect myself? i’m just being introduced to nyquist, but my interest and dedication really depends on how or if i can solve this issue of mine with it.
Nyquist cannot (yet) access Audacity’s built-in effects or other plug-ins, so to fade in/out an effect in one track you would need to write the effect as a Nyquist effect, or modify an existing Nyquist effect. How complex that task is depends on the effect. In some cases it can be simple, for example, this code (which can be run in the “Nyquist Prompt” () fades in a reverb effect over the first 1/3rd of the selection, then fades out the effect over the final 1/3rd.
(sim (mult 0.5 (pwlv 0 (/ 1.0 3.0) 1 (/ 2.0 3.0) 1 1 0) (jcrev *track* 2 0.5)) (mult (pwlv 1 (/ 1.0 3.0) 0 (/ 2.0 3.0) 0 1 1) *track*))
Quick explanation of the code:
“SIM” “adds” (mixes) sounds (or numbers).
“MULT” multiplies sounds (or numbers).
“PWLV” creates a low sample rate control signal by piece-wise linear interpolation. That is, it creates a signal that changes level between points that are specified as a time/amplitude pair. http://www.cs.cmu.edu/~rbd/doc/nyquist/part8.html#index389
“JCREV” is a reverb effect. http://www.cs.cmu.edu/~rbd/doc/nyquist/part8.html#index465
What the code does is much the same as you have been doing manually.
The second line creates a reverb effect that fades in from zero amplitude at time=0 to full amplitude at time=1/3 (for an effect, time is relative to the length of the selection), then fades out from time=2/3 to silence at time=1 (end of the selection). The “0.5” factor simply scales the effect to half amplitude to counter the increase in level created by the reverb effect.
The final line fades out the unprocessed audio selection (track) over the first 1/3rd, and fades it back in in the final 1/3rd (the reverse of the “envelope” used in line 2).