:organ_tonewheel noodling - Organ Ode #3

Hello Sonic Pi’ers, It’s nice to hear all the new music!

Here is my contribution.
:organ_tonewheel noodling and playing around with a lazy groove…

I changed the drums samples in the code below to a native loop.

# Title: Organ Ode #3
# Artist: L.Bridge
# Date: June 2024
# License: cc-by
# Sonic Pi v4.5.0 (Win 11)


# Settings
use_bpm 200
bar_length = 4
use_random_seed 1985
swing = (ring 0.02, 0.03, 0.04, 0.05, -0.05, -0.04, -0.03, -0.02)


# Scale
key = :e1
mode = :dorian
num_octaves = 5
scl = scale(key, mode, num_octaves: num_octaves)


# Functions
define :bar do |length = 8|
  sleep bar_length * length
end

define :sleep_with_swing do |sleep_duration|
  sleep sleep_duration + swing.look
end


# Loops
define :bass_clef do |length = 8, pattern = 1|
  in_thread do
    notes = (ring 7,6,5,4, 3,2,1,0) if pattern == 1
    notes = (ring 7,8,9,10, 9,8,7,6) if pattern == 2
    
    ((bar_length * length)).times do ; tick
      if bools(1,0,0,0).tick(:p)
        with_synth :organ_tonewheel do
          play scl[notes.tick(:n)],
            amp: rrand(0.7, 0.8),
            sustain: (ring 2,1).tick(:s),
            attack: 0.1,
            release: (ring 1,2).tick(:r)
        end
        
        with_synth :piano do
          play scl[notes.look(:n)],
            amp: rrand(0.3, 0.4),
            sustain: (ring 2,1).look(:s),
            attack: 0.1,
            release: (ring 1,2).look(:r),
            pan: -0.3
        end
      end
      
      sleep_with_swing 1
    end
  end
end

define :chords do |length = 8, pattern = 1|
  in_thread do
    notes = (ring 21, 21, 20, 19) if pattern == 1
    notes = (ring 21, 21, 19, 18) if pattern == 2
    
    with_fx :ping_pong, phase: 1, feedback: 0.7 do
      ((bar_length * length) / 2).times do ; tick
        if bools(0,0,1,0).tick(:p)
          with_synth :rodeo do
            play (chord_degree :i, scl[notes.tick(:n)], mode, 3),
              amp: rrand(0.6, 0.7),
              sustain: 0.1,
              attack: 0.1,
              release: [4,4,4,5].look(:p)
          end
        end
        
        sleep_with_swing 2
      end
    end
  end
end

define :lead do |length = 8, pattern = 1|
  in_thread do
    idx = get[:lead_counter]
    notes = (ring 21,22,23,24, 25,25,25,25, 25,26,27,26, 21,22,21,25,
             18,20,21,22, 23,23,23,23, 23,24,25,24, 19,20,19,22) if pattern == 1
    
    notes = (ring 21,22,23,24, 23,23,23,23,
             22,22,22,22, 22,21,22,24, 20,19).reverse if pattern == 2
    
    with_fx :rlpf do |fltr|
      ((bar_length * length) * 4).times do ; tick
        control fltr,
          cutoff: line(70, 95, steps: 32).mirror.look,
          res: line(0.6, 0.5, steps: 16).reflect[look]
        
        if bools(1,0,0,0, 0,0,0,0, 1,0,0,0, 0,0,1,0,
                 1,0,0,0, 0,0,0,0, 1,0,0,0, 0,0,0,0,
                 1,0,0,0, 0,0,0,0, 1,0,0,0, 0,0,1,0,
                 1,0,0,0, 0,0,0,0, 1,0,0,0, 1,0,1,0).tick(:p)
          with_synth :organ_tonewheel do
            play scl[notes[idx]],
              amp: rrand(0.7, 0.8),
              sustain: 0.1,
              attack: 0.1,
              release: 0.5,
              pan: 0.8
            
            if one_in(2)
              with_synth :winwood_lead do
                play scl[notes[idx]],
                  amp: rrand(0.3, 0.4),
                  sustain: 0.1,
                  attack: 0.1,
                  release: 2
              end
            end
            
            play scl[notes[idx]] -0.05,
              amp: rrand(0.6, 0.7),
              sustain: 0.1,
              attack: 0.1,
              release: 1,
              pan: -0.8
            
            play scl[notes[idx] + 8] -0.05,
              amp: rrand(0.7, 0.8),
              sustain: 0.1,
              attack: 0.1,
              release: 2,
              pan: 1
            
            play scl[notes[idx] + 8],
              amp: rrand(0.7, 0.8),
              sustain: 0.1,
              attack: 0.1,
              release: 1,
              pan: -1
          end
          
          idx += 1
        end
        
        sleep_with_swing 0.25
      end
    end
    
    set :lead_counter, idx
  end
end

define :lead_alt do |length = 8, pattern = 1|
  in_thread do
    idx = get[:lead_counter]
    notes = (ring 21,22,23,24, 25,25,25,25, 25,26,27,26, 21,22,21,25,
             18,20,21,22, 23,23,23,23, 23,24,25,24, 19,20,19,22) if pattern == 1
    
    notes = (ring 21,22,23,24, 23,22,21,20, 22,21,20,19, 21,20,19,18,
             21,22,23,24, 21,22,23,24, 21,22,23,24, 24,23,22,21) if pattern == 2
    
    notes = (ring 21,20,19,18, 17,16,17,16, 22) if pattern == 3
    
    with_fx :rlpf do |fltr|
      ((bar_length * length)).times do ; tick
        control fltr,
          cutoff: line(60, 90, steps: 16).reflect[idx],
          res: line(0.6, 0.5, steps: 16).reflect[idx]
        
        with_synth :organ_tonewheel do
          play scl[notes[idx]],
            amp: rrand(0.7, 0.8),
            sustain: 0.1,
            attack: 0.1,
            release: 0.5,
            pan: 0.8
          
          if one_in(2)
            with_synth :winwood_lead do
              play scl[notes[idx]],
                amp: rrand(0.3, 0.4),
                sustain: 0.1,
                attack: 0.1,
                release: 2
            end
          end
          
          play scl[notes[idx]] -0.05,
            amp: rrand(0.6, 0.7),
            sustain: 0.1,
            attack: 0.1,
            release: 1,
            pan: -0.8
          
          play scl[notes[idx] + 8] -0.05,
            amp: rrand(0.7, 0.8),
            sustain: 0.1,
            attack: 0.1,
            release: 2,
            pan: 1
          
          play scl[notes[idx] + 8],
            amp: rrand(0.7, 0.8),
            sustain: 0.1,
            attack: 0.1,
            release: 1,
            pan: -1
        end
        
        idx += 1
        sleep_with_swing 1
      end
    end
    
    set :lead_counter, idx
  end
end


define :slow_synth do |length = 8, pattern = 1|
  in_thread do
    notes = (ring 28,27,26,25)
    
    with_fx :wobble, phase: 1, smooth: 1 do
      ((bar_length * length) / 4).times do ; tick
        if bools(0,1).look
          with_synth :blade do
            play scl[notes.tick(:n)],
              amp: rrand(0.5, 0.6),
              attack: 10,
              release: 12,
              pan: [0.5, -0.5].choose
          end
        end
        
        sleep 8
      end
    end
  end
end

define :drums do |length = 8, pattern = 1|
  in_thread do
    s = :loop_compus
    slices = (line 0, 15, steps: 16, inclusive: true) +
      (line 0, 15, steps: 8, inclusive: true)
    
    with_fx :eq, low_note: 30, low: -0.2, mid_note: 59, mid: -0.3 do
      ((bar_length * length)).times do ; tick
        
        if pattern == 1
          sample s,
            slice: slices.look,
            amp: rrand(2.9, 3.0)
        end
        
        if pattern == 2 and bools(0,0,1,0).look
          sample :drum_cymbal_open, rate: -1, amp: 1.5
        end
        
        sleep_with_swing 1
      end
    end
  end
end


# Reset globals
set :lead_counter, 0


# Structure
with_fx :compressor, threshold: 0.4 do
  lead_alt ; bar
  lead_alt(8,2) ; bar
  
  lead ; slow_synth ; bar
  lead(8,2) ; bar(7); bass_clef(1,1) ; bar(1)
  
  bass_clef ; chords ; lead ; bar
  bass_clef(8,2) ; chords(8,2) ; lead(8,2) ; bar(6) ; drums(1,2) ; bar(2)
  
  bass_clef ; chords ; slow_synth ; lead_alt ; drums ; bar
  bass_clef(8,2) ; chords(8,2) ; lead_alt(8,2) ; drums ; bar
  set :lead_counter, 0
  bass_clef(8,2) ; chords(8,2) ; lead_alt(8,3) ; drums ; bar
  bass_clef ; chords ; lead_alt ; drums ; bar
  
  bass_clef ; chords ; slow_synth ; lead ; drums ; bar
  bass_clef(8,2) ; chords(8,2) ; lead(8,2) ; drums ; bar
  
  bass_clef ; chords ; lead_alt ; drums ; bar
  bass_clef(8,2) ; chords(8,2) ; lead_alt(8,2) ; drums ; bar
end
1 Like

Wow, that’s a spicy flavor!