YT Sonic Pi creation + How to setup visuals in Punctual with audio mic reactivity in Estuary

Sonic Pi code

# 240117 2336 Punctual Estuary exploration with prophet noise fx octaver and define on drums in Sonic Pi YT
# Saved 240117 2336
# https://youtu.be/IKMEmHDd2z4
# https://in-thread.sonic-pi.net/t/sonic-pi-creation-how-to-setup-visuals-in-punctual-with-audio-mic-reactivity-in-estuary/8553


define :myspread do |s, amp, a,b,c, d,e,f, pan|
  tick
  p = (spread(a,b)*c+spread(d,e)*f)
  sample s, amp: amp, pan: pan if p.look
end

with_fx :reverb, room: 0.4 do
  
  
  live_loop :a1 do
    #tick
    with_fx :octaver, mix: 0.9,subsub_amp: 2 do
      
      density [1,1,1,3].look do
        tick
        myspread(:bd_fat, 3, 7,16,3, 5,16,1, rdist(0.25))
        myspread(:bd_fat, 1, 7,12,3, 4,7,1, rdist(0.5))
        myspread(:elec_tick, 2, 7,16,3, 5,16,1, rdist(1))
        
        
        
        sleep 0.5
      end
    end
  end
  
  
  
  with_fx :distortion, mix: 1, distort: 0.8 do
    live_loop :a3 do
      density [1,1,1,3].look do
        tick
        
        
        use_synth :prophet
        use_synth  :noise
        
        #use_synth  :cnoise
        #use_synth  :bnoise
        #use_synth  :gnoise
        #use_synth  :pulse
        #use_synth [:prophet, :bnoise].choose
        #use_synth [:bnoise, :cnoise, :noise, :gnoise].choose
        use_synth_defaults amp: 2, attack: 0, sustain: 0,
          release: [0.15,0.2,0.25].choose,
          cutoff: [55,65,75,85].choose-10,  pan: rdist(0.5)
        
        n1 = :g3
        n2 = :g4
        n2 = :g4+12
        
        # Patterns for :prophet
        # 1,   2,   3,4,5,  2,6
        s = 32
        bass =2
        bass = knit(1,s,2,s, 3,s,4,s,5,s, 2,s,6,s).look
        bass = 0
        case bass
        when 0
        when 1
          play n1 if spread(7,12).look
        when 2
          play n1 if spread(7,12).look
          play n2 if spread(5,7).look
          
        when 3
          play n1 if spread(7,12).look
          play n2+5 if spread(5,7).look
        when 4
          play n1 if spread(7,12).look
          play n2+8 if spread(5,7).look
        when 5
          play n1 if spread(7,12).look
          play n2+7 if spread(5,7).look
          
        when 6
          play n1-2 if spread(7,12).look
          play n2-2 if spread(5,7).look
          
        end
        
        
        sleep 0.5
      end
    end
  end
  
end
live_loop :a2 do
  with_fx :reverb, room: 0.98 do
    #play :c5-0, amp: 0.7
    #sample :loop_drone_g_97, amp: 0.1, rpitch: -12#, beat_stretch: 8
    sleep 4
  end
end

/
--code to estuary.mcmaster.ca
--h<<hline (ifft $ abs(fx*0.3)) 0.01;
h<<hline (ifft $ abs(fx*0.3)) 0.001;
m<< prox 0**1;
--h*m>>rgb;

--move [0,-0.03] $ 0.98 *fb fxy>>rgb;
--move [[-0.002,0.002],0.1] $ 0.9 *fb fxy>>rgb;
move [0.008,0.008] $ 0.75 *fb fxy>>rgb;

vline (ifft $ abs(fxy*0.3*m)) 0.01*m>>rgb;
hline (ifft $ abs(fxy*0.3*m)) 0.01*m>>rgb;
hline (ifft $ abs(fr*0.3*m)) 0.005*m>>rgb;
vline (ifft $ abs(fr*0.3)) 0.005>>rgb;
/



How to setup Punctual visuals


Basic setup with audio reactiv code to mic
Select Punctual as language
Paste this code

h<<hline (ifft $ abs(fx*0.3)) 0.001;
m<< prox 0**2;
h*m>>rgb;
move [0,-0.03] $ 0.98 *fb fxy>>rgb;

shift+enter to run code

Code from performance

--h<<hline (ifft $ abs(fx*0.3)) 0.01;
h<<hline (ifft $ abs(fx*0.3)) 0.001;
m<< prox 0**1;
--h*m>>rgb;

--move [0,-0.03] $ 0.98 *fb fxy>>rgb;
--move [[-0.002,0.002],0.1] $ 0.9 *fb fxy>>rgb;
move [0.008,0.008] $ 0.75 *fb fxy>>rgb;

vline (ifft $ abs(fxy*0.3*m)) 0.01*m>>rgb;
hline (ifft $ abs(fxy*0.3*m)) 0.01*m>>rgb;
hline (ifft $ abs(fr*0.3*m)) 0.005*m>>rgb;
vline (ifft $ abs(fr*0.3)) 0.005>>rgb;


You can learn Punctual here
https://decoded.livecode.au/#/

MiniTidal Cheat Sheet for Estuary

Setup Estuary in terminal

!presetview fulltexteditor

//Terminal Commands

!listviews // list all available presetiews

!presetview twobyfive //change presetview to a two by five grid

!publishview def //publish your current view as the default for all users

!setbpm 90 //change the default BPM of the ensemble \

!presetview twobyone

!presetview fulltexteditor

!presetview justtexteditor

Punctual commands from Documentation | The complete guide to live-coding visuals in Punctual

“ilo, imid, ihi, ifft functions, they will respond to an external audio signal”
“saw” function moves from 0 :arrow_right: 100 then 0 :arrow_right: 100
“tri” function moves from 0 :arrow_right: 100 :arrow_right: 0 :arrow_right: 100
shift + enter run code
{- -} uncomment multiple lines
– uncomment single line

Punctual workshop (Joan Queralt Molina @ Estuary’s 8th birthday)

3 Likes

Thanks for this mega post. Looks interesting. I look forward to delving into the techniques you cover.

2 Likes

Thank you @robin.newman
Ps. I’m offline from 24/1-19/4