Sonic Pi: Heartbeat
Cet article n’existe qu’en anglais.
The code of a live coding practice session built around a heartbeat loop.
Part of the Sonic Pi notebook, 2016–2018.
use_debug false
live_loop :heartbeat do
stop
with_fx :echo, phase: 0.5, max_phase: 0.25 do
synth :fm, note: :c2
sleep 1
end
end
live_loop :counter, sync: :heartbeat do
stop
notes = (stretch [:e3, :e4], 2).tick
s = synth :pulse, note: notes, note_slide: 0.1, cutoff_slide: 1, cutoff: 30,
pulse_width: 0.1
control s, note: :e1, cutoff: 60
sleep 0.5
end
live_loop :repet, sync: :heartbeat do
stop
#ctrlcut = (ramp * range(28, 85, 1)).tick
ctrlcut = 60
puts ctrlcut
sleep 0.25
s = synth :prophet, note: :e4, note_slide: 0.1, cutoff_slide: 0.5, cutoff: 40
control s, note: :e4, cutoff: ctrlcut
sleep 0.25
end
live_loop :bd, sync: :heartbeat do
stop
sleep 0.075
sample :bd_pure
sleep 0.425
end
live_loop :scale, sync: :heartbeat do
tick
stop
cutoff = (line 40, 130, steps: 16).mirror.look
use_random_seed (stretch [5, 10, 15], 32).look
with_fx :reverb, mix: 0.75, damp: 1, amp: 0.5 do
sample :misc_cineboom, rpitch: (scale 32, :hungarian_minor, num_octaves: 2).shuffle.look,
amp: 0.75, lpf: cutoff
sleep (ring 0.125, 0.075, 0.25, 0.075).look
sleep 0.075
end
end
live_loop :melody ,sync: :heartbeat do
stop
with_fx :hpf, cutoff: 75 do
with_fx :reverb, mix: 0.8, room: 1, damp: 0.9 do
use_synth :growl
use_synth_defaults res: 0.9, env_curve: 3
play_pattern_timed [:c3, :f3, :ab4, :c4, :ab4, :c4, :f3, :ab5, :c3],
[0.25, 0.5, 0.25, 0.75, 0.25], amp: 0.1
sleep 4
end
end
end
live_loop :snares, sync: :heartbeat do
stop
with_fx :slicer, phase: 0.25, amp_min: 0.5 do
sample :drum_cymbal_open, amp: 1, start: 1, finish: 0.5, hpf: 120, beat_stretch: 1
sleep 1
end
end
live_loop :calm, sync: :heartbeat do
stop
with_transpose (stretch [0, 5, 12, -3], 32).tick do
with_fx :echo, phase: 0.25 do
density 2 do
with_fx :hpf, cutoff: 120 do
with_fx :reverb, mix: 1, room: 1, damp: 0.9 do
use_synth :mod_fm
use_synth_defaults mod_phase: 2, divisor: (stretch [0.5, 1, 4], 16).look
play_pattern_timed [:c4, :f4, :ab5, :c5, :ab5, :f4, :ab6, :c4],
[0.25, 0.5, 0.25, 0.75, 0.25], amp: 0.1
sleep 0.25
end
end
end
end
end
end
live_loop :break, sync: :heartbeat do
tick
stop
cut = (ramp * range(5, 90, 1)).look
with_fx :lpf, cutoff: cut do
use_random_seed (stretch [9944], 2, [9958], 2, [9591], 4).look
8.times do
sample :drum_heavy_kick, rate: (stretch [-1, 1], 4).look, hpf: 40 if one_in(5)
sample :elec_blup, start: 0.4, finish: 0.45, rate: -1 if one_in(3)
sample :bass_dnb_f, amp: 0.2, rpitch: -24 if one_in(4)
sample :bd_haus if one_in(4)
sample :bd_boom, amp: 0.5, beat_stretch: 4 if one_in(3)
sleep 0.125
end
end
end
live_loop :windy_mod, sync: :heartbeat do
stop
with_fx :level, amp: 0.10 do
centreline = (line 30, 120, steps: 16).mirror.tick
with_fx :rbpf, centre: centreline, res: 0.90 do
with_fx :gverb, damp: 1, room: 200, ref_level: 2 do
with_fx :wobble, phase: 0.125, smooth: 1, pulse_width: 0.9 do
synth :mod_dsaw, phase: 0.075, pulse_width: 0.1, res: 0.95, wave: 1,
note: :c3, sustain: 2, release: 0, mod_range: 12, detune: 0.12
sleep 2
end
end
end
end
end
Originally published on svdk.fr in 2017.