Sonic Pi OSC to Improviz 3 and 5 vs 5 and 7

Sonic Pi

# 220826 Sonic Pi OSC to Improviz 3 and 5  vs 5 and 7
# YT https://youtu.be/-Ser93R0scc
# Created by https://linktr.ee/relaxnow aka livecodingdk

use_bpm 120

use_osc "localhost", 5510  # Setup OSC to Improviz port


live_loop :kick1 do
  a=5  # 5
  b=7 # 7
  sample :bd_haus, cutoff: 85, amp: 4 if spread(a,b).tick
  puts osc "/vars/tab1", 1  if spread(a,b).look# OSC to Improviz in variable tab2 = 1
  sleep 0.25
  puts   osc "/vars/tab1", 0  # OSC to Improviz in variable tab2 = 0
  sleep 0.25
end

live_loop :kick2 do
  #32.times do
  a=3  # 3
  b=5  # 5
  sample :bd_haus, cutoff: rrand(90,115), amp: 4, rate: 4 if spread(a,b).tick
  puts osc "/vars/tab2", 1  if spread(a,b).look# OSC to Improviz in variable tab2 = 1
  sleep 0.25
  puts   osc "/vars/tab2", 0  # OSC to Improviz in variable tab2 = 0
  sleep 0.25
  #end
end

# reset background in Improviz
live_loop :reset do
  puts   osc "/vars/tab4", 0
  sleep 0.25*64*2*1.5             # time before reset
  puts osc "/vars/tab4", 10 # reset background in Improviz
  sleep 0.25
end

Improviz

paintOver()

# 220825 2327 OSC kick.pz
# 220826 Sonic Pi OSC to Improviz 3 and 5  vs 5 and 7
# YT https://youtu.be/-Ser93R0scc


t = time/2
background(0)
strokeSize(2)
#noFill()
#stroke(255)  # nice
scale(1) # 1 0.8 2


a=0
#bd1 = ext(:bd1,a)
#bd2 = ext(:bd2,a)
#bd3 = ext(:bd3,a)

tab1 = ext(:tab1, a)#/100
tab2 = ext(:tab2, a)#/100
tab3 = ext(:tab3, a)/100
tab4 = ext(:tab4, 0)
#if (t%2)


b = 0.25 #thickness

# tab4
#rotate(0,0,t)
fill(0)
#move(1,0,0)
rectangle(tab4,tab4,tab4)

# tab1
rotate(0,0,t)
fill(255,150,0)
move(1,0,0)
rectangle(tab1,0.01,0.01)

#tab2
fill(255,0,0)
move(1,0,0)
rectangle(tab2,0.01,0.01)


## thin white lines
fill(255)  # white
move(-4,0,0)
rectangle(3,0.000125,0.000125)  # thin white lines

#delete black
#fill(0)  # white
#move(-4,0,0)
#rectangle(2,0.5,0.5)
#rectangle(2,0.05,0.05)
#rectangle(3,0.0125,0.0125)  # thin white lines



move(-2,0,0)
rotate(0,0,-t*0.25)


#rotate(t)