Hi,
for quite some time I was trying to figure out how I could fade in (and out) bits of music (resp. live_loops
). I did not want the fade to be dependant on the runtime of the loop
(such as to set amp
of a sample or synth using a line
I am ticking through). So I came up with this solution:
# Fading in and out a sample
use_bpm 120
live_loop :fade_inout_amen do
vol = (line 0, 1, inclusive: true, steps: 24).mirror
s = sample :loop_amen, beat_stretch: 4, amp: vol.tick
puts "---------- Vol 1: #{vol.look} ----------"
control s, amp_slide: 4, amp: vol.tick
puts "---------- Vol 2: #{vol.look} ----------"
sleep 4
end
# Fading in and out a synth pattern
use_bpm 120
live_loop :fade_inout_synth do
vol = (line 0, 1, inclusive: true, steps: 125).mirror
notes = (scale :e3, :minor_pentatonic, num_octaves: 2).shuffle
s = synth :dtri, cutoff: 70, note: :e3, sustain: 8, release: 0, amp: vol.tick(:v)
puts "---------- Vol 1: #{vol.look(:v)} ----------"
32.times do
control s, note: notes.tick, note_slide: 0.005, amp_slide: 0.125, amp: vol.tick(:v)
puts "---------- Vol 1: #{vol.look(:v)} ----------"
sleep 0.25
end
end
Probably trivial for the real coders amongst us but a tiny revelation for me. I suspect more complex situations where this might not work but in these two cases it does.
Just one downside: My ear tells me that the line
should increase more in the lower registers (probably the values have to increase ālogarithmicā in the right way). The blending seems to become slower as it is getting louderā¦
In this context you might enjoy: