Panning L to R over time

Is there a way to actively pan L to R on a .wav track over time - say 30 seconds…i.e. how can I pan an instrument hard left to hard right over a 30 second time period?

“Panning (LFO)” plugin is one way …
https://wiki.audacityteam.org/wiki/Download_Nyquist_Plug-ins#Amplify.2C_Mix_and_Pan_Effects

Hi Trebor, thanks for your quick response. I am a novice with using the keyboard and am getting an error message. I am trying to pan a 15 second segment of a stereo file from 100% Left to Center. Here’s the formula I put in the Nyquist Prompt (for the 15 second highlighted segment - Left to Center):

(defun pan2 (sound (0))
   (vector (mult (aref sound 0) (sum 1 (mult -1 (0))))
       (mult (aref sound 1) (0.5))))

And here’s the error message that shows up when I click on debug:

error: bad formal argument list
Function: #<FSubr-DEFUN: #909d178>
Arguments:
  PAN2
  (SOUND (0))
  (VECTOR (MULT (AREF SOUND 0) (SUM 1 (MULT -1 (0)))) (MULT (AREF SOUND 1) (0.5)))
1>

Sorry to ask again, but I’m just not familiar with this type of prompt entry. Is there something obvious you can see that I am doing wrong?

When defining a function, the syntax is:

(defun function-name (arguments)
body…)

Where “arguments” are zero or more assignments.

You wrote in your first line:

(defun pan2 (sound (0))

but “(0)” is not a valid expression in Nyquist.


To do that, you probably want the the left channel to fade out from 100% to 50%, and the right channel to fade in from 0% to 50%.

Control signals can be generated using “piecewise approximations” (documented here in SAL syntax rather than the original Nyquist syntax: https://www.cs.cmu.edu/~rbd/doc/nyquist/part2.html#15).

To generate a control signal from 100% to 50%:

(pwlv 1 1 0.5)

To generate a control signal from 0% to 50%:

(pwlv 0 1 0.5)

To apply these two control signals to left and right channels respectively:

(vector (mult (pwlv 1 1 0.5) (aref *track* 0))
        (mult (pwlv 0 1 0.5) (aref *track* 1)))

which you can then run in the Nyquist Prompt effect.

No need to write code, just install & enable the plugin …

Pan Demo.gif

Thanks Steve and Trebor, I downloaded Panning ramp with the installer and it worked perfectly! Appreciate your advice and help