I tried to make a kinda Brian Eno stuff, ended up with kinda Lofi Generative Ambiant Brian Eno Style stuff

Hope you’ll enjoy it ^^

First I tried to make generative loops looking like Reflexion from Brian Eno… And I don’t know how, I ended up messing arround with delay, flanger and krush with the drums.
La cerise sur le gâteau, it was the vynil sample ^^ Hope you’ll like it ! /o/

### Title : Waiting for the Next Tommorrow
### Compocoder : Peuneuj / Purple Butturfly Prod (sic)
### Licence : WTFPL
### Sonic Pi v4.5.1

use_bpm 30
use_random_seed 10212023 #21 octobre 2023


a = 0.125 #global amp
a1 = 2 #release
a2= a*0.8 #drums amp


b = 62
b1 = b-12
t1 = 3 #tièrce mineure
t2 = 4 #tièrce majeure
q1 = 5 #quarte juste
q2= 7  #quinte juste

theme = [:r, :r, :r, :r, b, b-q1, b-q2, b+q1, b+q2, b+12, b+8]
bass = [b1, b1+q2, b1-q1]

live_loop :metro do
  sleep 1
end
define :drums01 do
  live_loop :drums do
    sample :drum_bass_soft, amp: a2
    sleep 0.75
    sample :drum_bass_soft, amp: a2
    sleep 0.25
    with_fx :echo, phase: 0.25, max_phase: 0.5, mix: 0.1 do
      sample :drum_snare_soft, amp: a2, pan: 0.5
      sleep 1
    end
    sample :drum_bass_soft, amp: a2
    sleep 0.75
    sample :drum_bass_soft, amp: a2
    sleep 0.25
    sample :drum_snare_soft, amp: a2
    sample :drum_bass_soft, amp: a2*0.75
    sleep 1
    sample :drum_bass_soft, amp: a2
    sleep 0.75
    sample :drum_bass_soft, amp: a2
    sleep 0.25
    with_fx :echo, phase: 0.25, max_phase: 0.5, mix: 0.3 do
      sample :drum_snare_soft, amp: a2, pan: 0.5
      sleep 1
    end
    sample :drum_bass_soft, amp: a2
    sleep 0.75
    sample :drum_bass_soft, amp: a2
    sleep 0.25
    with_fx :echo, phase: 0.25, max_phase: 0.5, mix: 0.3 do
      sample :drum_snare_soft, amp: a2, pan: 0.5
    end
    sample :drum_bass_soft, amp: a2/2
    sleep 0.5
    with_fx :echo, phase: 0.5, decay: 4, max_phase: 2, mix: 0.6 do
      sample :drum_cymbal_open, attack: 0.2, amp: a2/2, pan: -0.5
      sleep 0.5
    end
  end
end

define :drums02 do
  live_loop :drums2 do
    8.times do
      sample :drum_cymbal_closed, amp: a, pan: -0.25
      sleep 0.52
      sample :drum_cymbal_closed, amp: a, pan: -0.25
      sleep 0.48
    end
  end
end

define :themebass do
  live_loop :Theme do
    use_synth_defaults amp: a, release: a1, pan: rrand(-1 , 1)
    play theme.tick
    sleep (knit 0.125,1.5, 0.5,1, 1,1, 1.5,1, 2,1, 3,1, 4,1).choose
  end
  
  live_loop :Theme2 do
    use_synth_defaults amp: a, release: a1, pan: rrand(-1 , 1)
    play theme.tick
    sleep [2, 4, 8].choose
  end
  
  live_loop :Bass do
    use_synth_defaults amp: a, release: a1, pan: rrand(-1 , 1)
    play bass.tick
    sleep [1, 2, 3, 4, 8].choose
  end
end

#######################################################################################################

