Synced sequenced loops

Hi there!
Im trying to make a song with three different layers: percussion, bass line and main line. The following is what the percussion looks like (kind of a sequencer with consecutive loops):

use_bpm 60

dunbala =    [1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0]
kaxa =       [0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0]
txindata  =  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]


live_loop :perkusio do
  2.times do
    16.times do |beat|
      sample :drum_bass_hard if dunbala[beat] == 1
      # sample :glitch_perc1, amp: 0.3 if kaxa[beat] == 1
      sleep 0.25
    end
  end
  4.times do
    16.times do |beat|
      sample :drum_bass_hard if dunbala[beat] == 1
      sample :glitch_perc1, amp: 0.5  if kaxa[beat] == 1
      sleep 0.25
    end
  end
end

Probably not the most Sonic-piy way but I find it very pedagogical to teach variables, conditionals and loops. Also, it is super straightforward to port it from any online drum sequencer.
The thing is I’d like to add two more layers (bass line and main line) to this one in a similar way. Say, playing a chord or a sample when the second pattern of the percussion begins or triggerring an arpegio on the second iteration of the first pattern… You get the idea.
I was thinking of three live_loops but getting sync problems.
Any suggestion?
Thanks a lot!

Hi @kezkabarra you can do the same for bass.

use_bpm 60

dunbala =    [1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0]
kaxa =       [0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0]
txindata  =  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
bassline  =  [0,1,1,1,0,0,1,1,0,1,0,1,1,0,1,1]


live_loop :perkusio do
  2.times do
    16.times do |beat|
      sample :drum_bass_hard, on: dunbala[beat]
      # sample :glitch_perc1, amp: 0.3 if kaxa[beat] == 1
      sleep 0.25
    end
  end
  4.times do
    16.times do |beat|
      sample :drum_bass_hard, on: dunbala[beat]
      sample :glitch_perc1, amp: 0.4, on: kaxa[beat]
      sleep 0.25
    end
  end
end

live_loop :bass do
  use_synth :tb303
  play (chord :C2, :madd2).tick, release:0.2, amp: 0.4, cutoff: 72, on: bassline.look

  sleep 0.125
end

Also replaced your if with on:. Sam recommended that this was the desirable way to achieve this outcome. You can swap out chord for scale or ring if you want to define a specific sequence of notes.

To get it playing when a particular pattern plays look up the use of cue to get specific patterns/blocks playing.

Regards
Hussein

3 Likes

Hi, @Hussein!
Thanks a lot! I didn’t expect it to be so easy. I thought live loops should be explicitly synced even when started at the same time.
See you,
Iker.

@kezkabarra I’m not an expert but I think sync is used to establish a correspondence. You can see the effect it has by using different sleep values. Where in a live_loop both can have independent sleep values, once sync’d the same values will achieve a different affect. i.e. one that is relational. At least, that’s my understanding of it.

#example 1
live_loop :l1 do
  sample :bd_haus
  sleep 0.5
end

live_loop :l2 do
  sample :tabla_ghe1
  sleep 0.25
end
#example 2
live_loop :l1 do
  sample :bd_haus
  sleep 0.5
end

live_loop :l2 do
  sync :l1
  sample :tabla_ghe1
  sleep 0.25
end

Hope that helps
Hussein

2 Likes

It does help. Thanks once again!

2 Likes