How to filter sample from a subfolder?


let’s say

--- Jazz-01
--- Jazz-02

Now i just want the snares from the folder Jazz-01

this code works :

mySamples = "D:/audio/mesSamples" # glisser déposer pour le chemin si on préfère
folder_filter = "/Jazz-01/"
sp_path = mySamples + folder_filter

filter =""

ros = sample_paths sp_path, filter
nbSamples = ros.length
puts nbSamples

nbSamples.times do
 s_actuel = ros.tick
 duree_sample = sample_duration(s_actuel)
 sample s_actuel
 sleep duree_sample

It works but is there a better way.

The doc is talking about lambda function to create its own filter. Some example ?

How about this:

live_loop :foo do
  sample "D:/audio/mesSamples/Jazz-01", tick
  sleep 1

of course your code is working but the question is how to have the name of the folder taken into account rather than just the name of the file in the filter expression.

A regexp to include the / of subfolder ?