with_fx :reverb, mix: 0.6, room: 1 do
  with_fx :flanger, mix: 0.25, depth: 10, phase: 8 do
    
    ########################### Drums
    with_fx :krush, gain: 15, cutoff: 85 do
      
      live_loop :dr1, sync: :metro do #stop
        drums01
      end
      live_loop :dr2, sync: :metro do #stop
        drums02
      end
      
    end
    ################################# /Drums
    
    
    with_fx :flanger, depth: 15, wave: 0 do
      with_fx :echo, phase: 0.5, decay: 32, max_phase: 16, mix: 0.5 do
        ######################################## Generative melodies
        live_loop :jolissons, sync: :metro do
          themebass
        end
        ######################################## /Generative
      end
      ######################################## Ambient beep
      live_loop :bip, sync: :metro do
        with_fx :echo, phase: 0.25, max_phase: 0.5, mix: 0.3 do
          sample :elec_tick, pan: rrand(-1 , 1), amp: a*2, rate: rrand(0.8, 1.1)
          sleep [2, 4, 8, 12].choose
        end #delay
      end
    end #delay
    ######################################## /Abient
  end #flanger
end #reverb

######################################## Kinda Lofi Vinyl noise
live_loop :vynil, sync: :metro do
  sample :vinyl_hiss, amp: a*4, lpf: 120, pan: 0.25
  sleep 3.8
end
live_loop :vynil2, sync: :metro do
  sample :vinyl_hiss, amp: a*4, lpf: 90, pan: 0.25
  sleep 3.8
end
######################################## /Kinda
1 Like

I totally dig the vibe of this.
There were a couple of bugs, so I tweaked the code:


### Title : Waiting for the Next Tommorrow
### Compocoder : Peuneuj / Purple Butturfly Prod (sic)
### Licence : WTFPL
### Sonic Pi v4.5.1

use_bpm 30
use_random_seed 10212023 #21 octobre 2023


a = 0.125 #global amp
a1 = 2 #release
a2= a*0.8 #drums amp


b = 62
b1 = b-12
t1 = 3 #tièrce mineure
t2 = 4 #tièrce majeure
q1 = 5 #quarte juste
q2= 7  #quinte juste

theme = [:r, :r, :r, :r, b, b-q1, b-q2, b+q1, b+q2, b+12, b+8]
bass = [b1, b1+q2, b1-q1]

live_loop :metro do
  sleep 1
end
define :drums01 do
  live_loop :drums do
    sample :drum_bass_soft, amp: a2
    sleep 0.75
    sample :drum_bass_soft, amp: a2
    sleep 0.25
    with_fx :echo, phase: 0.25, max_phase: 0.5, mix: 0.1 do
      sample :drum_snare_soft, amp: a2, pan: 0.5
      sleep 1
    end
    sample :drum_bass_soft, amp: a2
    sleep 0.75
    sample :drum_bass_soft, amp: a2
    sleep 0.25
    sample :drum_snare_soft, amp: a2
    sample :drum_bass_soft, amp: a2*0.75
    sleep 1
    sample :drum_bass_soft, amp: a2
    sleep 0.75
    sample :drum_bass_soft, amp: a2
    sleep 0.25
    with_fx :echo, phase: 0.25, max_phase: 0.5, mix: 0.3 do
      sample :drum_snare_soft, amp: a2, pan: 0.5
      sleep 1
    end
    sample :drum_bass_soft, amp: a2
    sleep 0.75
    sample :drum_bass_soft, amp: a2
    sleep 0.25
    with_fx :echo, phase: 0.25, max_phase: 0.5, mix: 0.3 do
      sample :drum_snare_soft, amp: a2, pan: 0.5
    end
    sample :drum_bass_soft, amp: a2/2
    sleep 0.5
    with_fx :echo, phase: 0.5, decay: 4, max_phase: 2, mix: 0.6 do
      sample :drum_cymbal_open, attack: 0.2, amp: a2/2, pan: -0.5
      sleep 0.5
    end
  end
end

define :drums02 do
  live_loop :drums2 do
    8.times do
      sample :drum_cymbal_closed, amp: a, pan: -0.25
      sleep 0.52
      sample :drum_cymbal_closed, amp: a, pan: -0.25
      sleep 0.48
    end
  end
end

define :themebass1 do
  live_loop :Theme do
    use_synth_defaults amp: a, release: a1, pan: rrand(-1 , 1)
    play theme.tick
    sleep (ring 0.125,1.5, 0.5,1, 1,1, 1.5,1, 2,1, 3,1, 4,1).choose
  end
