Hi, I’m just getting started with Sonic Pi and would like to know if it is possible to change the amp/sustain etc of everything inside a loop without having to do each note manually?
Thanks
Edit: found it
Hi, I’m just getting started with Sonic Pi and would like to know if it is possible to change the amp/sustain etc of everything inside a loop without having to do each note manually?
Thanks
Edit: found it
Hi welcome I have the same problem but still haven’t figured it out but there are a lot of nice people here that will help.
I did it by adding reverb fx, which allowed me to set the amp of everything in the reverb block.
so to change the amp of the notes in this loop to 3:
play 60
sleep 1
play 63
sleep 1
play 57
sleep 1
play 61
sleep 1
end
do this:
with_fx :reverb, room: 0, amp: 3 do
loop do
play 60
sleep 1
play 63
sleep 1
play 57
sleep 1
play 61
sleep 1
end
end
The room: 0 essentially means I don’t want any reverb
Oh thank you for the help I am gonna see what I can do
Hi damp,
for that you should look at the level effect, e.g.:
with_fx :level, amp: 2 do
...
end
You can also use a control mechanism to change the amp over time:
with_fx :level, amp: 1 do |s|
...
control s, amp: 2, amp_slide: 1, amp_slide_shape: 1
...
end
Hope, this gives you some ideas.
Cu.
There are also commands to set all following parameters; use_synth_defaults, use_sample_defaults.
Last but not least:
You might want to have a look at set_mixer_control!
:
set_mixer_control! amp: 0, amp_slide: 8
See a complete example (thought not with live_loop
but in_thread
).
You probably already know, you can also use a variable.
# I used the name va. However you could name it anything, even amp.
va = 1.5
# I used a live_loop here, so I can change the loudness by simply
# changing the value of va without any interruption of the play.
live_loop :myloop do
play 60 , amp: va
sleep 1
play 63 , amp: va-0.5
sleep 1
play 57 , amp: va+0.5
sleep 1
play 61 , amp: va
sleep 1
end
Just to make shure you don’t miss it.
It’s a little bit more typing, but not much, if you use cut and paste.