I am writing instructions to randomly choose a sample into a file collection. Once it has been chosen, I would like to store the name of this file in a variable called : Name.
I see the name of the file in the console but I can’t figure out how to get hold of it in my code.
This is what I have written so far :
collection = “/home/fred/Desktop/tracks/”
use_random_seed Time.now.to_i
Rr = rrand_i(1,120)
sample collection, Rr
sleep 1
Puts = collection, Rr
Thanks R2L,
But unfortunately that doesn’t help here.
The output of
puts sample_name
is
{run: 2, time: 1.0}
└─ [“/home/fred/Desktop/tracks/”, 5]
That is “file path to collection” + Rr"
But not what I am looking for : the real sample name.
My sample names show the type of instrument and the key in which they are playing.
I want to use this information to overlap with other samples.
Best regards,
Fred
sample_paths takes the same arguments as sample but returns a ring of paths. The [0] on the end is to get the first (and only) element of that ring, since in this case it will always be a ring of length one.
Thank you for your reply, emlyn,
This is the solution.
Now that I have the full file name, I will be able to build on top of it to launch the next samples.
Great