This sketch shows Sonic Pi editing the sketch on each pass of the live loop, and syncing some sounds to the sketch.
code below
#Sonic Pi 5 tech preview
#generates hydra sketch controlled by Sonic Pi
#sketch coded by Robin Newman, February 2023
use_debug false
##| hydra "solid().out()"
##| stop
use_random_seed(1436)
live_loop :burst do
tick
ls=[3,4].choose.to_s
ns=[1,1.5].choose.to_s
ss=[0.25,0.4,0.2,0.8,0.4].look.to_s
#build hydra string
hh="shape(4).scale(1,30/64.0,1).out(o0)" #used to check scaling should be a square if shown by hdray. Adjust experimntally
h= "speed = 1
osc("+ls+",0.3,2)
.layer(
osc(1,0,2).mask(noise("+ns+").thresh(0.01,1e-6))
.rotate(()=>0.5*Math.sin(time)))
.scale("+ss+")
.kaleid(9).colorama(-0.1).rotate(()=> Math.PI/2*Math.sin(time/2 ))
.scale(1,30/64.0,1) //added to compensate for the aspect ratio of output screen I was using
.out(o0)
"
#puts h
#create hydra
hydra h
use_transpose [0,12].look #toggle transpose each loop pass
#play a tone for the duration of one cycle of the output hydra
k=synth [:tb303,:fm,:blade].choose,note:(:e2),release: 2*Math::PI,cutoff: 100,amp: 0.6
#sweep the tome frequency up and down as it sounds
control k,note: :e4,note_slide: Math::PI
sleep Math::PI #sleep half duration of note
control k,note: :e2,note_slide: Math::PI
sleep Math::PI #sleep half duration of note
end