# Beat
use_bpm 100

# KNISTERN
live_loop :knister_schleife do
  sample :vinyl_hiss, amp: 2
  sleep sample_duration :vinyl_hiss
end

# HIHAT
define :hihat do
  use_synth :pnoise
  with_fx :hpf, cutoff: 120 do
    play release: 0.01, amp: 13
  end
end

live_loop :hihat_schleife do
  aufteilungen = ring 2, 4, 2, 2, 2, 2, 2, 6
  aufteilungen[tick].times do
    hihat
    sleep 1.0 / aufteilungen[look]
  end
end

# SNARE
live_loop :snare_schleife do
  sleep ring(2.5, 3)[tick]
  with_fx :lpf, cutoff: 100 do
    sample :sn_dub, sustain: 0, release: 0.05, amp: 3
  end
  sleep ring(1.5, 1)[look]
end

# BASSDRUM
define :bassdrum do |note1, dauer, note2 = note1|
  use_synth :sine
  with_fx :hpf, cutoff: 100 do
    play note1 + 24, amp: 40, release: 0.01
  end
  with_fx :distortion, distort: 0.1, mix: 0.3 do
    with_fx :lpf, cutoff: 26 do
      with_fx :hpf, cutoff: 55 do
        bass = play note1, amp: 85, release: dauer, note_slide: dauer
        control bass, note: note2
      end
    end
  end
  sleep dauer
end

live_loop :bassdrum_schleife do
  bassdrum 36, 1.5
  if bools(0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0)[tick]
    bassdrum 36, 0.5, 40
    bassdrum 38, 1, 10
  else
    bassdrum 36, 1.5
  end
  bassdrum 36, 1.0, ring(10, 10, 10, 40)[look]
end

# Coded by Pit Noack
# supported by
# Alexander Degraf
# Enrico Mercaldi
# http://www.maschinennah.de/
# mail@pitnoack.de
