# How to fix Multiple Time Signature timing



## tshoats (Aug 15, 2017)

Hey guys, is there a feasible way to have seperate listeners for multiple sequences, with different time signatures playing at the same time?. I have different note repeats that I want to sync together. But anytime I change the listener for anyone , It throws the note repeats timing off. Is there a way to have seperate listeners for each note repeat?? Is seems as if, when I change the listener for a seperate note repeat, its a global effect. Any advice??


```
on int
    set_listener(NI_SIGNAL_TIMER_BEAT,4)
    set_listener($NI_SIGNAL_TRANSP_START,1)
    set_listener($NI_SIGNAL_TRANSP_STOP,1)

  {Variables etc....}
declare ui_menu $note_repeat1
    add_menu_item($note_repeat1,"Note Repeat",0)
    add_menu_item($note_repeat1,"1/4 Note",1)
    add_menu_item($note_repeat1,"1/8 Note",2)
    add_menu_item($note_repeat1,"1/12 Note",3)
    add_menu_item($note_repeat1,"1/16 T Note",4)

     declare ui_menu $note_repeat2
    add_menu_item($note_repeat2,"Note Repeat",0)
    add_menu_item($note_repeat2,"1/4 Note",1)
    add_menu_item($note_repeat2,"1/8 Note",2)
    add_menu_item($note_repeat2,"1/12 Note",3)
    add_menu_item($note_repeat2,"1/16  Note",4)
end on


on  listener 



   if($NI_SIGNAL_TYPE= $NI_SIGNAL_TRANSP_START)
    $tick_counter := 0
    $bar_start :=0
   end if  
   
    if ($NI_SONG_POSITION-(3840*($NI_SONG_POSITION/3840))<4)
         $bar_start :=1
    end if
     
     
     if ($NI_SIGNAL_TYPE = $NI_SIGNAL_TIMER_BEAT  )


        if($NI_TRANSPORT_RUNNING = 1 and $bar_start = 1)

               {Note Repeat 1}
            if(%kick_steps[$counter] # 0)

              if($note_repeat1 = 1)
                change_listener_par(NI_SIGNAL_TIMER_BEAT,4)
              end if
              if($note_repeat1 = 2)
                change_listener_par(NI_SIGNAL_TIMER_BEAT,8)
              end if
               if($note_repeat1 = 3)
                change_listener_par(NI_SIGNAL_TIMER_BEAT,12)
              end if
               if($note_repeat1 = 4)
                change_listener_par(NI_SIGNAL_TIMER_BEAT,16)
              end if
             

             $myEven:= play_note(35,%kick_steps[$counter],0,0)
              {set_event_par_arr(ID_number,parameter,value,group_idx)}
              set_event_par_arr($myEven, $EVENT_PAR_ALLOW_GROUP,0, 1)                
            end if    



               {Note Repeat 2}

              if(%snare_steps[$counter] # 0)


                 if($note_repeat2 = 1)
                    change_listener_par(NI_SIGNAL_TIMER_BEAT,4)
                 end if
                  if($note_repeat2 = 2)
                       change_listener_par(NI_SIGNAL_TIMER_BEAT,8)
                 end if
                 if($note_repeat2 = 3)
                     change_listener_par(NI_SIGNAL_TIMER_BEAT,12)
                 end if
                if($note_repeat2 = 4)
                      change_listener_par(NI_SIGNAL_TIMER_BEAT,16)
                 end if
             
             $myEven:= play_note(23,%snare_steps[$counter],0,0)
              set_event_par_arr($myEven, $EVENT_PAR_ALLOW_GROUP,1, 1)  
              set_event_par_arr($myEven, $EVENT_PAR_ALLOW_GROUP,0, 0)  
       
            end if 

        end if


              inc($counter)                     
            if($counter >= $num_steps)
                  $counter :=0
            end if


        if($NI_TRANSPORT_RUNNING # 1 or $NI_SIGNAL_TYPE = $NI_SIGNAL_TRANSP_STOP )
                   $counter :=0
                   $bar_start :=1
          end if

     end if    


   
end on
```


----------



## Lindon (Aug 17, 2017)

set the listener to 24 times/beat increment a counter for each sequencer, action the sequencer:


```
if %seq_count[idx] mod %sig[idx] = 0
```


----------



## tshoats (Aug 18, 2017)

@Lindon thanks, I got this slightly to work using your suggestion. I'm wondering if its better to use different script slots for each signature. This way each listener would be seperate.


----------



## EvilDragon (Aug 18, 2017)

No, it's not. One slot is enough.


----------



## tshoats (Aug 18, 2017)

@Evil Dragon & Lindon, thanks, I was able to use the Modulo (mod) operator to get the appropriate time signatures within one slot


----------

