My tutorial topics list - I miss any?

I’d like to try another version which is just drums and using a Ruby grid of 2x 32 bar phrases in 4/4 time, allocate kick and snare to this sequence in a jazzy fashion, ie a bit of swing. Can you try this please?

use_bpm 120

# Define a swing function
define :swing_sleep do |base_sleep, swing_factor|
  sleep base_sleep * (1 + swing_factor)
  sleep base_sleep * (1 - swing_factor)
end

# Kick pattern - a grid of 32 steps (1 = kick hit, 0 = rest)
kick_pattern = [
  1, 0, 0, 0, 1, 0, 0, 1,
  1, 0, 0, 0, 0, 1, 0, 0,
  1, 0, 1, 0, 0, 0, 1, 0,
  0, 1, 0, 0, 1, 0, 0, 0
]

# Snare pattern - another grid of 32 steps
snare_pattern = [
  0, 0, 1, 0, 0, 0, 1, 0,
  0, 0, 1, 0, 0, 0, 1, 0,
  0, 0, 0, 1, 0, 0, 1, 0,
  0, 0, 1, 0, 0, 1, 0, 0
]

# Swing factor for the jazzy feel (adjust this for more/less swing)
swing_factor = 0.15

# Base sleep duration (adjust for tempo)
base_sleep = 0.25  # This gives a quarter-note swing feel

live_loop :drums do
  32.times do |i|
    # Kick drum
    if kick_pattern[i] == 1
      sample :bd_haus, amp: 2
    end
    
    # Snare drum
    if snare_pattern[i] == 1
      sample :sn_generic, amp: 1.5
    end
    
    # Swing sleep
    swing_sleep base_sleep, swing_factor
  end
end

I haven’t got my head round these grids yet, is v impressive to me. Thanks for sharing this.
PS the explanations afterwards are very helpful.

1 Like

In fact, the GPT knows a lot lol but sometimes make some mistakes, and you have to be prudent with its “suggestions”…But, the idea is to iterate several times, each time trying to be more and more precise in your question, it’s what is called “fine tuning”.
He was trained to answer all kinds of questions based on informations(PDF, various documents) I brought him but also on data found on the internet in the area of hyperlinks that I also gave him. I don’t know the limits and are to be tested and Sonic Pi is a good excuse! :relieved:

1 Like

Thank you @beryann, will keep experimenting and iterating :slight_smile:

1 Like