Help looking for Sonic Pi coder to help create some tunes

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.

hitsware that’s really cool and so soothing - thank you.
Robin please share your modified version

Here you go. There are lots of things you could do. This is just one set of ideas I used.

#Seagulls by Hitsware and BaybyJLD combined and tweaked by RBN
#there are many possibilites for this. This is just one.
#added some comments where changes made. Bayby is delayed before starting.
#also added fadeout end (set to start at 140 seconds)
set :kill,false
use_bpm 60
endsequence=140 #time to start finishing off (can adjust)
############## 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
with_fx :level,amp: 1 do |v1| #add fx level to enable fade out at end
  set :v1,v1
  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;stop if get(:kill); 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;stop if get(:kill); 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;stop if get(:kill); 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;stop if get(:kill); 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.7 #boosted volume RBN
  sleep a+s;stop if get(:kill); end
  in_thread do
    sync :finish #wait for cue to start fadeout
    control get(:v1),amp: 0,amp_slide: 10 #10 sec fade
  end
end



# 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|
  puts 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, :tb303).tick #added extra synth
    # 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,0.5).look #add 0.5 for #tb303
    
    # 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)
    break if get(:kill)
  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_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 = []
instants2 = []#added two more sets of instances
instants3 = []
args.each do
  instants.push(20+rand(5)) #delay start for 1st set by 10s
  instants2.push(25+rand(5)) #set2 delayed further 5s
  instants3.push(35+rand(5)) #set3 delayed further 15s
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
    at instants2, args do  |params| #add playing data for 2nd set of instances
      use_transpose -12 #transpose down an octave
      generate *params
    end
    at instants3, args do  |params| #add playing data for 23d set of instances
      use_transpose 12 #transpose up an octave
      generate *params
    end
    
  end
end

at [endsequence] do #start finish sequence
  use_bpm 60
  cue :finish #cue fadeout sequence for Seagull live_loops
  sleep 10
  set :kill,true #send kill signal to live loops and break to generate
end

Thank you Robin amazing .
is their any way to ensure the notes played at all times keep an upbeat happy tone as at times the song seems to go towards the Hitchcock tense genre and I want to avoid that?

Hmm. I don’t think the generate algorithm lends itself to that. It basically plays a selection of 4 harmonically related notes layering them at different times on top of each other. That is not conducive to a regular beat. In my take I have added two more similar patterns starting at different times which build on this texture an octave below and an octave above the original. The inclusion of the “Seagull” adds some variety and punctuation to this withe the wave function and the bell notes.
I personally like overall result.
Parhaps you might be able to put these ideas together differently, or indeed by utilising some of the many offerngs arlready contributed to this thread. It is good to expand ones tastes, as I do here, seeing as how one of my main interests has been in reproducing early classical music using Sonic Pi!

That is positively ’ EPIC ’ ! :smile: