Skip to content

Instantly share code, notes, and snippets.

@paradoxinversion
Last active May 7, 2020 02:54
Show Gist options
  • Save paradoxinversion/00e14ff2aed31d7bef13330a3c28b6c2 to your computer and use it in GitHub Desktop.
Save paradoxinversion/00e14ff2aed31d7bef13330a3c28b6c2 to your computer and use it in GitHub Desktop.
set_mixer_control! amp: 1, amp_slide: 8
# Our global music bpm
global_bpm = 90
define :mainSynth do |n|
synth :beep, note: n
end
# Generates random melodies based on the given seed
define :melody_generator do
use_bpm global_bpm
# These seeds give us different beat patterns
patterns_seeds = (ring 10000, 500, 60188, 5000, 101010)
# This ringe determines which seed to play at which iteration
melody_ring = (ring 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 2, 0, 4, 4, 4)
# These are the music notes the generator chooses from
notes = (scale :e3, :major_pentatonic);
# Tick the melody ring with a unique name
pattern_seed = melody_ring.tick(:foobar)
##| use_random_seed patterns_seeds[pattern_seed]
use_random_seed 60188
melody_sleep = 0.25
# Set up a controlled synth for the melody
##| with_fx :ixi_techno, phase: 2, cutoff_max: 50, mix: 0, mix_slide: 2, amp: 0.75, res: 0.5 do |bc|
16.times do
with_fx :slicer, phase: 0.50 do
mainSynth notes.choose
sleep melody_sleep
end
end
##| end
end
define :drum_generator do |seed|
use_bpm global_bpm
patterns_seeds = (ring 501, 5000)
use_random_seed patterns_seeds[seed] #500 is good...
with_fx :reverb do
2.times do
8.times do
sample :bd_haus, lpf: 69 if one_in(3) # maybe ada and/or haus?
sample :bd_ada, lpf: 69 if one_in(2) # maybe ada and/or haus?
sleep 0.25
end
end
end
end
live_loop :melody do
with_fx :level, amp: 1, amp_slide: 3 do |go|
sync :drums
melody_generator
control go, amp: 0
end
end
live_loop :main_drums do
cue :drums
drum_generator 60188
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment