Get the name of the sample

#1

Hi,

A little question how to get the name of sample as in the screenshot i want to get “wren”.

chemin_echantillons ="D:/audio/samples/birds"
sample chemin_echantillons

image

Thanks

0 Likes

#2

Hi there,

Well i suggest this code to achieve my first goal.

yourSamplesPath ="D:/audio/mesSamples/Jazz-02"

# ros = ring_of_samples
# filter samples only with loop into the name
ros = sample_paths yourSamplesPath, ""

## function to get only the name of the fileName to populate a friendly list by example
define :getName do |fullPath|
  fileNameWithExtension = fullPath.split("/")[-1] # to get the file name with the extension
  return fileName = fileNameWithExtension.split(".")[0] # to get the name without the extension
end

puts "---------------------------------"

puts "Number of samples : " + ros.length.to_s
puts "--------- Name of samples ------ "
k=0
while k<ros.length
  puts getName((ros)[k])
  # by example  to be sent by osc_send to a list
  # to prepare the playing
  load_sample (ros)[k]
  k = k+1
end

puts "--- Let's play all the samples --------"

May it helps.
Cheers

0 Likes