Aphex Twin LFO Step Glitch Effect

### Aphex Twin LFO Step Glitch Effect
### Author: Shea Kennedy (Doffu)
### About: This live_loop instrument chops up a sample programmatically and applies FX based on LFO step positions.
###        Randomness is introduced across various parameters using 'choose'.

# This sets the project BPM.
use_bpm 96
# This sets the random seed (affects any portion of the code that uses randomness).
use_random_seed 0

# This imitates a tri LFO which has 32 steps. It begins at a value of 120, and ends at a value of 60, then mirrors.
lfo1 = (line 120, 60, inclusive: true, steps: 32).mirror
# This imitates a tri LFO which has 4 steps. It begins at a value of 0.7, and ends at a value of 0.99, then mirrors.
lfo2 = (line 0.7, 0.99, inclusive: true, steps: 4).mirror

# This variable controls the instrument's volume. Can be set between 0 and 1 (Higher values could result in distortion or clipping).
inst0_lvl = 1

live_loop :krushbeat do
  # Only proceeds if instrument's volume is not zero.
  if(inst0_lvl != 0)
    # The level FX will apply the current amp volume to the loop.
    with_fx :level, amp: inst0_lvl  do
      # This generates a tick which is used to progress through the LFO steps using 'look'.
      puts tick
      # This adds krush FX with a cutoff and resonance that follow the LFO patterns. The mix of the FX randomly fluctuates between 1 and 0.
      with_fx :krush, cutoff: lfo1.look, res: lfo2.look, mix: choose([1, 0]) do
        # Using the sample loop_breakbeat, the rate of the loop's chop randomly fluctuates between 1, 2, 4, and 16x the original speed.
        # Onset is used in a ring to cycle between a sequence of transient strating points in the audio sample, then mirrors.
        # The beat is stretched across 4 bars with a sample release of 0.01.
        sample :loop_breakbeat, rate: choose([1, 2, 4, 16]), onset: (ring 7,5,5,5,1,2,8,9).mirror.look, beat_stretch: 4, release: 0.01
  # The loop sleeps  depending on the value in the ring as the tick progresses through the steps.
  sleep (ring 0.25, 0.25, 0.25, 0.25, 0.5, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.125, 0.125).look

both this and the other post you made with the amen_flanger are rad & have helped me figure out a couple of new things this week. just wanted to say thx!


Awesome! Glad to hear that. I hope to share more of these useful code snippets going forward.

I’d love to hear what kind of things people use these for, so if you do end up making something with it feel free to share.

1 Like

I’ll try and cook something up for ya soon here! I’ve been working on finishing a different song but I’ll use one of these as the starting point for my next one!

1 Like