Sonic Pi 3.2.2 and Scratch 3 project

I’ll take a look at it and then post a cut down version below…

EDITED here is a cut down sonic pi progarm which will work with the other two files (scratch and python scripts) and will work with the first 7 keys. (You can adapt for more or less. You can delete the key “blobs” you don’t need/want from the scratch script).
I suggest you leave the python script as is, although it could be modified for fewer keys.

Change the samples in the Sonic Pi program for whatever samples you want.

#Sonic Pi Scratch3 interface by Robin Newman, May 2020 amended Aug 2020
#plays one of 7 samples using the first 7 key "blobs" on the scratch interface.
use_osc "localhost",8000
#osc "/testprint","hello there"
osc "/start",0
set :flag,true

live_loop :waitReset do
  use_real_time
  r = sync "/osc*/reset"
  set :flag,false
  osc "/start",1
end

with_fx :reverb,room: 0.8,mix: 0.7 do
  
  live_loop :test2 do
    use_real_time
    k= sync "/osc*/playOn"
    if get(:flag) == true
      p=k[0]
      puts p
      if p<7
        z = sample [:bd_haus,:loop_amen,:loop_garzul, :loop_mika, :loop_tabla,:loop_electric,:loop_perc1][p]
        k=sync "/osc*/playOff"
        control z,amp: 0,amp_slide: 0.05
        sleep 0.05
        kill z #kill sample after quick fade
      end
    end
  end
end