Skip to content

Instantly share code, notes, and snippets.

@jprudent
Created March 11, 2022 15:45
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jprudent/f173d2d6fdbdac63584cdf742fa790f7 to your computer and use it in GitHub Desktop.
Ambiant music for sonic-pi
use_bpm 89
def tl(name)
in_thread(name: name) do
loop do
send(name)
end
end
end
@notes = [:e3, :fs3, :g2, :b2, :cs3].ring
def xselnote
@xnote = choose(@notes)
sleep 5
end
xselnote
def xchords
t = rand(12)
a = t*0.2
d = t - a
c = chord(@xnote, :minor)
play c, attack: a, decay: d, decay_level: 0.5
play_pattern_timed c.shuffle, a if tick % 3 == 0
sleep t/2
end
def xpad
use_synth :dark_ambience
play @xnote, decay: 5, amp: 2
sleep 3
end
def xsample
sample :ambi_lunar_land, amp: 0.5, pan: rand(2) - 1, rate: rand(1) + 0.55
sleep rand_i(100) + 10
end
xsample
tl :xchords
tl :xselnote
tl :xpad
tl :xsample
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment