Duration of sample from a ring

Hi,
I’m new and enthusiastic with Sonic pi.
I’ve follewed the tutorials and now I started playing with my code.
I’m trying to play every sample from the Drum Sounds to find out what is in there.
So I write this code:
drumkit = (ring :drum_heavy_kick,
:drum_tom_mid_soft,
:drum_tom_mid_hard,
:drum_tom_lo_soft,
:drum_tom_lo_hard,
:drum_tom_hi_soft,
:drum_tom_hi_hard,
:drum_splash_soft,
:drum_splash_hard,
:drum_snare_soft,
:drum_snare_hard,
:drum_cymbal_soft,
:drum_cymbal_hard,
:drum_cymbal_open,
:drum_cymbal_closed,
:drum_cymbal_pedal,
:drum_bass_soft,
:drum_bass_hard,
:drum_cowbell,
:drum_roll)

live_loop :ciclo do
  sample drumkit.tick
  sleep 1
end

Instead of sleep 1 I would like to use sleep drumkit.tick_duration but it give me an “NoMethodError” maybe a wrong syntax but I can’t find out which is the correct syntax.
Moreover, what should I write to get all drumSounds from the folder and put them in a ring?
Other way to write what i want to do?
thank you so much.

sleep sample_duration (drumkit.look)

1 Like

Hello @gepponline - welcome!
Eli is right - sample_duration is what you are after :slightly_smiling_face:
It’s always worth skimming through the Lang section of the documentation - all the Sonic Pi functions are listed and documented there :slightly_smiling_face:

Btw, see also sample_groups and sample_names :grinning_face_with_smiling_eyes:

2 Likes