BT Number Jam - A live code jam

Hey Sonic Pi’ers,

I recorded a video playing about with a classic BT phone sample in Sonic Pi:

Here is the code:

# Number Jam by Binarysweets
# Sample over here - https://freesound.org/people/Benboncan/sounds/62164
use_bpm 80
swing = (ring 0.01, -0.01)
set_volume! 0.8
sample_root = "C:/Users/LeeBridge/OneDrive/Sonic Pi/Samples/"

with_fx :compressor, threshold: 0.4 do
  live_loop :drums do
    s = sample_root + "DanceMegaDrums/96-AudioTrack 96.wav"
    s_length = 43.17
    
    pattern = (ring 1,0,2,0,1,2,3,1).mirror
    start = 27.62 if pattern.tick == 1
    start = 28.41 if pattern.look == 2
    start = 32.14 if pattern.look == 3
    
    with_fx :eq, mid_note: 60, mid: -0.5 do
      sample s, start: start / s_length, finish: (start + 0.66) / s_length,
        amp: rrand(4.8, 5) if pattern.look > 0
    end
    
    sleep 0.25 + swing.look
  end
  
  live_loop :number_not do
    s = sample_root + "Vox/number.wav"
    s_length = 4.7
    
    starts = [0, 0.14, 0.32, 0.36, 0.545, 0.780, 0.758, 1.02,
              1.04, 1.19, 1.41, 1.575, 1.704, 1.84, 1.02, 0.758].ring
    finishes = [0.10, 0.31, 0.35, 0.544, 0.75, 1.02, 0.780, 1.04,
                1.19, 1.41, 1.575, 1.70, 1.84, 2.29, 1.04, 0.780].ring
    
    with_fx :ping_pong, feedback: 0.5, phase: 0.5, mix: 0.2 do
      sample s, amp: rrand(2.5, 2.7),
        start: starts.tick / s_length,
        finish: finishes.look / s_length
      
      sleep 0.25
    end
  end
  
  live_loop :try_again do
    s = sample_root + "Vox/number.wav"
    s_length = 4.9
    starts = [2.98, 3.304, 1.02, 3.687, 3.809, 4.141, 0.758, 1.02].ring
    finishes = [3.30, 3.51, 1.04, 3.808, 4.141, 4.80, 0.780, 1.04].ring
    
    with_fx :ping_pong, feedback: 0.5, phase: 0.5, mix: 0.2 do
      sample s, amp: rrand(2.7, 3),
        start: starts.tick / s_length,
        finish: finishes.look / s_length
      
      sleep 1
    end
  end
  
  live_loop :lead do
    stop
    scl = scale(:f5, :whole)
    notes = [scl[0], :r, :r, :r, :r, :r, :r, scl[3],
             scl[5], :r, :r, :r, scl[2], :r, :r, :r].ring
    
    with_fx :rlpf, cutoff: 70, res: 0.9 do
      with_synth :saw do
        snth = play notes[0], sustain: 10, release: 1, note_slide: 0.2,
          env_curve: 2, amp: rrand(0.6, 0.7)
        
        notes.each do |n|
          control snth, note: n,
            amp: rrand(0.6, 0.8),
            cutoff: (line 50, 70, steps: 32).tick if !rest? n
          sleep 0.5 + swing.look
        end
      end
    end
  end
  
  
  live_loop :bass do
    scl = scale(:f2, :whole)
    notes = [scl[0], :r, :r, :r, :r, :r, :r, scl[3],
             scl[5], :r, :r, :r, scl[2], :r, :r, :r].ring
    
    with_fx :rlpf, cutoff: 70, res: 0.9 do
      with_synth :saw do
        snth = play notes[0], sustain: 6, release: 1, note_slide: 0.2,
          env_curve: 2, amp: rrand(0.4, 0.6)
        
        notes.each do |n|
          control snth, note: n,
            amp: rrand(0.4, 0.6),
            cutoff: (line 50, 70, steps: 128).tick if !rest? n
          sleep 0.25 + swing.look
        end
      end
    end
  end
end
4 Likes

Very nice. Great idea!

Brilliant work on this @binarysweets !

Thank you both :slight_smile: