YT Demo of template for hands on amp level on a midicontroller and hydra visual cc control - inspired by Ochre by Steevio + a question

  1. In the video I forgot to say that my LaunchControl XL is setup to cc values instead of the default setup (where some knobs are midi values as I recall), since I needed all cc values for an another project in Ableton. I dont know if you need this to do this.

  2. Question:
    How do I code a keypres on bottom A, then something happens and keeps happening.
    When bottom A is pressed again, then the action stops

# 231003 0113 Recreating the structure of Ochre by Steevio (live improvisation) with midicontroller amp level and hydra YT
# Saved 231003 0113
# Created by https://linktr.ee/relaxnow
# https://in-thread.sonic-pi.net/t/yt-recreating-the-structure-of-ochre-by-steevio-live-improvisation-with-midicontroller-amp-level-and-hydra/8209


# YT Demo https://youtu.be/ZzAUYkbAk0M
# Note to YT Demo:
#  In the video I forgot to say that my LaunchControl XL is setup to cc values
#  instead of the default setup ( where some knobs are midi values as I recall),
#  since I needed all cc values for an another project in Ableton.
#  I dont know if you need this to do this.



# Trying to create a template to from which I can control 8*amp level hands on
# + using the 8*amp lvl's from the midicontroler to generate visuals in hydra
# This is done with :midiccin and :cc

# 1) Goal: Create a midicontroller to fade in/out "hands on" with a midicontroller (amp level)
# 2) Goal: Create visual feedback from the midicontroller to Hydra

## Original: Ochre - Steevio (live improvisation) youtu.be/ikruMMK10ZA
#     Noise hat - spread(3,5)
#     Bass syncope - spread(3,10)
#     Reverb
#     Kick - I cant find out which euklid'n pattern Steevio is doing here. Help me :)
#     Snare
#     Chords
#     More snares
#     Long notes
#     Arp

# NB my laptop struggle to run this code
# NB my gamer computer runs the code ok

# Trying to create visuals in Hydra
# https://in-thread.sonic-pi.net/t/controlling-hydra-visuals-with-midi-cc-function/7378
# I use loopmidi to send midi from Sonic Pi to Hydra

set_volume! 2
use_bpm 60

with_fx :reverb, room: 0.4 do
  
  
  # Add 1)
  / A1 Code for controlling amp level hands on with a Novation LaunchControl XL midicontroller /
  #------------------------------------------------------------------------------#
  # From https://in-thread.sonic-pi.net/t/new-topic-suggestion-controllers-mapping/4969/2
  live_loop :midiccin do
    use_real_time
    # "launch_control_xl_0:3" might need a different name for the code to work with your midicontroller
    n,v=sync "/midi:launch_control_xl_0:3/control_change"  # HOW TO FIND WHAT TO WRITE HERE
    #                                                      # 1) Connect you midicontroller
    #                                                      # 2) Launch Sonic Pi
    #                                                      # 3) Turn on "Show cue log" in Sonic Pi
    #                                                      # 4) Turn a knob on your midicontroller
    #                                                      # 5) Look at "Show cue log" for the name you need here
    #                                                      # 6) My cue shows "/midi:launch_control_xl_0:3/control_change"
    set "cc_"+n.to_s,v
  end
  define :cc do |n,min,max,default|
    v=get["cc_"+n.to_s]
    if v==nil
      x=default
    else
      x=min+(v/128.0)*(max-min)
    end
    puts n.to_s + "," + x.to_s
    x
  end
  #------------------------------------------------------------------------------#
  
  
  
  
  
  live_loop :a1 do
    tick
    
    
    / A2 controlling amp level with a Novation LaunchControl XL midicontroller /
    # -----------------------#
    #         n,min,max,default
    #puts val_f: (cc(21,0.0,2.0,0.0)/amplvl*127)
    #puts cc(21,0.0,2.0,0.0)/amplvl*127
    #midi_cc 0,2
    #amplvl = 2.0
    amplvl = 1.0 #NB 1.0 since I use CASE 0.0-1.0 on "kick" below
    amp1 = cc(77,0.0,amplvl,1.0) # 77 is slider on amp1 on LaunchControl XL ... outputs => 0.0-1.0
    amp1 = cc(77,0.0,amplvl,0.0)
    amp2 = cc(78,0.0,amplvl,0.0)
    amp3 = cc(79,0.0,amplvl,0.0)
    amp4 = cc(80,0.0,amplvl,0.0)
    amp5 = cc(81,0.0,amplvl,0.0)
    amp6 = cc(82,0.0,amplvl,0.0)
    amp7 = cc(83,0.0,amplvl,0.0)
    amp8 = cc(84,0.0,amplvl,0.0)
    #kick = val_f: cc(51,0.0,amplvl,1.0)  # "val_f:" outputs => 0-127
    kick = cc(51,0.0,amplvl,1.0)  # outputs => 0.0-1.0 used below in CASE to select kick pattern needs "amplvl=1" above
    
    
    #--------------------------------------------------
    / Sends midi from Sonic Pi with Loopmidi with to hydra midi_cc /
    / (not ajusted yet in hydra sketch) /
    # Guide https://in-thread.sonic-pi.net/t/controlling-hydra-visuals-with-midi-cc-function/7378
    # You need to paste some code to Chrome console for this to work.
    
    #midi_cc 0, rrand_i(1,125)                                                          #(testing)
    #midi_cc 0, val_f: rrand(0.2, 0.7) # Converts float values to range of 0 -127       #(testing)
    
    midi_cc 77, val_f: cc(77,0.0,1.0,0.0) # 77 is slider on amp1 on LaunchControl XL ...
    midi_cc 78, val_f: cc(78,0.0,1.0,0.0)
    midi_cc 79, val_f: cc(79,0.0,1.0,0.0)
    midi_cc 80, val_f: cc(80,0.0,1.0,0.0)
    midi_cc 81, val_f: cc(81,0.0,1.0,0.0)
    midi_cc 82, val_f: cc(82,0.0,1.0,0.0)
    midi_cc 83, val_f: cc(83,0.0,1.0,0.0)
    midi_cc 84, val_f: cc(28,0.0,1.0,0.0)
    
    # -----------------------#
    
    
    
    / hithat /
    use_synth :noise
    use_synth_defaults release: 0.025, cutoff: [80,80,110,80,90,80,80].look-0
    play :c2, amp: amp1, pan: rdist(0.5) if spread(3,5).look
    
    / bass /
    use_synth :saw
    use_synth_defaults amp: amp2,release: 0.15, cutoff: [80,80,110,80,90,80].look+10
    n = :c2-1
    play n, amp: amp2 if spread(3,10).look
    play n+12, amp: amp2,cutoff: [80,80,110,80,90,80,70].look-10 if spread(3,10).look
    
    / kick /
    c = line(60,80, steps: 64).look+20
    case kick
    when 0..0.25
      sample :bd_haus, amp: amp3, cutoff: c if (spread(1,4)*3+spread(3,4).rotate(rrand_i(0,3))).look
    when 0.26..0.5
      sample :bd_haus, amp: amp3, cutoff: c if (spread(4,11)+spread(3,11)).look
    when 0.51..0.75
      sample :bd_haus, amp: amp3, cutoff: c if (spread(1,4)*7+spread(3,4).rotate(2)).look
    when 0.76..1
      sample :bd_haus, amp: amp3, cutoff: c+20 if (spread(1,4)).look
    end
    
    
    
    
    / snare /
    sample :sn_generic, amp: amp4, finish: [0.02,0.04,0.06].choose, cutoff: [80,100,110].choose if (spread(5,11).rotate(3)+spread(3,11)+spread(0,11)).look #and one_in(2)
    
    / arp or chords /
    use_synth :beep
    use_synth_defaults release: [0.1,0.2,0.3].choose#, cutoff: 90
    
    arp_or_chords = 0
    arp_or_chords = 1
    arp_or_chords = 2
    arp_or_chords = [1,2].choose
    
    case arp_or_chords
    when 0
    when 1
      play [n+5,n+12+3,n+12], amp: amp5, pitch: 24 if spread(5,11).look
    when 2
      play [n+5,n+12+3,n+12].choose, amp: amp5, pitch: 24, cutoff: 130 if spread(5,11).look
    end
    
    / snare 2 /
    sample :sn_dub, amp: amp6, finish: [0.02,0.04,0.06].choose, cutoff: [80,100,110].choose, pan: rdist(1) if (spread(7,11)+spread(6,11)+spread(5,11)).look
    
    / Longer synth sounds at top syncoppated /
    use_synth  :saw
    use_synth_defaults release: 0.8, attack: 2, cutoff: [80,85,90,95].choose+[0,10,20,-10].choose
    play n+3, amp: amp7, pitch: 24 if spread(1,64).look
    play n+5, amp: amp7, pitch: 24 if (spread(0,16)+spread(1,22)).look
    play n-0, amp: amp7, pitch: 24 if (spread(0,24)+spread(1,32)).look
    
    
    / top short melody (Sonic Pi struggling to keep up on my laptop) /
    use_synth  :dtri
    use_synth_defaults release: [0.05,0.1].choose, cutoff: 120
    on [1,0,0,1, 0,0,0,1, 1,0,0].rotate([0,1,2].choose).look do
      play n, amp: amp8, pitch: 36
    end
    on [1,0,0,1, 0,0,0,1, 1,0,0].rotate([0,1,2].choose).look do
      play n, amp: amp8, pitch: 36+12
    end
    
    
    # 4.15 min into Steevio's preformance
    
    
    sleep 0.125
  end
end #end_reverb



# Hydra
# https://hydra.ojack.xyz/?code=JTJGJTJGJTIwY29sb3IlMjBjb250cm9scyUyMHdpdGglMjBmaXJzdCUyMHRocmVlJTIwa25vYnMlMEFub2lzZSg0KS5jb2xvciglMjAoKSUzRCUzRWNjJTVCNzclNUQlMkMlMjAoKSUzRCUzRWNjJTVCNzglNUQlMkMlMjAoKSUzRCUzRWNjJTVCNzklNUQlMjApJTBBLmFkZChzaGFwZSg0KS5zY2FsZSgxJT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