Created
November 9, 2021 17:43
-
-
Save mbutz/04e7e2d00d1327b5a94ea08e7833c7dd to your computer and use it in GitHub Desktop.
Noise to Music (Sonic Pi)
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
# Noise to music | |
# filename: perf-noise-to-music.rb | |
use_bpm 120 | |
live_loop :bar do | |
sleep 4 | |
end | |
with_fx :sound_out_stereo, output: 5 do | |
live_loop :noise, sync: :bar do | |
stop | |
use_synth :gnoise | |
use_synth_defaults attack: 2, sustain: 2, release: 2 | |
with_fx :rbpf, centre: (scale :c3, :dorian, num_octaves: 4).choose, | |
pre_amp: 0.5, res: 0.75 do | |
with_fx :slicer, phase: (ring 0.25, 0.35, 0.65, 0.85).choose do | |
with_fx :slicer, phase: (ring 0.125).choose , pulse_width: 0.8, smooth: 0.5, invert_wave: 1 do | |
with_fx :panslicer do | |
play :c2, amp: rrand(0.5, 2) * 1 | |
end | |
end | |
end | |
end | |
sleep 1 | |
end | |
end | |
with_fx :sound_out_stereo, output: 3 do | |
live_loop :bd1, sync: :bar do | |
#stop | |
sample :bd_fat, lpf: 80, amp: 1 | |
sleep 2 | |
end | |
live_loop :bd2, sync: :bar do | |
#stop | |
16.times do | |
if spread([3, 5, 7].choose, 16).tick | |
sample :bd_fat, lpf: 60, amp: 0.75 | |
end | |
sleep 0.25 | |
end | |
end | |
live_loop :hats, sync: :bar do | |
#stop | |
sample hihats, "Hats", beat_stretch: 8 | |
at(ring 0, 4) do | |
sample hihats, "Hats", beat_stretch: 4, amp: 1 | |
sample hihats, "Hats", beat_stretch: 4, rate: -1, amp: 0.75 | |
end | |
sleep 8 | |
end | |
live_loop :bass1, sync: :bar do | |
#stop | |
use_synth :fm | |
use_synth_defaults depth: 2, divisor: 1, release: 0.35, cutoff: 50, amp: 1 | |
notes = (ring :c2, :g2) | |
at (ring 0, [2.5, 3.5].choose), notes do | n | | |
play n | |
end | |
sleep 4 | |
end | |
live_loop :bass2, sync: :bar do | |
#stop | |
use_synth :fm | |
use_synth_defaults depth: 2, divisor: 1, release: 0.25, cutoff: 60 | |
n = (scale :c2, :minor_pentatonic, num_octaves: 1.5).shuffle | |
16.times do | |
if spread([3, 5].choose, 16).tick | |
play n.look, amp: rrand(0.5, 0.75) | |
end | |
sleep 0.25 | |
end | |
end | |
live_loop :looser, sync: :bar do | |
#stop | |
v = 1 | |
with_fx :rhpf, cutoff: 30, res: 0.75 do | |
3.times do | |
sample playground + "outtakes", "looser", beat_stretch: 4, amp: v | |
sleep 4 | |
end | |
sample playground + "outtakes", "looser", beat_stretch: 4, start: 0.5, amp: v | |
sleep 2 | |
if one_in 3 | |
sleep 2 | |
elsif | |
8.times do | |
sample playground + "outtakes", "looser", beat_stretch: 4, num_slices: 8, slice: pick, amp: v | |
sleep 0.25 | |
end | |
end | |
end | |
end | |
end # snd 3 | |
with_fx :sound_out_stereo, output: 7 do | |
live_loop :chords, sync: :bar do | |
#stop | |
use_synth :fm | |
use_synth_defaults depth: 0.5, divisor: 2, cutoff: 70, amp: 1, release: 0.5 | |
c = (ring :c4, :d4, :eb4, :f4, :g4, :c5, :d5, :eb5, :f5, :g5) | |
with_fx :rhpf, cutoff: (ring 90, 85, 80).choose, res: 0.75, mix: 0.75 do | |
with_fx :ixi_techno, phase: 4, res: 0.75, mix: 0.5 do | |
with_fx :reverb, room: 0.95, mix: 0.85 do | |
if spread(11, 32).tick | |
play (chord c.choose, ['7sus2', '7sus4', '9sus4'].choose) | |
end | |
end | |
end | |
end | |
sleep (ring 1, 2, 4).choose | |
end | |
end # snd 7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment