@Eli - maybe I can’t speak for everyone on the forum here but I know that in my opinion your presence and voice are very much valued here!
@Berke:
I tried again uninstall and reinstall Sonic Pi and now codes are working.
I am curious, was this uninstalling and reinstalling exactly the same Sonic Pi version? because if you have timing problems due to FX overloading the resources, then doing this is unlikely to solve the problem
But it was necessary so that I could fully decode the sounds in the song
Unless I’m not understanding something here, the point we’re making here is that you can still have the effect that you were after in your original code, without the problematic overloading of the resources when the FX are inside the loops. If you are not interested in changing your FX on the fly, then simply lifting the FX outside so that they wrap the live_loops prevents the possibility of multiple FX being started every time the loops repeat - but the music should still sound the same
(If you do want to be able to change the FX on the fly, then moving the FX outside the live_loops is not the way to go - in that case, it would be necessary as the Tutorial says to increase the time duration of each loop cycle, so that each FX instance has time to complete before the next one starts - using the reps:
opt, or using something like 16.times do ... end
(or similar) to play more than one sample or note per loop cycle).
Here’s an example of how you could reduce the FX resource usage using the ‘FX wrapping the loops’ strategy - does this version improve things for you?
use_debug false
use_bpm 128
set(:bpm, current_bpm)
live_loop :metro do
use_bpm get(:bpm)
sleep 1
end
set_mixer_control! lpf_slide: 30, lpf: 120
set_mixer_control! hpf_slide: 1, hpf: 12
define :c_arp do
use_synth :sine
tick
notes = ring(:c3, :c4, :c5, :c4)
play notes.look, amp: 0.5, cutoff: 70
sleep 0.25
end
define :bass do
use_synth :saw
tick
notas = ring(:c2, :ds2, :d2, :f2)
play notas.look, decay: 3.5, decay_level: 6, sustain: 0.5, amp: 0.3
sleep 4
end
define :bass_eslik do
use_synth :sine
tick
notis = ring(:c2, :c2, :c3,
:ds2, :ds2, :c3,
:d2, :d2, :c3,
:f2, :f2, :c3)
slptime = ring(2, 0.5, 1.5)
play notis.look, amp: 0.7
sleep slptime.look
end
define :melod do
use_synth :kalimba
tick
notus = ring(:cb7, :bb6, :gb6, :f6,
:gb6, :bb6, :cb7, :bb6,
:gb6, :f6, :gb6, :bb6,
:cb7, :gb6, :f6, :eb6,
:cb6, :bb5, :f5, :gb5,
:bb5, :cb6, :bb5, :gb5,
:f5, :gb5, :bb5, :cb6,
:bb5, :gb5, :f5, :eb6,)
play notus.look, amp: 1, release: 0.8
sleep 1
end
with_fx :eq, high: 10, high_note: 10, low: -3, mid: -1 do
with_fx :hpf, cutoff: 80 do
live_loop :melodi, sync: :metro, delay: 36 do
##| stop
use_bpm get(:bpm)
melod
end
end
end
with_fx :eq, low: -2, high: 3, high_q: 2, mid: -1 do
with_fx :lpf, cutoff: 80 do
with_fx :ping_pong, mix: 0.5 do
live_loop :arp, sync: :metro do
##| stop
use_bpm get(:bpm)
c_arp
end
end
end
end
with_fx :eq, high: -1, low: -1 do
with_fx :level, amp: 0.45 do
with_fx :lpf, cutoff: 60 do
live_loop :bass_line, sync: :metro, delay: 4 do
##| stop
use_bpm get(:bpm)
with_fx :eq, high: 0, low_note: 5, high_q: 0.1, low: 2 do
bass
end
end
end
end
end
with_fx :hpf, cutoff: 120 do
live_loop :noihat, sync: :metro, delay: 4 do
##| stop
use_bpm get(:bpm)
use_synth :cnoise
sleep 0.5
play :c5, amp: 0.8, release: 0.1, cutoff: 105
sleep 0.5
end
end
with_fx :distortion, mix: 0.1 do
live_loop :kick, sync: :metro, delay: 4 do
##| stop
use_bpm get(:bpm)
sample :bd_klub, amp: 1.5, release: 0.5
sleep 1
end
end
live_loop :bases, sync: :metro, delay: 4 do
##| stop
use_bpm get(:bpm)
bass_eslik
end
And about the using bpm in all loops, well i think its kind a necessary too on Windows.
Not necessarily - (although I would be surprised if it was). Bpm is automatically inherited by live_loops if it is set with use_bpm
at the top level. There should never be any issues with ‘drift’, so if you were noticing things not being in time, I suspect there was a different issue at fault.
I’d be interested in seeing what kind of ‘minor glitches and shifts’ you were noticing - is there some way you can share that - maybe a link to the problematic code as well as a video of the glitch or something?