PDA

View Full Version : Scripting an "auto pan" track functionality


Per Boysen
12-10-2009, 01:32 PM
Hi guys,

I'm wondering if anyone has found out a way to script Track Pan behavior similar to an autopan plug-in?

Background is that I am working on a low-cpu-use looping rig with Mobius AU in Mainstage on Snow Leopard. My first build used Mobius AU with multiple outputs (8x) and this gives a wonderful sound with autofilter plug-ins applied to all all eight looper track outputs to juggle the stereo pan a bit at varied time cycles. Gives a nice organic stereo sound that breathes life into repeating loops. But my 2.2 GHz MacBook is not strong enough for taking this on stage within the safety zone ;-) So then I tried the Stereo AU version of Mobius and got rid of all the autopan plug-ins and this saves me about 20 % CPU juice. But I really like the sound of gently panning parallel loops, so I decided to try out the best way to apply real-time panning to Mobius pan parameter. I tried with the Bidule AU plug-in where I set up a random sequencer to send out MIDI CC through IAC bus 2 and then I assigned Mainstage pan control objects to this as incoming external control and to Mobius pan as target parameter. This works very well, but only one Mobius track increased the CPU use by ten percent. So I left that concept right there. The only option left now is to research if a script within Moibus can be set up to wiggle the pan parameter. I suspect this would be way more CPU efficient. This doesn't have to be "continue for ever" type of script. It may as well be binded to just about any action that you take quite often, like if every time you change loop or track an extra script is also activated; with a long chain of pan parameter value changes in pseudo random fashion by "Wait cycle" lines in between. Does this make sense? I have an annoying feeling that there is a much easier way to achieve this....

Jeff
12-11-2009, 06:52 PM
Scripting a pan wiggle is fairly simple, the harder part
will be stopping it. Here's the basic script that
goes on forever.


!name Pan Me

Variable direction up

# loop forever
while 1
if direction == up
set pan pan + 1
if pan = 127
set direction down
endif
else
set pan pan - 1
if pan = 0
set direction up
endif
endif

# the millisecond wait time determines
# the speed of the pan
Wait msec 20
next



This will be canceled only when you Reset the loop.


You can add a control variable to make it stop, then
set this control variable in other scripts:


!name Pan Me

Variable track PanMeStop false
Variable direction up

while PanMeStop = false
...




You would then stop it from other scripts with:


!name Stop All Pans
Variable track PanMeStop
for *
set PanMeStop true
next


The main problem is that you have to use a script to stop
them, you can't have them stop automatically when certain
functions are used, for example stop as soon as you
start Overdub.

Jeff

Per Boysen
12-11-2009, 10:11 PM
Thanks a lot! I will test this right away. The "stopping it" problem is not an issue with me because the autopan default I'm used to is to have track 1, 2, 3 and 4 constantly panning. With this script I can use different kinds of multi track panning setups for different kinds of pieces. Awesome! And if running each track at a different panning speed I think this will acheive my "sea of sounds" ideal just as good as the autopan in Bidule or Autofilters in Mainstage. Actually I think I can use the same script and just do a "for 1, for 2, for 3, for 4" thingy and make sure the static panning is differently positioned for those tracks before starting the auto pan script. Excited to check out the exact CPU usage of this script!

Per Boysen
12-11-2009, 11:12 PM
It's working fine!

I first tried to set up a script that sets track 1 to 4 at different starting pan positions and then starts this script on all four tracks, but I wasn't able to make that work. Only the first track was affected.

Then I found it to be a better strategy to simply start the script for the selected track, because then you can manually decide how to offset its panning cycle to other panning tracks. This works brilliantly! However, when I do a Global Reset to kick off the next song all panning tracks become synchronized and I'm afraid this is a show stopper.

I tried to fix the synchronizing panning problem by setting different initial pan values for all tracks in the Track Setup. But then I noticed that the "Pan me" script raises the CPU load to over 100%. Oh well... fun to experiment though!