Sonic Pi's built-in samples: folder/path?

Hi all
I am approaching completion of the first draft of a beginners tutorial for Sonic Pi, and I’m finishing up a section on how to access and parse sample folders, from within a buffer. I can find and parse folders and samples, both internal and external to Sonic Pi, but one thing I cannot do is call Dir.children on an internal ‘folder’ of samples, using sample_groups.

My question is: the Sonic Pi samples in Help/Samples are grouped by type into ‘folders’ - is this just a GUI convenience, or do they actually live inside separate folders in the Application. Under Contents/Resources/etc/samples, there is no such hierarchy.

/Dir.children/

drums1 = "/Users/brendan/Desktop/SONICPI-2024/samps4kevyn/full-ac-kit/"

/this works, as the above is a path to a folder/
names1 = Dir.children drums1

names1.each do
  tick
  puts names1.look
  sleep 0.25
end

names2 = sample_groups[3] # a SPi folder called :bd
/this fails because names2 is not a path, it's a ring array/
kk = Dir.children names2

Can I drag-n-drop a folder called :bd, or :vinyl, or :ambi into a buffer the same way I can with my own samples folders?
PD-Pi

1 Like

I should also say that the above method (trying to call Dir.children on Sonic Pi’s internal samples) is largely redundant, as I can easily do something similar with sample_groups → sample_names.

I’m just too much of a completionist, and realise that using both Dir.children and sample_groups/_names is, as I say, redundant.

PD-Pi

Hello @brendanmac !
I would be glad to participate in your tutorial for Sonic Pi. Could you please share the link with the community, when it will be ready?
Thank you!

Hi @sergomartynov
thanks for the offer. The idea I have for the tutorial is this: live-coding for young musicians. There are several excellent tutorials already out there - in Sonic Pi itself and on the web, MisterBomb’s being an exemplary model - but as a non-programmer (whatever that means) I sometimes struggle to understand certain topics or approaches. While the underlying design ethos of Sonic Pi is to encourage and develop coding skills, I want to compile a course/tutorial for young musicians that emphasises live performance. And that is not to say existing tutorials don’t do that - I just set myself this challenge to help me learn and understand Sonic Pi.

It is in the very early draft stages and probably won’t be suitable for sharing until the end of the year. I have compiled an extensive list of disparate topics, discussions and practical examples, ranging from play-sleep, through rings and arrays, synth opts, methods and arguments, up to function definitions. The goal is to have a large single pdf document, a collection of folders and buffer examples (grouped by topic) and a fairly extensive collection of video demonstrations - live-coded where feasible.

What I may do is present a list of those topics in a separate thread, which our peers can edit and comment on.

PD-Pi

1 Like