Get the sample name picked from "pick"?

how do you get the name of a randomly ‘picked’ sample
I defined a variable that holds a “picked” sample & it plays fine, I try to get info on the sample & I get this
samp=#<Proc:0x0000020deafce870 C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/lang/core.rb:2062 (lambda)>"

I could “hard code” a random list of letters (appended to a number for 3 different versions of a guitar riff, for a “live feel” when pulling them in). but, some samples might had “a-c” but some might have “a-f” as suffixes…

e.g. if bass_01a.wav & bass_01b.wav & bass_01c.wav" are in the folder, and I use:

bass_samp =  @root+"bass/", "01", pick
sample bass_samp

how do I know what one was picked?

if I use

puts bass_samp

I get the lambda string above…

You could use the sample_paths function.
It returns a ring of all matched samples, so you have to index it with [0] to get the first (and only) path:

bass_samp = (sample_paths @root+"bass/", "01", pick)[0]
puts bass_samp
sample bass_samp
1 Like