Syncronised fading with set & get

Just what the title says… I think this is the way to solve my
problems when trying to make a ‘drop’… nice long increase,
sudden decrease… I’ll experiment more tomorrow…

Eli…

# Syncronised fading with set & get
#Eli...

set_volume! 5
use_bpm 90

vrup=range(0.01,2.01,0.04)
vrdown=range(1.99,0,-0.04)
vr=vrup+vrdown

live_loop :fader do
  set :vr, vr.tick
  sleep 0.25
end

live_loop :kick do
  vol = get :vr
  sample :bd_ada,amp: vol / 2.0
  sleep 1
  sample :bd_ada,amp: vol / 2.0
  sample :sn_dolf, sustain: 0, release: 0.08, hpf: 80,amp: vol / 2.0
  sleep 1
end

with_fx :rhpf, res: 0.85, cutoff: 118, amp: 0.7 do
  live_loop :hats do
    vol = get :vr
    use_synth_defaults sustain_level: 0.5
    synth :chipnoise, sustain: 0, release: 0.09, freq_band: 15,amp: vol / 4.0
    sleep 0.25
    if rand(1) < 0.75 then
      synth :chipnoise, sustain: 0, release: 0.09, freq_band: 15,amp: vol / 4.0
    end
    sleep 0.25
  end
end

live_loop :rim do
  vol = get :vr
  with_fx :distortion do
    sleep 0.5
    use_sample_defaults
    sample :elec_blip, sustain: 0.006, cutoff:110, rate: 0.8, amp: vol / 4.0
    sleep 0.25
    sample :elec_blip, sustain: 0.005, cutoff:110, rate: 0.8, amp: vol / 4.0 if one_in(5)
    sleep 0.25
  end
end

with_fx :flanger, stereo_invert_wave: 1, feedback: 0.625, amp: 0.3 do
  with_fx :echo, mix: 0.8, phase: 0.75, decay: 4 do
    live_loop :background do
      vol = get :vr
      use_synth :fm
      mynote = (note_range, :g2, :g4, pitches: (scale, :g6, :minor_pentatonic))
      play mynote.choose,amp: vol / 2.0
      sleep 0.25
    end
  end
end

A nice solution Eli and probably a bit more flexible that the one I have used which is to wrap the live_loops you want to control in an fx :level loop. As an example here is your program modfied this way.

set_volume! 5
use_bpm 90

vrup=range(0.01,2.01,0.04)
vrdown=range(1.99,0,-0.04)
vr=vrup+vrdown

with_fx :level,amp: 0 do |v|
  live_loop :fader do
    control v,amp: vr.tick
    sleep 0.25
  end
  
  
  live_loop :kick do
    sample :bd_ada,amp: 0.5
    sleep 1
    sample :bd_ada,amp: 0.5
    sample :sn_dolf, sustain: 0, release: 0.08, hpf: 80,amp: 0.5
    sleep 1
  end
  
  with_fx :rhpf, res: 0.85, cutoff: 118, amp: 0.7 do
    live_loop :hats do
      use_synth_defaults sustain_level: 0.5
      synth :chipnoise, sustain: 0, release: 0.09, freq_band: 15,amp: 0.25
      if rand(1) < 0.75 then
        synth :chipnoise, sustain: 0, release: 0.09, freq_band: 15,amp: 0.25
      end
      sleep 0.25
    end
  end
  
  live_loop :rim do
    with_fx :distortion do
      sleep 0.5
      use_sample_defaults
      sample :elec_blip, sustain: 0.006, cutoff:110, rate: 0.8, amp: 0.25
      sleep 0.25
      sample :elec_blip, sustain: 0.005, cutoff:110, rate: 0.8, amp: 0.25 if one_in(5)
      sleep 0.25
    end
  end
  
  with_fx :flanger, stereo_invert_wave: 1, feedback: 0.625, amp: 0.3 do
    with_fx :echo, mix: 0.8, phase: 0.75, decay: 4 do
      live_loop :background do
        use_synth :fm
        mynote = (note_range, :g2, :g4, pitches: (scale, :g6, :minor_pentatonic))
        play mynote.choose,amp: 0.5
        sleep 0.25
      end
    end
  end
end

Mine might be more flexible… but your’s deals with the echoes and after effects of things like
reverb, flanger, etc…

I’ll probably end up using a mix of the two… set/get on simple live_loops like kicks, hats, etc, and fx level for anything with really long echo’s. It takes so much code though, to create one of these ‘drops’ that I’m considering recording it as a wav then simply sampling it back into the actual song, to save resource.

So thanks for the tip, matey. :slight_smile:

Eli…

Oh yeah, baby!

Heh. Sorry Robin… but when something goes right, you know?

Eli…

# Final_Drop
#Eli...


use_bpm 90
use_debug false
use_random_seed 98736

tracker = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

volup=line(2.0,4.0,inclusive: true, steps: 60)
voldown=line(4.0,0.00,inclusive: true, steps: 4)
voltotal=volup+voldown

#drop beat variables...

repeater = (ring 8,8,16)
delay = (ring 0.5,0.25,0.125)

n = (ring :r, :r, :d2, :d3, :f3, :r, :d1, :f2)
set :vr, 2.0


# Repeat a loop.
define :repeat_loop do |i|
  tracker[i] = 2
end

define :start_loop do |i|
  tracker[i] = 1
end

define :once_only do |i|
  tracker[i] = 1
end

define :stop_loop do |i|
  tracker[i] = 0
end

