Skip to content

Instantly share code, notes, and snippets.

@kindohm
kindohm / timing.rb
Created July 22, 2015 17:45
timing
live_loop :thing do
sample :drum_bass_hard
sleep 0.75
4.times do
sample :drum_cymbal_soft, rate: rrand(2,4)
sleep 0.125
end
end
live_loop :snare do
@rbnpi
rbnpi / scaletypecontrolledarpeggios.rb
Last active August 29, 2015 14:25
scaletypecontrolledarpeggios.rb An exercise in composing a piece based on scale types, three chords and arpeggios. Fully commented to explain how it works. Needs SP 2.6. Audio on https://soundcloud.com/rbnman/scaletypecontrolledarpeggios
#loading...#scaletypecontrolledarpeggios.rb by Robin Newman, July 2015. Requires sp2.6
#A study using arpeggios with different scale formats. Also utilising rings and ticks
#This was a great exercise to explore different Sonic Pi (and Ruby) commands
#eg tick, look, ring, note_range for SP and string manipulation commands and eval for Ruby to mention some.
#First of all in the defined procedures which enable you to extract info about different scale types
#and to generate the rings required for the piece to work.
#Basically the code generates a pool of notes for three separate chords and then transposes those notes
#using notes 0,3,4 and 4 (down an octave) for each of the distinct 8 note scales supported in Sonic Pi
live_loop :drums do
with_fx :level, amp:1.0 do
sample :bd_ada, attack:0, sustain_level:0, decay: 0.1, start: 0, amp:2, rate:0.5
sleep 0.125
with_fx :reverb, mix:0.2, room:0.5 do
sample :perc_snap, attack:0, sustain_level:0, decay: (ring 0.1, 0.1, 0.1, 0.5).tick(:t1), start: 0, amp:1, rate:(ring -2, -3, -4, -5).tick(:t1b)
sleep 0.125
with_fx :krush, mix:0.7 do
sample :misc_burp, attack:0, sustain_level:0, decay: 0.4, start: 0.5, amp:(ring 0.4, 0.6, 0.8, 0).tick(:t2), rate:0.9
end
#samples = Dir.glob("/path/to/samples/*.wav")
#samples = [:loop_amen_full, :ambi_choir]
#samples = [:ambi_choir]
samples = [:guit_harmonics]
#starts = (ring 0, 0.25, 0.5, 0.75)
#starts = range(0, 0.875, 0.125)
starts = range(0, 0.875, 0.0625)
#starts = (0..10).collect{rand(1)}
@samaaron
samaaron / dnb.rb
Last active August 23, 2020 08:10
Derivative Drum and Bass
# Super simple drum and bass
# Coded by Sam Aaron w/ Sonic Pi
# To play: download Sonic Pi from the link below, paste the code in and hit Run
# http://sonic-pi.net
use_bpm 100
live_loop :amen_break do
@darinwilson
darinwilson / ambient1
Created August 14, 2015 19:46
Ambient experiment using Sonic Pi
# Ambient experiment for Sonic Pi (http://sonic-pi.net/)
#
# The piece consists of three long loops, each of which plays one of
# two randomly selected pitches. Each note has different attack,
# release and sleep values, so that they move in and out of phase
# with each other. This can play for quite awhile without
# repeating itself :)
live_loop :note1 do
use_synth :hollow
@alyssa
alyssa / sonic_pi_feeling_blue.rb
Last active July 9, 2022 15:58
Standard 12 bar blues (bass line + comping) for sonic pi (sonic-pi.net)
# Standard 12 bar blues
# I7 | IV7 | I7 | I7
# IV7 | IV7 | I7 | I7
# V7 | IV7 | I7 | I7
# Choose a root note (one) and everything else will fall into place.
one = :G2
four = one + 5
five = one + 7
# Both live loops play in total rhythmical sync.
# Notice that they are both using the same seed
# One in Ruby and the other in the synthdef ;-)
# Note: needs Sonic Pi v2.7 to work correctly
live_loop :foo do
use_random_seed 10
64.times do
# Coded by Sam Aaron
bizet_bass = (ring :d, :r, :r, :a, :f5, :r, :a, :r)
#bizet_bass = (ring :d, :r, :r, :Bb, :g5, :r, :Bb, :r)
live_loop :bizet do
with_fx :reverb, room: 1, mix: 0.3 do
with_fx :slicer, phase: 0.125 do
synth :blade, note: :d4, release: 8, cutoff: 100, amp: 1.5
end
16.times do
@darinwilson
darinwilson / SonicPiDrumMachine
Last active March 2, 2024 20:11
Sonic Pi Drum Machine
#########################################
## Sonic Pi Drum Machine
## coded by Darin Wilson
##
use_bpm 95
in_thread(name: :drum_machine) do
# choose your kit here (can be :acoustic, :acoustic_soft, :electro, :toy)