end

define :themebass2 do
  
  live_loop :Theme2 do
    use_synth_defaults amp: a, release: a1, pan: rrand(-1 , 1)
    play theme.tick
    sleep [2, 4, 8].choose
  end
end

define :themebass3 do
  
  
  live_loop :Bass do
    use_synth_defaults amp: a, release: a1, pan: rrand(-1 , 1)
    play bass.tick
    sleep [1, 2, 3, 4, 8].choose
  end
end

#######################################################################################################

with_fx :reverb, mix: 0.6, room: 1 do
  with_fx :flanger, mix: 0.25, depth: 10, phase: 8 do
    
    ########################### Drums
    with_fx :krush, gain: 15, cutoff: 85 do
      drums01
      drums02
      
      
    end
    ################################# /Drums
    
    
    with_fx :flanger, depth: 15, wave: 0 do
      with_fx :echo, phase: 0.5, decay: 32, max_phase: 16, mix: 0.5 do
        ######################################## Generative melodies
        themebass1
        themebass2
        themebass3
      end
      ######################################## /Generative
      ######################################## Ambient beep
      live_loop :bip, sync: :metro do
        with_fx :echo, phase: 0.25, max_phase: 0.5, mix: 0.3 do
          sample :elec_tick, pan: rrand(-1 , 1), amp: a*2, rate: rrand(0.8, 1.1)
          sleep [2, 4, 8, 12].choose
        end #delay
      end
    end #delay
    ######################################## /Abient
  end #flanger
end #reverb


######################################## Kinda Lofi Vinyl noise
live_loop :vynil, sync: :metro do
  sample :vinyl_hiss, amp: a*4, lpf: 120, pan: 0.25
  sleep 3.8
end
live_loop :vynil2, sync: :metro do
  sample :vinyl_hiss, amp: a*4, lpf: 90, pan: 0.25
  sleep 3.8
end
######################################## /Kinda

The first problem was that you were nesting live loops within live loops, which confused sonic pi about whether you were sleeping. I deleted the top-level live loops that called methods that had nested live loops.
The other problem was you used knit when I think you meant ring.
The knit method fills the first arg the number in the 2nd arg. So (knit “a”, 3) gives you (ring “a,” “a”, “a”).
Hope this helps!
(It feels good to help someone else, especially when my own code is giving me fits!)

1 Like

Did you hope this helped ? Enfers oui ça aide !
Thanks to your correction I clean the code to made it a little bit more elegant to read and add a little someting in the comment that is, in my opinion, very important, check it ^

### Title : Waiting for the Next Tommorrow
### Compocoder : Peuneuj / Purple Butturfly Prod (sic)
### Corector : HenriLeBlanc
### Licence : WTFPL
### Sonic Pi v4.5.1

use_bpm 30
use_random_seed 10212023 #21 octobre 2023


a = 0.1 #global amp
a1 = 2 #release
a2= a*0.8 #drums amp


b = 69
b1 = b-12
t1 = 3 #tièrce mineure
t2 = 4 #tièrce majeure
q1 = 5 #quarte juste
q2= 7  #quinte juste

theme = [:r, :r, :r, :r, b, b-q1, b-q2, b+q1, b+q2, b+12, b+9]
bass = [b1, b1+q2, b1-q1]

live_loop :metro do
  sleep 1
end
define :drums01 do
  live_loop :drums do
    sample :drum_bass_soft, amp: a2
    sleep 0.75
    sample :drum_bass_soft, amp: a2
    sleep 0.25
    with_fx :echo, phase: 0.25, max_phase: 0.5, mix: 0.1 do
      sample :drum_snare_soft, amp: a2, pan: 0.5
      sleep 1
    end
    sample :drum_bass_soft, amp: a2
    sleep 0.75
    sample :drum_bass_soft, amp: a2
    sleep 0.25
    sample :drum_snare_soft, amp: a2
    sample :drum_bass_soft, amp: a2*0.75
    sleep 1
    sample :drum_bass_soft, amp: a2
    sleep 0.75
    sample :drum_bass_soft, amp: a2
    sleep 0.25
    with_fx :echo, phase: 0.25, max_phase: 0.5, mix: 0.3 do
      sample :drum_snare_soft, amp: a2, pan: 0.5
      sleep 1
    end
    sample :drum_bass_soft, amp: a2
    sleep 0.75
    sample :drum_bass_soft, amp: a2
    sleep 0.25
    with_fx :echo, phase: 0.25, max_phase: 0.5, mix: 0.3 do
      sample :drum_snare_soft, amp: a2, pan: 0.5
    end
    sample :drum_bass_soft, amp: a2/2
    sleep 0.5
    with_fx :echo, phase: 0.5, decay: 4, max_phase: 2, mix: 0.6 do
      sample :drum_cymbal_open, attack: 0.2, amp: a2/2, pan: -0.5
      sleep 0.5
    end
  end
end

define :drums02 do
  live_loop :drums2 do
    8.times do
      sample :drum_cymbal_closed, amp: a, pan: -0.25
      sleep 0.52
      sample :drum_cymbal_closed, amp: a, pan: -0.25
      sleep 0.48
    end
  end
end

define :themebass1 do
  live_loop :Theme do
    use_synth_defaults amp: a, release: a1, pan: rrand(-1 , 1)
    play theme.tick
    sleep (ring 0.125,1.5, 0.5,1, 1,1, 1.5,1, 2,1, 3,1, 4,1).choose
  end
end

define :themebass2 do
  
  live_loop :Theme2 do
    use_synth_defaults amp: a, release: a1, pan: rrand(-1 , 1)
    play theme.tick
    sleep [2, 4, 8].choose
  end
end

define :themebass3 do
  
  
  live_loop :Bass do
    use_synth_defaults amp: a, release: a1, pan: rrand(-1 , 1)
    play bass.tick
    sleep [1, 2, 3, 4, 8].choose
  end
end

#######################################################################################################

with_fx :reverb, mix: 0.6, room: 1 do
  with_fx :flanger, mix: 0.25, depth: 10, phase: 8 do
    
    ########################### Drums
    with_fx :krush, gain: 15, cutoff: 85 do
      drums01
      drums02
      
      
    end
    ################################# /Drums
    
    
    with_fx :flanger, depth: 15, wave: 0 do
      with_fx :echo, phase: 0.5, decay: 32, max_phase: 16, mix: 0.5 do
        ######################################## Generative melodies
        themebass1
        themebass2
        themebass3
      end
      ######################################## /Generative
      ######################################## Ambient beep
      live_loop :bip, sync: :metro do
        with_fx :echo, phase: 0.25, max_phase: 0.5, mix: 0.3 do
          sample :elec_tick, pan: rrand(-1 , 1), amp: a*2, rate: rrand(0.8, 1.1)
          sleep [2, 4, 8, 12].choose
        end #delay
      end
    end #delay
    ######################################## /Abient
  end #flanger
end #reverb


######################################## Kinda Lofi Vinyl noise
live_loop :vynil, sync: :metro do
  sample :vinyl_hiss, amp: a*4, lpf: 120, pan: 0.25
  sleep 3.8
end
live_loop :vynil2, sync: :metro do
  sample :vinyl_hiss, amp: a*4, lpf: 90, pan: 0.25
  sleep 3.8
end
######################################## /Kinda

Now I have a question : This trick to add randmness in rythme avoiding knit (au passage, thanks a lot to explain me what is exactly knit, I totally didn’t understant exactly what it does, I just followed some tuto on youtube ^^), is it usable for notes ? If yes, in the same way ? like :

loop do
play (ring 60,2, 62,2, 64,1.2, 69,1.5, 70, 1.1, 48,0.5).choose
sleep 1
end

I’m currently recording it so I cannot test now, but if it works, i there an elegant way to do it ? (I like a lot the concept of elegance on math or code even if I’m a totally newbie in both of them ^^ )

1 Like

Yes, absolutely, you can use choose to randomly play notes in a ring (or array). I use this trick all the time. I also use it to change the timing of things, e.g.:

sleep [0.125, 0.25, 0.375]. choose

This is a lovely meditative piece. :slight_smile: