Help looking for Sonic Pi coder to help create some tunes

@holz much appreciated.

Add me and we will figure something out, same for u hussein

Holz#3405

Hi Wro,

Please note, this is NOT my code, I picked it out of a much longer
piece I found… somewhere, years ago.

I called it ‘clouds’, because it reminds of the feeling of gliding through
the air…

Maybe it will be of use to you, who knows.

Eli…

use_bpm 100

chord_1 = chord :c5, :maj9, num_octaves: 2
chord_2 = chord :es4, :maj9, num_octaves: 2
chord_3 = chord :b5, :maj9, num_octaves: 2
chord_4 = chord :d4, :maj9, num_octaves: 2

chord_low_1 = chord :c3, :maj9
chord_low_2 = chord :es2, :maj9
chord_low_3 = chord :b2, :maj9
chord_low_4 = chord :d2, :maj9

chord_high = chord_1
chord_low = chord_low_1

live_loop :chord_selector, delay: -0.5 do
  chord_high = (knit(chord_1, 2, chord_2, 2, chord_3, 4,chord_4, 4)).tick
  chord_low = (knit(chord_low_1, 2, chord_low_2, 2, chord_low_3, 4, chord_low_4, 4)).look
  sleep 8
end

define :chord_player do |the_chord|
  use_synth  [ :blade, :prophet].choose
  the_chord.each do |note|
    play note, attack: rand(4), release: rand(6..8), cutoff: rand(50..85), vibrato_rate: rand(0.01..2), amp: 0.55
  end
end

with_fx :reverb, room: 0.99, mix: 0.7 do
  live_loop :chord_loop do
    chord_player chord_high.pick(6)
    chord_player chord_low.take(3)
    sleep 8
  end
end
4 Likes

well thats exactly what i was thinking about, nice eli

maybe adding some more random structure for more variablitity

with_fx :reverb, room: 0.99, mix: 0.7 do
  use_random_seed (knit 351414100,4,564654132,1).tick(:rjra)
  live_loop :chord_loop do
    6.times do
      chord_player chord_high.pick(6)
      chord_player chord_low.take(3)
      sleep 8
    end
  end
end

ey @Eli , nice one. Do you have a link to the original by any chance?

Regards
Hussein

I wish… I’ve checked all my .rb files, and deep-searched the forum here with no luck.

In case it jogs anyone elses memory, I think it was called ‘By the Bay’ or similar, and it
had ‘day’ and ‘night’ modes… and some hellishly complex maths in it. I think they were
also creating loops programatically, as the song progressed… but it was also very melodic
and soulfull.

It might also have been posted under ‘Clouds’… but I cant find that either…

I’d like to bring your attention to this post as well… his code/sound really attracted my ears. :slight_smile:

Eli…

amazing thank you Eli

i pm you on discord

Hi anyone can help would appreciate it :grinning: :grinning:

Hmm I was hoping someone helpful soul would be able to help out with some sonic pi and the sounds I want to put together. Anyone?

If I knew what I was doing, I’d be all in. But I’ve been playing with Sonic-Pi for about a week now…so :neutral_face:

lol appreciate that - enjoy its a great system :grinning_face_with_smiling_eyes:

1 Like
mn=[]; for j in 1..1023
  mn[j]=hz_to_midi(11*j)
end; use_synth :dark_ambience

m=[3,6,9]
n=[24,30,36,48]

live_loop :one do
  a=choose(m); s=choose(m); r=choose(m)
  play mn[choose(n)], attack: a,
    sustain: s, release: r
sleep a+s+r; end

live_loop :two do
  a=choose(m); s=choose(m); r=choose(m)
  play mn[choose(n)], attack: a,
    sustain: s, release: r
sleep a+s+r; end

live_loop :three do
  a=choose(m); s=choose(m); r=choose(m)
  play mn[choose(n)], attack: a,
    sustain: s, release: r
sleep a+s+r; end

Hitsware this is great - wow thank you for this!
I have a few questions are you able to assist further?

I am happy to do anything I can :slight_smile:

Oh… I found one of the pieces I mentioned earlier…

I had it saved as BaybyJLD.rb… so whoever JLD is,
thank you. :slight_smile:

Eli…


# This function generates a stream of repeated notes

# Parameters:
# start: initial number of notes to skip (will produce silence)
# reps: number of notes the stream produces before dying
# n:    Note to repeat. If it is an array, one random
#       note from the array is selected in each iteration.
#       Do not abuse of this feature
# imin: Minimal interval between note repetitions
# imax: Max interval between note repetitions
# len:  Length of the note to produce in each repetition
# vmin,vmax: range of "velocity" for the notes. In the original
#       implementation, the values were MIDI velocities. In
#       this implementation they are used to set amplitude
#       and cutoff frequency

define :generate do |start, reps, n, imin, imax, len, vmin, vmax|
  reps.times do |r|
    if r<start                  # Wait the specified initial delay
      sleep rrand(imin, imax)
      next
    end
    # Choose a different synth in each iteration
    use_synth (ring :hollow, :prophet, :blade).tick
    # Adjust the volume, depending on the synth selected above
    # (:hollow is much quieter than :prophet, so I pump up the volume)
    vol_multiplier = (ring 1.2, 0.6, 0.7).look
    
    # Select the note to play in this iteration
    if n.is_a?(Array)
      chosen_note = n.choose
    else
      chosen_note = n
    end
    
    
    
    # Uncomment next line to get "Bay at night" :-)
    #chosen_note += -1 + rand_i(2)
    
    # Play the note. Several parameters are set to get a random
    # volume and length, between the limits specified
    play chosen_note, amp: vol_multiplier*rrand(vmin, vmax)/120,
      attack: len/2, decay: rrand(0.2,0.8)*len/2,
      pan: choose((stretch rrand(-1, -0.6), 45, rrand(-0.2, 0.2), 10, rrand(0.6,1), 45)),
      cutoff: rrand(vmin, vmax),
      vibrato_delay: len/2, vibrato_onset:1,
      vibrato_rate: 2, vibrato_depth: 0.09
    
    # Wait a random time before triggering the note again
    sleep rrand(imin, imax)
  end
end

# The above function is the basic infrastructure. Next, I'll call several instances
# of the function, each one in a separated thread. For this, I'll define some
# arrays with the paramaters to be passed to the function in each invocation

use_bpm 40
use_random_seed = 66776
piece_length = 40

args = [
  [0, piece_length-3, :f2,9,12,9,60,90],
  [0, piece_length-3,:a2,9,12,9,60,90],
  [0, piece_length-3,:c3,9,12,9,60,90],
  [1, piece_length-2,:e3,9,12,9,60,90],
  [2, piece_length-3,:f3,9,12,9,60,90],
  [1, piece_length,:e4,9,12,9,60,90],
  [3, piece_length-2,:a4,8,12,9,60,70],
  [3, piece_length-2,:b4,8,10,9,50,70],
  [3, piece_length-2,[:c4,:cs4,:d4],10,20,3,60,90],
  [5, piece_length-4,:c5,8,10,9,50,80],
  [5, piece_length-5,:d5,8,10,9,50,90],
  [6, piece_length-5,:e5,8,10,9,50,70],
  [8, piece_length-5, [:b6,:c7,:d7],4,7,5,70,98]
]

# Now, I create another array containing the time at which each instance of the
# function has to be called. I fill the array with random values below 5, so that
# each call starts at a random instant, but all of them in the first 5 secs
instants = []
args.each do
  instants.push(rand(5))
end

# Using "at", I launch several instances of the function, each one at a
# random instant (specified in "instants" array) and with different
# parameters (specified in "args" array). All those functions share
# the same reverb and flanger effect
with_fx :reverb, spread: 0.9, mix: 0.8, room: 0.99 do
  with_fx :flanger do
    at instants, args do |params|
      generate *params
    end
  end
end
2 Likes

oh wow thank you! could you include some sample sounds (ocean waves, gulls, soothing bells) in this at random times and also enable it to have a few more options on the synth .

the important thing is that it keeps its harmonious flow.

Thanks Eli an amazing piece - Im so grateful for these samples

############## Calling the Seagulls ################
w=[1,2,3]                               # wave timing
m=[3,6,9]                               # pad timimg
n=[48,52,55,60]                         # note choice
k=[:bnoise, :cnoise, :gnoise, :pnoise]  # wave timbre

live_loop :pad_1 do; use_synth :hollow  #choose synth
  t=choose(n); a=choose(m); s=choose(m); r=choose(m)
  play t, attack: a, sustain: s, release: r
sleep a+s+r; end

live_loop :pad_2 do; use_synth :hollow   #choose synth
  t=choose(n); a=choose(m); s=choose(m); r=choose(m)
  play t, attack: a, sustain: s, release: r
sleep a+s+r; end

live_loop :pad_3 do; use_synth :hollow   #choose synth
  t=choose(n); a=choose(m); s=choose(m); r=choose(m)
  play t, attack: a, sustain: s, release: r
sleep a+s+r; end

live_loop :wave do; use_synth choose(k)   #choose synth
  t=choose(n); a=choose(m); s=choose(m); r=choose(w)
  play t, attack: a, release: r, amp: 0.3
sleep choose(m)*3; end

live_loop :bell do; use_synth :pretty_bell #choose synth
  t=choose(n); a=choose(w); s=choose(w); r=choose(m)
  play t,release: r, amp: 0.3
sleep a+s; end
1 Like

These are all cool. I’m currently playing hitsware Calling the Seagulls, and then after some time adding in Eli’s BaybyJLD.rb enhanced using further instances at different times, and adding :tb303 synth. Sounds great.