Last active
May 8, 2020 20:11
-
-
Save thelemonyfresh/6b2eb3ea1d220db0ac0997307f2266a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use_bpm 75 # change this to change the tempo | |
live_loop :conductorator do | |
root = :E # change this to an musical note to change the 'key' (i.e. :A, :E, :G) | |
use_random_seed 6 # change this to any integer get different songs (I like 6, 1337, 74) | |
# uncomment/comment any of the 'nil' lines to stop/start any instruments from playing on the next iteration | |
# change any of the "amp: x" (0<x<1) params to adjust relative volume | |
set(:kick_pattern, {times: spread_to_pattern(spread(range(2,8,1).choose,16),0.5), length: 8, amp: 0.5}) | |
#set(:kick_pattern, nil) | |
set(:hihat_pattern, {times: spread_to_pattern(spread(range(7,15,2).choose,32),0.25), length: 8, amp: 0.7}) | |
#set(:hihat_pattern, nil) | |
set(:synth_pattern, {notes: chord(root, :major7).shuffle, step_length: 1, amp: 0.5}) | |
#set(:synth_pattern, nil) | |
set(:piano_pattern, {notes: (scale(root, :major) + knit(:r,range(1,16).choose)).pick(32), step_length: 0.5}) | |
#set(:piano_pattern, nil) | |
set(:ambi_pattern, {note: root, length: 8, amp: 0.15}) | |
#set(:ambi_pattern, nil) | |
sleep 8 | |
end | |
# PROBABLY DON'T CHANGE ANYTHING BELOW HERE | |
#### | |
# Loops. | |
#### | |
with_fx :reverb, room: 0.7 do | |
live_loop :kick_player, sync: :conductorator do | |
pattern = get(:kick_pattern) | |
stop if pattern.nil? | |
puts "kick: #{pattern}" | |
times = pattern[:times] | |
length = pattern[:length] | |
amp = pattern[:amp] | |
at times do | |
sample :bd_sone, amp: amp, | |
attack: 0.001, attack_level: 1.2, | |
decay: 0.1, sustain_level: 0.8, | |
sustain: 0.2, | |
release: 0.1 | |
end | |
sleep length | |
end | |
live_loop :hihat_player, sync: :conductorator do | |
pattern = get(:hihat_pattern) | |
stop if pattern.nil? | |
times = pattern[:times] | |
length = pattern[:length] | |
amp = pattern[:amp] | |
at times do | |
sample :drum_cymbal_closed, amp: amp, | |
attack: 0.01, decay: 0.1, sustain: 0, release: 0.1, | |
cutoff: 115 | |
end | |
sleep length | |
end | |
live_loop :synth_player, sync: :conductorator do | |
pattern = get(:synth_pattern) | |
stop if pattern.nil? | |
puts pattern | |
nts = pattern[:notes] | |
num_steps = nts.length | |
step_length = pattern[:step_length] | |
amp = pattern[:amp] | |
use_synth :fm | |
num_steps.times do | |
play nts.tick, amp: amp, | |
attack: 0.1, decay: 0, sustain: 0, release: step_length, pan: -0.25, | |
depth: 0.7 | |
sleep step_length | |
end | |
end | |
live_loop :piano_player, sync: :conductorator do | |
pattern = get(:piano_pattern) | |
stop if pattern.nil? | |
puts pattern | |
nts = pattern[:notes] | |
num_steps = nts.length | |
step_length = pattern[:step_length] | |
amp = pattern[:amp] | |
use_synth :piano | |
use_transpose 12 | |
num_steps.times do | |
play nts.tick, amp: amp, | |
attack: 0.05, decay: 0.1, sustain: 0, release: step_length, stereo_width: 1, | |
hard: 0.3 | |
sleep step_length | |
end | |
end | |
live_loop :ambi_player, sync: :conductorator do | |
pattern = get(:ambi_pattern) | |
stop if pattern.nil? | |
nt = pattern[:note] | |
len = pattern[:length] | |
amp = pattern[:amp] | |
use_synth :sine | |
use_transpose -12 | |
with_fx :flanger, depth: 0, depth_slide: 8, phase: 1, mix: 0.25 do |flange| | |
play nt, amp: amp, | |
attack: 4, decay: 1, sustain: 1, release: 4, | |
cutoff: 80 | |
control flange, depth: 1 | |
end | |
sleep len | |
end | |
end | |
#### | |
# Utility. | |
#### | |
define :spread_to_pattern do |sprd, step_length = 1| | |
sprd.to_a.inject([]) { |acc, bool| | |
if bool | |
acc << acc.length * step_length | |
else | |
acc << nil | |
end | |
acc | |
}.compact | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment