Why mono for the Pan effect?

Hello,
Ok, so I have been wondering why the heck the “Pan.ny” and “PanRamp.Ny” plugins are designed to make the stereo input sound mono before panning left or right? To me, this seems like a waste of time because I myself prefer more of a “walking stereo” effect. For simplicity I can take maybe 440 HZ on the left channel and 550 HZ on the right channel just as an example. When I use both pan functions, both 440 and 550 can be heard on the same channel, so I know there is something to delete in the plugin so that if, for instance, you start on the right side, it will fade in from 550 to 440 almost like a crossfade. So the right channel fades out and the left channel fades in, or vice versa, whatever. After looking at the text in the plugin I was not very sure what I should delete so that the plugin doesn’t make it mono before applying, because especially for me, I totally dislike mono. Thanks and I hope you can help.

Michael

So the right channel fades out and the left channel fades in, or vice versa, whatever.

That’s Split Stereo and two different, opposing fades. That’s probably why the existing tools don’t do what you want. You want to effectively go back to the original, live recording and remix it, re-panning each instrument while they were still single channel performances.

I’m not sure these tools will do that, and I don’t know enough about the programming to fix it, but my guess is you’re looking for completely different tools.

Koz

I presume that you are talking about these effects: http://wiki.audacityteam.org/wiki/Nyquist_Effect_Plug-ins#Panning
There’s no reason why it ‘must’ be that way - it’s just how David decided he wanted the effects to work.

There are many ways that panning can be done.
Here are three snippets that can be run in the Nyquist Prompt effect:

;version 4
;type process

;; in and out control signals
(setf in-envelope (control-srate-abs *sound-srate* (pwlv 0 1 1)))
(setf out-envelope (control-srate-abs *sound-srate* (pwlv 1 1 0)))

(let ((*track* (mult 0.5 (sum (aref *track* 0)(aref *track* 1)))))
  (vector
    (mult *track* in-envelope)
    (mult *track* out-envelope)))



;version 4
;type process

;; in and out control signals
(setf in-envelope (control-srate-abs *sound-srate* (pwlv 0 1 1)))
(setf out-envelope (control-srate-abs *sound-srate* (pwlv 1 1 0)))

(vector
  (mult (aref *track* 0) in-envelope)
  (mult (aref *track* 1) out-envelope))



;version 4
;type process

;; in and out control signals
(setf in0 (control-srate-abs *sound-srate* (pwlv 0 0.5 0.5 1 0.5)))
(setf in1 (control-srate-abs *sound-srate* (pwlv 0 0.5 0 1 0.5)))
(setf out0 (control-srate-abs *sound-srate* (pwlv 0.5 0.5 0.5 1 0)))
(setf out1 (control-srate-abs *sound-srate* (pwlv 0.5 0.5 0 1 0)))

(let ((left (aref *track* 0))
      (right (aref *track* 1))
      (mono (mult 0.5 (sum (aref *track* 0)(aref *track* 1)))))
  (vector
    (sum (mult left in0)
         (mult mono in1))
    (sum (mult right out0)
         (mult mono out1))))

It always seems you think I’d be ok with just a Nyquist prompt. Well, I’m not really keen on jumping directly to Nyquist Prompt, I prefer actual plugins so that in case there is an error I can just make changes to it. Also I’m using 2.0.6, because to me, 2.1.2 is a bit on the fancy side for my taste. Here’s the code so you might be able to help me modify it.

;nyquist plug-in
;version 1
;type process
;name “Panning (ramp)…”
;action “Applying ramp panning…”
;info “by David R. Sky\n-10 is left, 0 is center, 10 is right\nReleased under terms of GNU Public License”

;control start “Start position” real “where” -10 -10 10
;control end “End position” real “where” 10 -10 10

; Ramp Panning by David R. Sky
; simplified to match Audacity 1.3.1 static pan positions
; from -10 left to 10 right pan positions
; Released under terms of the GNU Public License
; http://www.opensource.org/licenses/gpl-license.php

(defun pan-position (position)
(+ 0.5 (* 0.05 (float position))))

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

(pan2
; making any stereo signal sound mono
(vector
(sum (aref s 0) (aref s 1))
(sum (aref s 1) (aref s 0)))
(pwl 0 (pan-position start) 1 (pan-position end) 1))



All I want to do is not to make it mono before changing the pan, that’s all. So it will still pan from where1 to where2, just not make it mono because I HATE mono. A special case occurs when the right channel volume on a file for instance is suddenly turned down, and though the audio is the same on both channels except for volume, the left channel doesn’t change volume until a second after the right one does, so I’m trying to make it so it’s totally left-channel, then quickly “walks across” the channels to the right channel so the volume change isn’t so sudden. Does that help or not?

I’m giving Nyquist Prompt examples because, of the three types of panning shown, you probably don’t want 2 of them, or perhaps you don’t want any of them but want something a bit different. It’s hardly a good use of my time to create full plug-ins for each example if we are going to discard two or all three of them. Better that we work out exactly what you want, then implement that.