define :stop_all do
  set :vr, 0.0
  tracker[0] = 0
  tracker[1] = 0
  tracker[2] = 0
  tracker[3] = 0
  tracker[4] = 0
  tracker[5] = 0
  tracker[6] = 0
  tracker[7] = 0
  tracker[8] = 0
  tracker[9] = 0
  tracker[10] = 0
  tracker[11] = 0
  tracker[11] = 0
end


live_loop :bar do
  sleep 1
end

live_loop :beats do
  sync :bar
  sleep 4
end

live_loop :normal do
  if tracker[11] == 1 then
    set :vr, 2.0
    sleep 0.25
  else
    set :vr, 0.0
    sleep 0.25
  end
end

live_loop :drop do
  if tracker[12] == 1 then
    voltotal.each do |x|
      set :vr, x
      puts x
      sleep 0.25
    end
    tracker[12] = 0
    set :vr, 2.0
  else
    sleep 0.25
  end
end

live_loop :kick do
  if tracker[0] == 1 then
    sync :beats
    vol = get :vr
    sample :bd_ada,amp: vol / 2.0
    sleep 1
    sample :bd_ada,amp: vol / 3.0
    sample :sn_dolf, sustain: 0, release: 0.08, hpf: 80,amp: vol / 2.0
    sleep 1
    sample :bd_ada,amp: vol / 2.0
    sleep 1
    sample :bd_ada,amp: vol / 2.0
    sample :sn_dolf, sustain: 0, release: 0.08, hpf: 80,amp: vol / 2.0
    sleep 1
  else
    sleep 1
  end
end

with_fx :rhpf, res: 0.85, cutoff: 118, amp: 0.7 do
  live_loop :hats do
    if tracker[1] == 1 then
      sync :bar
      vol = get :vr
      use_synth_defaults sustain_level: 0.5
      synth :dsaw, sustain: 0, release: 0.09, freq_band: 15,amp: vol / 0.5
      sleep 1
    else
      sleep 1
    end
  end
  
  with_fx :distortion do
    live_loop :rim do
      if tracker[2] == 1 then
        vol = get :vr
        sleep 0.5
        use_sample_defaults amp: 0.2
        sample :elec_blip, sustain: 0.006, cutoff:110, rate: 0.8,amp: vol / 2.0
        sleep 0.25
        sample :elec_blip, sustain: 0.005, cutoff:110, rate: 0.8,amp: vol / 2.0 if one_in(5)
        sleep 0.25
      else
        sleep 1
      end
    end
  end
  
end


with_fx :flanger, stereo_invert_wave: 1, feedback: 0.625, amp: 0.3 do
  with_fx :echo, mix: 0.8, phase: 0.75, decay: 4 do
    live_loop :background do
      if tracker[3] == 1 then
        vol = get :vr
        use_synth :fm
        mynote = (note_range, :g2, :g4, pitches: (scale, :g6, :minor_pentatonic))
        play mynote.choose,amp: vol / 8.0
        sleep 0.25
      else
        sleep 1
      end
    end
  end
end


with_fx :level,amp: 0 do |v|
  live_loop :anthem do
    if tracker[4] == 1 then
      
      vol = get :vr
      control v,amp: vol
      use_synth :prophet
      use_synth_defaults cutoff: rrand(70, 110), release: rrand(1, 4)
      with_fx :panslicer, mix: 0.5 do
        with_fx :hpf, cutoff: 70 do
          with_fx :reverb, mix: 0.4 do |k|
            with_fx :echo, mix: 0.2 do
              x  =  play_chord chord(:D3, :minor ),amp: vol / 2.0
              sleep 0.75
              x  =  play_chord chord(:D3, :minor ),amp: vol / 2.0
              sleep 0.75
              sleep 0.5
              y =  play_chord chord(:D4, :minor ), attack: 4, release: 2,amp: vol / 2.0
              sleep 2
            end
          end
        end
      end
    else
      control v,amp: 0
      sleep 1
    end
  end
  
  live_loop :drop_beat do
    if tracker[10]== 1 then
      3.times do
        tick
        repeater.look.times do
          sample :bd_ada
          sleep delay.look / 0.5
        end
      end
      control v,amp: 0
      tracker[10] == 0
    else
      control v,amp: 0
      sleep 0.25
    end
  end
  
end



with_fx :flanger, stereo_invert_wave: 1, feedback: 0.625, amp: 0.3 do
  with_fx :echo, mix: 0.8, phase: 0.75, decay: 4 do
    live_loop :holler do
      if tracker[5] == 1 then
        hollervol = 2
        # The female vocal... put your own in here... :)
        sample "C:/SampleRadar/adlib/musicradar-vocal-adlib-samples/Ad Libs/A#140BPM3.wav",amp: hollervol
        tracker[5] = 0
        sleep 0.25
      else
        sleep 1
      end
    end
  end
end

drop_beat=10
normal = 11
drop = 12

kick=0
hats=1
rim=2
background=3
anthem=4
holler=5

comment do
  # Took these out to save recording time...
  # They just start the normal song before
  # the Drop kicks in...
  
  start_loop normal
  start_loop kick
  start_loop hats
  start_loop rim
  start_loop background
  sleep 16
  stop_loop background
  sleep 2
  stop_loop normal
  puts 'NOW'
  
end

start_loop drop_beat
stop_loop kick

start_loop drop

start_loop anthem
sleep 16
stop_loop anthem
start_loop holler
sleep 6
stop_loop drop
start_loop normal
start_loop kick
start_loop hats
start_loop rim
start_loop background
1 Like

That works really well. Well done! PS thanks for bringing the radar free samples to my attention. Cool. I found and downloaded your adlib one.

1 Like