Skip to content

Instantly share code, notes, and snippets.

@jprudent
Created September 20, 2021 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jprudent/38a28481c902437aaff30eae7df5acdb to your computer and use it in GitHub Desktop.
Save jprudent/38a28481c902437aaff30eae7df5acdb to your computer and use it in GitHub Desktop.
Some generated music with sonic-pi, reaggae like
use_bpm 128
tpb = 60 / 128.0
chord_trigg = [0, 0,1,0]
kick_trigg = [1, 0,0,0]
snare_trigg = [1, 0 ,0,0]
bass_trigg = [0,1, 0 ,1]
ks = [:kick, :snare]
define :orchestrator do
cue ks.tick(:ks) if kick_trigg.tick(:kick) > 0
cue :arp if one_in(2)
cue :chords if chord_trigg.tick(:chords) > 0
cue :bass if bass_trigg.tick(:bass) > 0
sleep tpb
sleep tpb if one_in(16)
end
define :bass do
sync :bass
use_synth :subpulse
play choose([:e2, :e2 + 7]), sustain: tpb*1.5, amp: 1, cutoff: 40
end
define :arp do
sync :arp
use_synth :tb303
note = choose(chord(:e2, :minor))
play note, release: 2, cutoff: rrand(60, 80)
with_fx :slicer, phase: 0.5 do
sleep rand(0.2)
play note+choose([12, 24, 12, 24, 12+7, 24-5]), release: 1, cutoff: rrand(100, 130)
end
end
define :chords do
sync :chords
use_synth :piano
sleep rand(0.1)
play chord([:e3, :e4, :e5, :e5, :e4].tick(:chord_n), :minor), cutoff: 66, amp: 1
end
define :snare do
sync :snare
room = 0.5
room = 1 if one_in(10)
sample :bd_808, amp: 1
with_fx :reverb, room: room do
sample :sn_zome, amp: 1
end
end
define :kick do
sync :kick
sample :bd_808, amp: 7
with_fx :reverb, room: 1 do
sample :bd_pure, amp: 3
end
end
in_thread(name: :bass) do
loop do
bass
end
end
in_thread(name: :snare) do
loop do
snare
end
end
in_thread(name: :kick) do
loop do
kick
end
end
in_thread(name: :chords) do
loop do
chords
end
end
in_thread(name: :arp) do
loop do
arp
end
end
in_thread(name: :orchestrator) do
loop do
orchestrator
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment