I love that everyone gives their own little recipe!
I played around the idea of getting better track controls, this is what I have:
# you start by configuring your tracks (easier to remember with names)
tracks = { lead: true, pad: true, beat: true }
solo is a pretty simple helper function
def solo! tracks, name
# go through each track make it true or false depending on
# the current track being the one you want to solo
tracks.each do |key, value|
tracks[key] = key == name
end
end
mute is even simpler
def mute! tracks, name
tracks[name] = false
end
I got fancy and made a function that checks if the track is on, it’s completely optional.
# you have to add a fallback duration equivalent to your loop length:
# in case the track is turned off it sleeps for the loop duration
def track_switch is_on, duration
if is_on
yield
else
sleep duration
end
end
Then you can use the controls pretty easily! Just comment and uncomment the lines and you’re set ![]()
solo! tracks, :pad
# or
mute! tracks, :lead
# etc.
I think it works pretty well! I haven’t paid attention to the sync stuff though but you can adapt from earlier answers if necessary.
The only thing you need to be careful about is the order: if you call for something before you define it the editor won’t be too happy.
The whole thing with a few example tracks you can play around with:
track switch, solo, mute and 3 tracks
# conf
tracks = { lead: true, pad: true, beat: true }
# helpers
def solo! tracks, name
tracks.each { |key, value| tracks[key] = key == name }
end
def mute! tracks, name
tracks[name] = false
end
def track_switch is_on, duration
if is_on
yield
else
sleep duration
end
end
# tracks
solo! tracks, :pad
live_loop :lead_loop do
track_switch tracks[:lead], 2 do
play_pattern_timed scale(:e4, :mixolydian).shuffle,
[2/3.0, 1/3.0, 2/3.0, 1/3.0], amp: 0.2
end
end
live_loop :pad_loop do
track_switch tracks[:pad], 1 do
sleep 1/3.0
play chord(:e3, :major), decay: 1, pitch: choose([0, 3, -2])
sleep 2/3.0
end
end
live_loop :beat_loop do
track_switch tracks[:beat], 1/3.0 do
sample choose([:perc_snap, :perc_snap2]), amp: rrand(0.3, 0.8)
sleep 1/3.0
end
end
EDIT: made the tracks a bit more melodic
EDIT 2: if you want to reuse these all the time, you can make this into a little lib somewhere on your system, ex:
run_file "{path to my lib}/track.rb"