how do islow down loop

Discuss problems and solutions.
Post Reply
electrofux
Regular
Posts: 294
Joined: 24 Jan 2012 18:22

how do islow down loop

Post by electrofux »

hI want to scan Reasons sequencer page, so that it moves slowly through each sequencer track and grabs all the information that is sent from Reason to Lemur befor it jumps to the next track.
Therefore i have to slow down the for loop i have set up. Any idea how i can do that? Something like wait 0.5s per loop iteration would be cool.
electrofux
Regular
Posts: 294
Joined: 24 Jan 2012 18:22

Re: how do islow down loop

Post by electrofux »

for a better understanding. Lets say i have 30 Midi/Instrument Tracks in Reason and whenever i select one Reason sends the instrument type and the name of the track in 2 sysex messages. I want to step through all channels via a "for loop" and on each iteration select the next channel, catch the sysex, decode it and write that in an array. The problem is, the "for loop" i am doing this in, is too fast and i have problems slowing it down.

I have tried to add two other for loops into the first one but that soemhow breaks the main loop.

Code: Select all

for (i=1;i<30;i++)
		{
		ctlout(1,10,127,16);//this moves the track focus up by one track on each iteration so that it end up on the first track
		}



for (a=1;a<30;a++)
		{
		ctlout(1,14,127,16);//this moves the track focus down by one track on each iteration
                //here i would like to have a 0.3s wait
		sequtracks[a]=sequencertrack;//here i write the trackname into an array
		sslmixertracks[a]=MixerChannel;//here i write the Mixchannelname into an array
		correspondingsynths[a]=scope;//here i write the Instrumentnam into an array
                 //here i would like to have a 0.3s wait
		}

I tried to mess around with the time variable as a condition but that didnt work out so far.
Then i tried to add another "for loop" within the main one to slow things down but that messes up the main loop for some reason.
Then i set the loop to 30000 and tried to only send midi out in steps by 1000 but the loop allways breaks at 4761 iterations.
It seems like a for (and while) loop breaks if it takes too long so i am at a loss here.
electrofux
Regular
Posts: 294
Joined: 24 Jan 2012 18:22

Re: how do islow down loop

Post by electrofux »

I made it working somehow, with a conection of a couple scripts including an on frame script. I think this is a dirty solution and really would like to know the most effective way to make a timed series of commands.
electrofux
Regular
Posts: 294
Joined: 24 Jan 2012 18:22

Re: how do islow down loop

Post by electrofux »

What i did was to use an on expression script with:

Code: Select all

if (floor(time%60)%1==0) 
		{
				ctlout(1,14,127,16);

                }

and that gets turned on and off as needed.

Now i fiddled around alot with the time variable not really sure what i am doing. This gives me a 1 second intervall and was actually working :-). How would a 0.5 or 0.25 second intervall look like. I have tried to half the 60 or the 1 but it turned out not to be what i was looking for.
Post Reply