I have spent the last few days developing a visualiser for Sonic Pi written in P5.js This is my first foray into P5.js although I have used processing before. Quite a steep learning curve to get all the bits workig together, especially working out how to add OSC support. I’m quite pleased with the end result which has around 40 parameters controllable via OSC messages. I have developed a TouchOSC template which can be used to control it, but you can also include OSC commands sent from Sonic Pi.
Here is a piece which uses a folder of percussion samples which I wrote some time ago, but have now added OSC commands to it to control the visualiser.
It would be a large task to do a write up on this, as there is a lot invloved, but let me know if you are interested and I’ll see if I can do something.
here is a listing of the Sonic PI end for this piece.
#piece to test out my Sonic Pi visualiser, controlled from Sonic Pi. use_osc "192.168.1.128",12000 osc "/1/transShape",1 osc "/1/transStar",0.35 osc "/1/starVol",0.6 osc "/1/jitterVol",1 use_random_seed 987123 kill=0 with_fx :level do |v| control v,amp: 0 sleep 0.02 in_thread do loop do tick control v,amp: look.to_f/40 if look <40 control v,amp: 1-[(look-400).to_f/40,1].min if look >400 sleep 0.2 kill=1 if look >440 stop if look >440 end end zDrumSamplesPath="/Users/rbn/Downloads/DrumsetSamplesFlac" with_fx :gverb,room: 25 do live_loop :drmrave do tick use_bpm 30+rand_i(90) if look%20==0 sample zDrumSamplesPath,rrand_i(35,81)-35, rpitch: rrand_i(-24,24),amp: rrand(0.4,1.8),pan: rrand(-1,1) sleep rrand(0.05,0.2) stop if kill==1 end end end live_loop :oscControl,sync: :drmrave do tick tick_set :t4,look/4 c=rand_i(8) osc "/1/pt"+c.to_s,1 if c > 1 osc"/1/allOff",1 if c==1 j=(ring 0,1).look(:t4) osc "/1/jitter",j osc "/1/colInvert",rand_i(); ilist=['/1/inc0','/1/inc2','/1/inc4'] osc ilist.choose,1 alist=['/1/angle45','/1/angleNeg45','/1/angle30','/1/angleNeg30','/1/resetAngle'] if j==0 osc alist.choose,1 else osc "/1/resetAngle",1 end osc "/1/smallStarEnable",rand_i(); sleep 1 end