Skip to content

Instantly share code, notes, and snippets.

@mbutz
Created April 30, 2017 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mbutz/e4d3d2b6b16405cdebb49343d7890cef to your computer and use it in GitHub Desktop.
Save mbutz/e4d3d2b6b16405cdebb49343d7890cef to your computer and use it in GitHub Desktop.
# filename: noise-to-music-2017-04.30.rb
# You can find a video of a live coded version here: https://www.youtube.com/watch?v=80Sw7G-4nno
use_bpm 120
live_loop :bar do
sleep 4
end
live_loop :ptn, sync: :bar do
sleep 4 * 4
end
with_fx :reverb, room: 0.5, mix: 0.75 do
live_loop :noise_to_music, sync: :bar do
#stop
use_synth :noise
use_synth_defaults attack: 10, sustain: 4, release: 4
with_fx :rbpf, centre: (scale(:c3, :minor_pentatonic, num_octaves: 2).choose), res: 0.83 do
with_fx :panslicer, phase: 0.5, pulse_width: 0.5, pan_min: -1, pan_max: 0.25 do
with_fx :slicer, phase: 0.25, pulse_width: 0.5, smooth: 0.1, invert_wave: 1, mix: 1 do
with_fx :slicer, phase: [0.35,0.65,0.85].choose, mix: 1 do
play :c1, amp: 0
end
end
end
end
sleep 1
end
end
live_loop :hihat, sync: :bar do
stop
8.times do
if spread(4,8).reverse.tick
sample :drum_cymbal_closed, amp: 0.5
end
sleep 0.5
end
end
live_loop :shaker, sync: :bar do
stop
use_synth :noise
use_synth_defaults release: 0.075
16.times do
with_fx :hpf, cutoff: 110 do
play :c1, amp: 0.5
end
sleep 0.25
with_fx :hpf, cutoff: 115 do
play :c1, amp: 0.75
end
sleep 0.25
end
end
live_loop :kick, sync: :bar do
stop
4.times do
if spread(2,4).tick
sample :bd_fat, lpf: 50, amp: 1.25
end
sleep 1
end
end
live_loop :kicka, sync: :bar do
stop
16.times do
if spread([3,7].choose,16).tick
sample :bd_fat, lpf: 90, amp: 0.5
end
sleep 0.25
end
end
live_loop :bass1, sync: :bar do
stop
use_synth :fm
use_synth_defaults divisor: 2, depth: 1, release: 0.25, cutoff: 50, amp: 1.5
bass_line1 = (ring :c2, :bb2, :c3, :bb2)
16.times do
if spread(3,16).tick
play bass_line1.look
end
sleep 0.25
end
end
live_loop :bass2, sync: :bar do
stop
use_synth :fm
use_synth_defaults divisor: 2, depth: 1, release: 0.25, cutoff: 50, amp: 1.0
bass_line2 = (ring :c2, :f1, :bb1, :c3, :eb3, :g2, :c3, :eb3)
16.times do
if spread([0,0,7,9,13].choose,16).tick
play bass_line2.look
end
sleep 0.25
end
end
live_loop :snare, sync: :bar do
stop
8.times do
sleep 1
if one_in 5
with_fx :echo, phase: [0.75].choose, decay: 1, mix: 0.5 do
sample :elec_snare, finish: 0.15, hpf: 85, amp: 0.25
end
else
sample :elec_snare, finish: 0.15, hpf: 85, amp: 0.25
end
sleep 1
end
end
live_loop :chords, sync: :ptn do
stop
sync :ptn
use_synth :fm
use_synth_defaults divisor: 1, depth: 0.1, release: 0.5, release: 2, cutoff: 130, amp: 0.25
with_fx :reverb, room: 1, mix: 0.75 do
128.times do
if spread(5,128).tick
#play chord([:c5,:f5,:eb5,:d5,:a5,:bb5,:c6].choose, '7sus4')
play chord((scale :c5, :minor_pentatonic, num_octaves: 1).choose, '7sus4')
end
sleep 0.25
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment