jorshthehacker

Sonic Pi Chiptune Tutorial

Sep 1st, 2017
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #Chiptune tutorial by JorshTheHacker for Sonic Pi.
  2. use_bpm 120 #125 or 130 work better for some songs but 120 is a good number to start with.
  3. use_random_seed 86 #You may want to change this.
  4.  
  5. melody = (ring :c4, :d4, :e4, :f4, :g4, :c5, :b5, :d5, :a5) #melody. This is the sequence of notes for the square (pulse) synth(s).
  6.  
  7. cmelody = (ring :e4, :d4, :c4, :g4, :f4, :e4, :b4, :a4) #counter-melody. This is for the saw synth.
  8.  
  9. bass = (ring :c3, :e3, :g3) #Bass notes. This ring is for the bass synth. Bass sounds should be constant and simple, so keep this between 3 and 5 notes.
  10.  
  11. bass_synth = choose([:tri, :chipbass]) #You can change the seed (above) to modify this.)
  12.  
  13. #timing tools:
  14. x = 0
  15. y = 0
  16. z = 0
  17.  
  18. #actual sounds:
  19. with_fx :bitcrusher do
  20.  
  21. live_loop :sq do
  22. synth :pulse, note: melody.tick, attack: 0.325, release: 0, bits: 4
  23. sleep 0.33
  24. x += 1
  25. if (x == 50)
  26. stop
  27. end
  28. end
  29.  
  30. sleep 8
  31.  
  32. live_loop :saw do
  33. synth :saw, note: cmelody.tick, attack: 0.25, release: 0, bits: 6
  34. sleep 0.265
  35. y += 1
  36. if (y == 60)
  37. stop
  38. end
  39. end
  40.  
  41. sleep 16
  42.  
  43. live_loop :bass do
  44. synth bass_synth, note: bass.tick, attack: 0.25, release: 0.25, bits: 4
  45. sleep 0.55
  46. z += 1
  47. if (z == 60)
  48. stop
  49. end
  50. end
  51. end
  52.  
  53. #Add onto and modify this, and you should be good to go!
Add Comment
Please, Sign In to add comment