hi there!!!
i am a newbie of sonic pi and i am used it to make music and to study composition at conservatory.
at the moment all is clear (thanks to u and to the developers) but i am trying to do new stuff with this language.
one of these new things is to insert random in a regular rhythm.
i would like to build up rhythms that, after a regular start, can be take unexpected ways.
how can i do???
16.times do
play scale(:c4, :major).choose
sleep 0.5
end
16.times do
play scale(:c4, :major).choose
sleep rrand(0.1, 1)
end
The second block will choose random sleep values between 0.1 and 1. However, be aware that it is not true randomness. Every time you play it , it will give you the same pattern. you can change the pattern by adding use_random_seed above the second block along with a number to change the pattern but it will still play the same way each time you run it.
Check out this thread for more about using true randomness as it seems applicable to what you might be trying to do -> More real randomization
thank u mr!!!
i tried your suggestion and it is right but does it right with the rhythm too?
i mean:
if i change
play scale(:c4, :major).choose
with
sample :drum_cymbal_pedal, sustain: 14, release: 8, amp: 2
sleep 0.25
does it work the same?
cause i tried this and sonic pi says to me “error”
cause i need random rhythm and not melody
anyway thanks a lot for the clear explanation about randomization
Yes. Look at the example ‘[Illusionist] Ocean’ in the built-in examples
(in Sonic Pi click on ‘Examples’ in the bottom left corner).
I think you are talking about using your own ‘external’ samples now, if you read section
3.6 External Samples’ in the Tutorial, that should explain how.
(in Sonic Pi click on ‘Tutorial’ in the bottom left corner).