Your choice, but that means that you will need to modify “version 4” plug-ins because Audacity 2.0.6 only supports up to version 3 plug-ins. (“version 4” plug-ins is one of the “fancy” new things).

This page has information about plug-in versions: http://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference
In many cases, to convert from version 4 to version 3, you will just need to change the “;version” header, and change any occurrence of track to s.
If the plug-in use version 4 property lists then it may not be possible to convert it to version 3.

OK, so that is what you don’t want to do. I’m not totally clear about what you do want.
Do you want “panning” to just fade out the opposite channel?

Example:
Pan hard Left => Left channel:100%, Right channel:0%
Pan 50% Left => Left channel:100%, Right channel:50%
Pan Centre => Left channel:100%, Right channel:100%
Pan 50% Right => Left channel:50%, Right channel:100%
Pan hard Right => Left channel:0%, Right channel:100%

(The reason for my uncertainty is because your description sounds like this is what you want, but this is not “true panning”. For true panning, when panned left there should be both the original left and original right channels in the new left channel.)

Well … … I’m afraid, here we go again… I just fixed it but I want to share the differences in the coding (i.e. old code making it mono vs new code).

Old code:

;nyquist plug-in
;version 1
;type process
;name “Mono ramp panning…”
;action “Applying ramp panning…”
;info “by David R. Sky\n-10 is left, 0 is center, 10 is right\nReleased under terms of GNU Public License”

;control start “Start position” int “where” -10 -10 10
;control end “End position” int “where” 10 -10 10

; Ramp Panning by David R. Sky
; simplified to match Audacity 1.3.1 static pan positions
; from -10 left to 10 right pan positions
; Released under terms of the GNU Public License
; http://www.opensource.org/licenses/gpl-license.php

(defun pan-position (position)
(+ 0.5 (* 0.05 (float position))))

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

(pan2
; making any stereo signal sound mono
(vector
(sum (aref s 0) (aref s 1))
(sum (aref s 1) (aref s 0)))
(pwl 0 (pan-position start) 1 (pan-position end) 1))




New code:
;nyquist plug-in
;version 1
;type process
;name “Stereo ramp panning…”
;action “Applying ramp panning…”
;info “by David R. Sky\n-10 is left, 0 is center, 10 is right\nReleased under terms of GNU Public License”

;control start “Start position” real “where” -10 -10 10
;control end “End position” real “where” 10 -10 10

; Ramp Panning by David R. Sky
; simplified to match Audacity 1.3.1 static pan positions
; from -10 left to 10 right pan positions
; Released under terms of the GNU Public License
; http://www.opensource.org/licenses/gpl-license.php

(defun pan-position (position)
(+ 0.5 (* 0.05 (float position))))

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

(pan2

(vector (sum (aref s 0))
(sum (aref s 1)))
(pwl 0 (pan-position start) 1 (pan-position end) 1))



So, it can’t be that much different. Oh, and by the way, I’ve always wondered what you would type so that whatever plugin doesn’t round a value to the nearest number of samples? I prefer exact fractionals seconds to sample-rounding myself, so I’m just curious about that. I know it’s probably not quite related to the Pan plugin, but I just thought that while I’m in here I could just ask.

Michael

PS. From the “Bass boost” plugin, I’ve modified (and saved a new version) of this plugin calling it “Trebel boost”, simply replacing “Lowshelf” with “Highshelf” and making the range appropriate to higher end frequencies. Now keep in mind that I’ve never even read the Nyquist manuals!

Are you referring to PWL or something else?

Well, for example, in a delay effect, I’d like it to delay at exactly 1/240 of a second, just an example. I calculate 1 / 240 using Calculator and I get: 0.00416666666666666666666666666667. When I do the Delay effect (Inverted delay by the way, which I modified from the existing Delay), it does not cancel out 240 HZ after generating a 240 HZ saw wave with your HQ Tone plugin, primarily because I don’t like aliasing waves myself. There is still a bit of 240 HZ that I can hear even after delaying the effect. With another audio program, I can move by sample-pixels, which depending on the Zoom setting, each pixel is worth iether 64 samples, 128 samples, 256 samples, 512 samples etc etc etc. So I select a sample rate of 61440 to navigate by either 1/120, 1/240, 1/480, etc etc etc. Saving the generated 240 HZ tone as a Wav file, when I delay across 1/240 of a second using the higher sample rate on the other program, the tone completely cancels out. On the standard Delay program, I still can hear a bit of 240 HZ residue, so I think this has to do with the fact that it rounds to the nearest sample. My guess is that there’s not really anything to counteract that, but who knows.

You can tell Nyquist to calculate the shift at a different sample rate by resampling the track before it is shifted, (then resample back to the original sample rate), or for better quality resampling, oversample the track using Audacity’s “Resample” command before processing with Nyquist.