Right This Second by Deadmau5 in Sonic pi (+ case statement docs)

I think prophet is my new favorite synth :wink:

The piano distorts a bit, but I didn’t want to record it again.

# 240122 0025 Right This Second by deadmau5 in Sonic pi
# Saved 240122 0025
# My performance https://youtu.be/teTLJmiS5WA
# I learned that I need to place the webcam differently
# https://in-thread.sonic-pi.net/t/right-this-second-by-deadmau5-in-sonic-pi/8564

# orginal "Right This Second by deadmau5" https://www.youtube.com/watch?v=A67GQgoiinM
## I used this note sheet for this https://musescore.com/user/42537914/scores/8438765
## You can also checkout https://www.hooktheory.com/theorytab/view/deadmau5/right-this-second


set_volume! 2
use_bpm 190

define :myarptop do |a,b,c,d|
  
  / change here /
  mysynth = 1
  
  case mysynth
  when 0
  when 1
    use_synth :pluck
    #                  release 0.125-0.9, amp 0-1.9
    use_synth_defaults release: 0.7, amp: 1.5
  when 2
    use_synth :piano
    #                                amp 1-1.5
    use_synth_defaults release: 0.9, amp: 1.25
  end
  
  play [b,a,c,a,d,a, b,a,c,a,d,a, b,a,c,a,d,a, b,a,c,a,d,a].look+12
end


define :myarpbas do |b|
  
  / change here /
  mybas = 1
  
  case mybas
  when 0
  when 1 #normal
    use_synth :prophet
    cu = line(60,80, steps: 6).mirror.tick(:a)
    use_synth_defaults  cutoff: cu, decay: 12
    play b-12, pan: rdist(0.25)
    #play b-12-12, pan: rdist(0.5)
  when 2 #sub
    use_synth :prophet
    cu = line(60,80, steps: 6).mirror.tick(:a)
    use_synth_defaults  cutoff: cu, decay: 12
    #play b-12, pan: rdist(0.25)
    play b-12-12, pan: rdist(0.5)
  when 3 # normal + sub
    use_synth :prophet
    cu = line(60,80, steps: 6).mirror.tick(:a)
    use_synth_defaults  cutoff: cu, decay: 12
    play b-12, pan: rdist(0.25)
    play b-12-12, pan: rdist(0.5)
  end
end


with_fx :reverb, room: 0.9, mix: 0.4 do
  live_loop :a1_piano do
    tick
    
    a = 24
    form = knit(1,a,2,a,3,a,4,a,5,a,6,a,7,a,8,a).look
    #  form = 1
    case form
    when 0
    when 1
      myarptop(:f3, :bb3, :c4, :cs4)
    when 2
      myarptop(:fs3, :bb3, :c4, :cs4)
    when 3
      myarptop(:ds3, :bb3, :c4, :cs4)
    when 4
      myarptop(:f3, :a3, :as3, :c4)
      
    when 5
      myarptop(:f3, :gs3, :as3, :c4)
    when 6
      myarptop(:fs3, :gs3, :as3, :cs4)
    when 7
      myarptop(:ds3, :bb3, :c4, :cs4)
    when 8
      myarptop(:f3, :a3, :as3, :c4)
    end
    
    sleep 0.5
  end
  
  live_loop :a2_bass do
    tick
    
    #a = 24
    a = 1
    form = knit(1,a,2,a,3,a,4,a,5,a,6,a,7,a,8,a).look
    #form = 1
    
    case form
    when 0
    when 1
      myarpbas(:as3)
    when 2
      myarpbas(:fs3)
    when 3
      myarpbas(:ds3)
    when 4
      myarpbas(:f3)
      
    when 5
      myarpbas(:f3)
    when 6
      myarpbas(:fs3)
    when 7
      myarpbas(:ds3)
    when 8
      myarpbas(:f3)
    end
    
    sleep 0.5*24
  end
  
end
2 Likes

Wow! Beautiful, esp the chord progression around 2’20"

Am wondering about ‘case’ - is it a different language or in another documentation source? I sometimes see techniques I’d like to understand and can’t find in Lang/tutorial. Thank you!

1 Like

It’s the way Ruby does switch

1 Like

I dont remember where I picked up the “case”, but I find it very useful. I dont know if there is a better way to do these selections. Since Sonic Pi is build on Ruby then we basically can check if something from the normal Ruby language works in Sonic Pi.

I think I watched this video as some point.

Overview - 1:32 Setup - 3:16 Printing - 3:43 Variables & Data Types - 4:18 Casting - 5:58 Strings - 7:13 Numbers - 8:56 User Input - 11:28 Arrays - 13:14 2d Arrays - 15:01 Array Functions - 15:33 Methods - 16:58 If Statements - 18:08 Switch Statements - 19:53 Dictionaries - 20:43 While Loops - 22:15 For Loops - 22:59 Exception Catching - 24:49 Classes & Objects - 27:11 Constructors - 28:53 Getters & Setters - 30:03 Inheritance - 31:50 Source Code - http://www.giraffeacademy.com/program…

1 Like

Thanks @Davids-Music-Lab and @Relaxnow - have watched them - a great help.

1 Like