Skip to content

Instantly share code, notes, and snippets.

@nischalshrestha
Last active September 12, 2020 04:30
Show Gist options
  • Save nischalshrestha/c44fcbebce7cc882ce05365628363071 to your computer and use it in GitHub Desktop.
Save nischalshrestha/c44fcbebce7cc882ce05365628363071 to your computer and use it in GitHub Desktop.
Electronic disco beat
#| electro-disco (4/4)
use_bpm 100
note_value = 0.5 # eighth notes
beats = 8
# beat on/off patterns
hh = spread(8, beats) # hit every beat
sn = spread(2, beats).rotate(-2) # hit 2nd and 4th beat
b = spread(1, beats) # hit 1st and 2nd beat
bd1 = spread(1, 4) * 2 # custom for bass drum
bd2 = spread(1, 8 * 2).rotate(1) # custom for bass drum
sb = spread(1, beats * 2).reverse # hit once every 2 bars
# main beat
with_fx :reverb, room: 0.6 do
live_loop :disco_beat do
beats.times do
if bd1.tick
sample :bd_haus
with_synth :tri do
play 30, amp: 0
end
end
if sb.look
with_synth :tri do
play 37, amp: 0
end
end
if bd2.look
2.times do
sleep note_value / 2
sample :bd_haus, amp: 0.25
end
##| sleep note_value
elsif sn.look
##| sample :sn_dub, attack: 0, release: 2, amp: 0.0125
##| sample :sn_dolf, attack: 0, release: 0.25
##| sample :perc_snap, rate: 1, amp: 0.25
##| sample :perc_snap2, rate: 1, amp: 0.25
sleep note_value
else
sleep note_value
end
end
end
end
# pizzaz
with_fx :reverb, room: 0.8 do
live_loop :cymbals do
if spread(7, beats).tick
sample :drum_cymbal_closed, attack: 0, amp: 0
end
if spread(6, beats).look
sample :drum_cymbal_hard, attack: 0, amp: 0
end
sample :drum_cymbal_closed, attack: (ring 0, 0.005).look, amp: (range 0.25, 1, step: 0.125).look
sleep (note_value / 2)
end
end
# synths
with_fx :reverb, room: 0.8 do
live_loop :synths do
with_synth :saw do
if spread(7, beats).tick
##| play 22, attack: 0, amp: 8, release: 0.125
play 30, attack: 0, amp: 0, release: 0.125
##| play 37, attack: 0, amp: 1, release: 0.125
play 42, attack: 0, amp: 0, release: 0.125
end
with_fx :flanger, phase: 1, delay: 4, wave: 1 do
if spread(1, beats).look
play 42, attack: 1, amp: 0, release: 0.125
##| play 61, attack: 1, amp: 0.8, release: 0.125
##| play 66, attack: 1, amp: 0.8, release: 0.125
##| play 71, attack: 1, amp: 0.8, release: 0.125
##| play 75, attack: 1, amp: 0.8, release: 0.125
##| play 78, attack: 4, amp: 0.1, release: 4
##| play 80, attack: 1, amp: 0.8, release: 0.125
##| play 85, attack: 4, amp: 0.01, release: 4
##| play 90, attack: 1, amp: 0.8, release: 0.125
##| play 97, attack: 1, amp: 0.8, release: 0.125
end
end
sleep (note_value / 2)
end
end
end
# the occassional shaker
with_fx :reverb, room: 0.9 do
live_loop :shaker2 do
if (spread 1, beats * 4).tick
4.times do
# source for sample of shaker: https://samplefocus.com/samples/percussive-shaker
sample "~/Downloads/percussive-shaker.wav", amp: 3, rate: 1, pan: [0.5, -0.5].tick
sleep note_value / 2
end
else
sleep note_value * 2
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment