|
#1
|
||||
|
||||
|
I’m using 3 loops per track and I would like the feature of continuously scrolling back and forth between loops 1 and 2 until I give it a key press to stop and return to loop 1?
So far I’ve achieved… Code:
!name Continuos-Scroll-L1-L2 # If on loops 2 or 3 then go to loop 1 if LoopNumber = 2 for * loop 1 next elseif LoopNumber = 3 for * loop 1 next endif wait last # If on loop 1 go to loop2 or if on loop 2 go to loop 1 if LoopNumber = 1 wait last wait loop for * loop 2 next endif wait last if LoopNumber = 2 wait last wait loop for * loop 1 next endif end
__________________
Be Lucky In Life... Glynn Cakewalk Sonar Producer 8.5.3, and Sonar X2a, HP pavilion dv6 3031TX, Win7-64-bit, 2x Behringer FCB1010, Edirol UA-25, Edirol Quad UA-55, Edirol PCR-500, Rode NT1A, KRK Rokit 8 Monitors, PODxt, AKG520 Cans, too many guitars to list and a Dog |
|
#2
|
||||
|
||||
|
First let's talk about a general script technique I usualy call Modal Scripts. When you run the script
the first time it does something and then enters a "mode" by setting a global variable. When you run the script again we cancel the mode by clearing the global variable. Here's a basic example: Code:
!name Modal Example Variable global inMode false if inMode Message Leaving Mode set inMode false else Message Entering Mode set inMode true endif what you want, we'll continuously switch between loop 1 and loop 2. Code:
!name Loop 1/2 Cycle Mode
Variable global inMode false
if inMode
set inMode false
else
set inMode true
while inMode
wait loop
if loopNumber == 1
loop2
else
loop1
endif
next
endif
It's kind of hard to explain how this works without dragging in some programming concepts. When you run a script is like starting an application or more accurately starting a "thread" within an application. You have many scripts running at the same time and they can communicate with each other with global variables. Extending this to loop swap on all tracks is more complicated because the tracks are not necessarily the same length. If you are absolutely sure they are the same size you can do this: Code:
!name Loop 1/2 Cycle Mode All
Variable global inMode false
if inMode
set inMode false
else
set inMode true
while inMode
wait loop
for *
if loopNumber == 1
loop2
else
loop1
endif
next
next
endif
If the tracks loops can be of different lengths, it is more complicated. We can't use "Wait loop" in a single script because we need to wait different amounts of time in each track. For this to work we can't run one script we have to run parallel scripts in each track. One way to do that is to assign all tracks to a group, then bind a trigger to the script giving it a scope of that track group. For example give all tracks group A and in the binding window select A in the scope selector. Now when you press the trigger, it will run one copy of the script in each track in the group. The problem now is the global variable. There is only one set of global variables, you need to have a different one for each track. To solve this change the variable declation to be a track variable: Code:
Variable track inMode false Code:
!name Loop 1/2 Cycle
Variable track inMode false
if inMode
set inMode false
else
set inMode true
while inMode
wait loop
if loopNumber == 1
loop2
else
loop1
next
next
endif
Jeff |
|
#3
|
||||
|
||||
|
Jeff, firstly a big thankyou for the effort you have put into my recent questions, and I get the concept of Modal Scripts. Real Cool!
With regards to script, “Loop 1/2 Cycle Mode All” I get the following results…
e.g. If on T5-L1 and run script; T5,T6,T7,T8 will move to loop 2 and T1,T2,T3,T4 will stay on loop 1 and wait extra loop. e.g. If on T6-L1 and run script; T6,T7,T8 will move to loop 2 and T1,T2,T3,T4,T5 will stay on loop 1 and wait extra loop.The causation would seems to be “track irregular lengths” but can this be so if…
Code:
Variable cyclesIn3 for 3 set cyclesIn3 cycleCount wait last next for 1 InstantMultiply cyclesIn3 next for 2 InstantMultiply cyclesIn3 next for 4 InstantMultiply cyclesIn3 Next ……………..and so on till T8 Because they’re no tracks left of track 1, a workaround is to add at start of your script… Variable saveTrack track Track 1 To some degree this is a gremlin remover, but with more testing I find this only works if loops 1& 2 are both even numbered. That is to say… Loop 1 = 2 cycles and loop 2 = 2 cycles it works Loop 1 = 3 cycles and loop 2 = 3 cycles it works Loop 1 = 2 cycles and loop 2 = 3 cycles Loops out of sync left of active track. Loop 1 = 3 cycles and loop 2 = 5 cycles Loops out of sync left of active track. With regards to script, “Loop 1/2 Cycle” I get the following results… After assigning all tracks to a group-A, and setting scope selector, script Works unless…
Jeff, I would really like to get to the bottom of this out of sync left of active track problem. I have encountered it before and is holding me back perfecting some other script concepts.
__________________
Be Lucky In Life... Glynn Cakewalk Sonar Producer 8.5.3, and Sonar X2a, HP pavilion dv6 3031TX, Win7-64-bit, 2x Behringer FCB1010, Edirol UA-25, Edirol Quad UA-55, Edirol PCR-500, Rode NT1A, KRK Rokit 8 Monitors, PODxt, AKG520 Cans, too many guitars to list and a Dog |
|
#4
|
||||
|
||||
|
Dead thread, awh!
Just when it was getting interesting too! Sigh, Have you ever seen a dalek turning left or right on full lock? Wow they know how to loop!
__________________
Be Lucky In Life... Glynn Cakewalk Sonar Producer 8.5.3, and Sonar X2a, HP pavilion dv6 3031TX, Win7-64-bit, 2x Behringer FCB1010, Edirol UA-25, Edirol Quad UA-55, Edirol PCR-500, Rode NT1A, KRK Rokit 8 Monitors, PODxt, AKG520 Cans, too many guitars to list and a Dog |
|
#5
|
||||
|
||||
|
This has to be a bug!
Test Conditions In tracks 1 to 8 / Loop 1, I loaded the same wave 908 KB in size In tracks 1 to 8 / Loop 2, I loaded the same wave 679 KB in size Then I run the following script… Code:
name Loops 1-2-Cycle-Mode
Variable global inMode false
if inMode
set inMode false
else
set inMode true
while inMode
wait loop
for *
if loopNumber = 1
loop2
else
loop1
endif
next
next
endif
Tracks to left of active track wait an additional cycle before advancing to next loop
__________________
Be Lucky In Life... Glynn Cakewalk Sonar Producer 8.5.3, and Sonar X2a, HP pavilion dv6 3031TX, Win7-64-bit, 2x Behringer FCB1010, Edirol UA-25, Edirol Quad UA-55, Edirol PCR-500, Rode NT1A, KRK Rokit 8 Monitors, PODxt, AKG520 Cans, too many guitars to list and a Dog |
|
#6
|
||||
|
||||
|
I don’t know if anyone has been following this thread but here is my solution.
Firstly I’ll recapitulate with My Matrix setup, Objective, Problem and Solution. My Matrix Setup I dedicated 9 different instruments to each of 9 Mobius tracks. Each track has 3 loops. I usually but not always follow the pattern below Loop 1 = verse, Loop 2 = chorus, Loop 3 = bridge, Objective. Once I have instruments recorded as above, I like to jam away over the top and want to be able to initiate all 9 tracks to toggle verse, chorus, verse, chorus, until I’m jammed out. So once again I became a scriptwriting masochist. Problem. It’s all laid out in the previous posts. Thanks to Jeff ‘s explanation and coding of “Modal Scripts” I all but achieved my goal. When the script was executed, the active track and all tracks to the right togged Verse/Chorus beautifully. Problem was that tracks to the left of the active track waited an additional cycle before advancing to next loop. Catastrophic results! resembling dismembered Non-musical thoughts. Solution. Hardly elegant and a little quirky but it works! I added code so the script would make track 1 the active track. (so there’s no tracks to the left to go out of sync) Also note, moving to track 1 is OK because I only want to jam and not overdub. So now the script does the following… On first button press… Remember track I’m on. (Variable saveTrack track)On second button press… Stop toggling Code:
!name Cool Bananas!
#!autoload
message Cool Bananas!
Variable saveTrack track
Track 1
Variable global inMode false
if inMode
set inMode false
else
set inMode true
while inMode
wait loop
#######
for *
if LoopNumber == 1
loop 2
else
loop 1
endif
next
next
endif
next
for *
Loop 1
next
Track saveTrack
END END END END END END END END END END END END
__________________
Be Lucky In Life... Glynn Cakewalk Sonar Producer 8.5.3, and Sonar X2a, HP pavilion dv6 3031TX, Win7-64-bit, 2x Behringer FCB1010, Edirol UA-25, Edirol Quad UA-55, Edirol PCR-500, Rode NT1A, KRK Rokit 8 Monitors, PODxt, AKG520 Cans, too many guitars to list and a Dog |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|