Skip to content

Instantly share code, notes, and snippets.

@MaciejLisCK
Last active August 14, 2018 19:27
Show Gist options
  • Save MaciejLisCK/9a1cbba1c40bdf13b56909c37bcf4a3e to your computer and use it in GitHub Desktop.
Save MaciejLisCK/9a1cbba1c40bdf13b56909c37bcf4a3e to your computer and use it in GitHub Desktop.
Sonic Pi Cheatsheet

Function - define

define :foo do
  
end

Function - define with parameter

define :foo do |n|
  
end

Function - run

foo

Function - run with parameter

foo 2

Loop

loop do

end

Loop 3 times

3.times do

end 

If

  if one_in(2)
    
  else
    
  end

Line If

play 53 if one_in(2)

Thread

in_thread do

end

Thread with name

in_thread(name: :foo) do

end

Variable

number = 2
sample_name = :loop_amen

FX

with_fx :reverb do

end 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment