Golden city song

Original: https://music.yandex.ru/album/5818056/track/43670015

def cuplet_solo (ver = 1)
      with_fx :reverb, mix: 0.5, room: 0.9 do
        use_synth :fm #:prophet
        use_octave +2
        if ver == 0
          play :e3,pan: -1, amp: 3, release: 0.5
          sleep 1
        end
        play_pattern_timed [:c4, :b3, :a3, :ab3,
                            :a3,:e3,
                            :e4, :d4, :c4, :b3,
                            :c4,:a3,
                            :f4,:e4,:d4,:c4,
                            :b3,:c4,:d4,:f4,
        ],
          [ 1, 1, 1, 1,
            3,1,
            1, 1, 1,1,
            3,1,
            1.5,0.5,1.5,0.5,
            #0.17,0.17,0.51,0.25,
            0.5, 0.5, 2,1,
            ], pan: -1, amp: 3, release: 0.5
        if ver == 1 or ver == 0 or ver == 3
          play_pattern_timed [:e4,:d4,:c4,:d4,:b3,:e3],[ 1, 1, 1,1,3,1], pan: -1, amp: 3, release: 0.5
        else
          play_pattern_timed [:e4,:d4,:c4,:b3,:a3,:g4],[ 1, 1, 1,1,3,1], pan: -1, amp: 3, release: 0.5
        end
        
        if ver == 3
          play :a3
          sleep 5
        end
      end
      
      def bass ver = 1
        use_octave 0
        with_fx :reverb, mix: 0.5, room: 0.9 do
          use_synth :sine #prophet#square
          if ver == 0
            sleep 1
          end
          
          play_pattern_timed [:a2,
                              :a3,:e3,:a3,:e3,
                              :a2,
                              :a2,:a3,:d3,:a3,
                              :d2,
                              :f3,
          ],
            [4,
             1,1,1,1,
             4,
             1,1,1,1,
             4,
             4 ], pan:1, attack: 0, amp: 2, release: 0.1
          if ver == 1 or ver == 0
            play_pattern_timed [
              :e3,
            :e2,:a2,:e2,:r],
            [
              4,
            1,1,1,1], pan:1, attack: 0, amp: 2, release: 0.5
          else
            play_pattern_timed [
              :e3,:e2,
            :a2,:e2,:a2],
            [
              2,2,
            1,1,2], pan:1, attack: 0, amp: 2, release: 0.5
          end
        end
      end
    end

    def accord_cuplet ver = 1
      with_fx :tremolo do
        if ver == 0
          sleep 1
        end
        if ver != 2
          chords = [(chord :a3, :min), (chord :a3, :min),
                    (chord :a3, :min),(chord :a3, :min),
                    (chord :d3, :minor), (chord :f3, :maj),
                    (chord :e3, :major), (chord :e3, :minor7)].ring
        else
          chords = [(chord :a3, :min), (chord :a3, :min),
                    (chord :a3, :min),(chord :a3, :min),
                    (chord :d3, :minor), (chord :f3, :maj),
                    (chord :e3, :major), (chord :e3, :major)].ring
          
        end
        c = chords[0]
        
        8.times do
          c = chords.tick
          use_synth :chipbass
          play c[0],amp:3,pan:-1
          sleep 2
          play c, amp:4,pan:-1
          sleep 2
          
        end
      end
    end

    def bell_cuplet ver = 2
      use_synth :dull_bell
      use_octave +3
      with_fx :tremolo do
        if ver == 0
          sleep 1
        end
        if ver != 2
          chords = [(chord :a3, :min), (chord :a3, :min),
                    (chord :a3, :min),(chord :a3, :min),
                    (chord :d3, :minor), (chord :f3, :maj),
                    (chord :e3, :major), (chord :e3, :minor7)].ring
        else
          chords = [(chord :a3, :min), (chord :a3, :min),
                    (chord :a3, :min),(chord :a3, :min),
                    (chord :d3, :minor), (chord :f3, :maj),
                    (chord :e3, :major), (chord :e3, :major)].ring
          
        end
        c = chords[0]
        
        8.times do
          c = chords.tick
          in_thread do
            use_synth :chipbass
            play c[0],amp:5,pan:-1
            sleep 2
            play c, amp:4,pan:-1
            sleep 2
          end
          use_synth :pretty_bell
          use_octave 0
          play c[0],amp:5, pan:1
          sleep 2
          use_octave +1
          #with_fx :echo, phase: 1 do
          play c[2],amp:5, pan:-1
          sleep 0.5
          play c[1],amp:4, pan: 1
          sleep 0.5
          play c[2],amp:3, pan: -1
          sleep 0.5
          play c[1],amp:3, pan: 1
          sleep 0.5
          #end
          
        end
      end
    end

    def drum ver = 1
      if ver == 0
        sleep 1
      end
      with_fx :hpf, cutoff: 55 do
        8.times do
          sample :drum_bass_hard,amp:3
          sleep 1
          3.times do
            sample :drum_cymbal_closed,amp:3
            sleep 1
          end
        end
      end
    end

    def pripev
      use_synth :fm #:prophet
      use_octave +2
      #use_synth :pluck #:prophet
      with_fx :reverb, mix: 0.5, room: 0.9 do
        play_pattern_timed [:g4,:a3,:Cs4,:g4,
                            :g4,:f4,:e4,:f4,:a4,:f4,
                            :f4,:g3,:b3,:f4,
                            :f4,:e4,:ds4,:e4,:g4,
                            :d3,:e3,:f3,:a3,:d4,:c4,:b3,:a3,
                            :a3,:gs3,
        :d3,:e3,:f3,:a3,:d4,:c4,:b3,:a3],
          [1,1,1,1,
           0.5,0.5,0.5,0.5,1,1,
           1,1,1,1,
           0.5,0.5,0.5,0.5,2,
           0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,
           2,2,
           0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5], pan: -1, amp: 3
        play_pattern_timed [:a3,:gs3,:a3,:e3],[1,1,1,1], pan: -1, amp: 3
      end
    end

    def pr_bass
      use_octave 0
      with_fx :reverb, mix: 0.5, room: 0.9 do
        use_synth :sine#square #saw
        play_pattern_timed [
          :a2,
          :d3,
          :g2,
          :c3,
          :r,
          :e2,
          :r,
        :d2,:a2],
        [
          4,
          4,
          4,
          4,
          4,
          4,
        2,2], pan:1, attack: 0, amp: 2
      end
    end
    temp =175
    use_bpm  temp

    #=begin
    #____1____
    cuplet_solo 0

    #___2___
    in_thread do cuplet_solo 1 end
    bass 1

    #___3___
    in_thread do cuplet_solo 1 end
    in_thread do bass 1 end
    drum

    #___4___
    in_thread do cuplet_solo 2 end
    in_thread do bass 2 end
    in_thread do accord_cuplet 2 end
    drum

    #__p1__
    in_thread do pripev end
    in_thread do pr_bass end
    drum


    #___5__
    in_thread do cuplet_solo 1 end
    in_thread do bass 1 end
    in_thread do accord_cuplet end
    drum

    #___7__
    in_thread do cuplet_solo 1 end
    in_thread do bass 1 end
    in_thread do bell_cuplet 1 end
    drum

    #___6__
    in_thread do cuplet_solo 1 end
    in_thread do bass 1 end
    in_thread do bell_cuplet 1 end
    in_thread do accord_cuplet 1 end
    drum

    #=end
    in_thread do cuplet_solo 3 end
    drum
2 Likes

This sounds great! However it uses Ruby’s def function instead of define which is normally used in Sonic Pi. I have taken the liberty of doing the easy conversion to use Sonic Pi’s built in define :function_name do |parameter| format

#code modified to use define instead of Ruby def

define :cuplet_solo do |ver = 1|
  with_fx :reverb, mix: 0.5, room: 0.9 do
    use_synth :fm #:prophet
    use_octave +2
    if ver == 0
      play :e3,pan: -1, amp: 3, release: 0.5
      sleep 1
    end
    play_pattern_timed [:c4, :b3, :a3, :ab3,
                        :a3,:e3,
                        :e4, :d4, :c4, :b3,
                        :c4,:a3,
                        :f4,:e4,:d4,:c4,
                        :b3,:c4,:d4,:f4,
    ],
      [ 1, 1, 1, 1,
        3,1,
        1, 1, 1,1,
        3,1,
        1.5,0.5,1.5,0.5,
        #0.17,0.17,0.51,0.25,
        0.5, 0.5, 2,1,
        ], pan: -1, amp: 3, release: 0.5
    if ver == 1 or ver == 0 or ver == 3
      play_pattern_timed [:e4,:d4,:c4,:d4,:b3,:e3],[ 1, 1, 1,1,3,1], pan: -1, amp: 3, release: 0.5
    else
      play_pattern_timed [:e4,:d4,:c4,:b3,:a3,:g4],[ 1, 1, 1,1,3,1], pan: -1, amp: 3, release: 0.5
    end
    
    if ver == 3
      play :a3
      sleep 5
    end
  end
  
  define :bass do |ver = 1|
    use_octave 0
    with_fx :reverb, mix: 0.5, room: 0.9 do
      use_synth :sine #prophet#square
      if ver == 0
        sleep 1
      end
      
      play_pattern_timed [:a2,
                          :a3,:e3,:a3,:e3,
                          :a2,
                          :a2,:a3,:d3,:a3,
                          :d2,
                          :f3,
      ],
        [4,
         1,1,1,1,
         4,
         1,1,1,1,
         4,
         4 ], pan:1, attack: 0, amp: 2, release: 0.1
      if ver == 1 or ver == 0
        play_pattern_timed [
          :e3,
        :e2,:a2,:e2,:r],
        [
          4,
        1,1,1,1], pan:1, attack: 0, amp: 2, release: 0.5
      else
        play_pattern_timed [
          :e3,:e2,
        :a2,:e2,:a2],
        [
          2,2,
        1,1,2], pan:1, attack: 0, amp: 2, release: 0.5
      end
    end
  end
end

define :accord_cuplet do |ver = 1|
  with_fx :tremolo do
    if ver == 0
      sleep 1
    end
    if ver != 2
      chords = [(chord :a3, :min), (chord :a3, :min),
                (chord :a3, :min),(chord :a3, :min),
                (chord :d3, :minor), (chord :f3, :maj),
                (chord :e3, :major), (chord :e3, :minor7)].ring
    else
      chords = [(chord :a3, :min), (chord :a3, :min),
                (chord :a3, :min),(chord :a3, :min),
                (chord :d3, :minor), (chord :f3, :maj),
                (chord :e3, :major), (chord :e3, :major)].ring
      
    end
    c = chords[0]
    
    8.times do
      c = chords.tick
      use_synth :chipbass
      play c[0],amp:3,pan:-1
      sleep 2
      play c, amp:4,pan:-1
      sleep 2
      
    end
  end
end

define :bell_cuplet do |ver = 2|
  use_synth :dull_bell
  use_octave +3
  with_fx :tremolo do
    if ver == 0
      sleep 1
    end
    if ver != 2
      chords = [(chord :a3, :min), (chord :a3, :min),
                (chord :a3, :min),(chord :a3, :min),
                (chord :d3, :minor), (chord :f3, :maj),
                (chord :e3, :major), (chord :e3, :minor7)].ring
    else
      chords = [(chord :a3, :min), (chord :a3, :min),
                (chord :a3, :min),(chord :a3, :min),
                (chord :d3, :minor), (chord :f3, :maj),
                (chord :e3, :major), (chord :e3, :major)].ring
      
    end
    c = chords[0]
    
    8.times do
      c = chords.tick
      in_thread do
        use_synth :chipbass
        play c[0],amp:5,pan:-1
        sleep 2
        play c, amp:4,pan:-1
        sleep 2
      end
      use_synth :pretty_bell
      use_octave 0
      play c[0],amp:5, pan:1
      sleep 2
      use_octave +1
      #with_fx :echo, phase: 1 do
      play c[2],amp:5, pan:-1
      sleep 0.5
      play c[1],amp:4, pan: 1
      sleep 0.5
      play c[2],amp:3, pan: -1
      sleep 0.5
      play c[1],amp:3, pan: 1
      sleep 0.5
      #end
      
    end
  end
end

define  :drum do |ver = 1|
  if ver == 0
    sleep 1
  end
  with_fx :hpf, cutoff: 55 do
    8.times do
      sample :drum_bass_hard,amp:3
      sleep 1
      3.times do
        sample :drum_cymbal_closed,amp:3
        sleep 1
      end
    end
  end
end

define  :pripev do
  use_synth :fm #:prophet
  use_octave +2
  #use_synth :pluck #:prophet
  with_fx :reverb, mix: 0.5, room: 0.9 do
    play_pattern_timed [:g4,:a3,:Cs4,:g4,
                        :g4,:f4,:e4,:f4,:a4,:f4,
                        :f4,:g3,:b3,:f4,
                        :f4,:e4,:ds4,:e4,:g4,
                        :d3,:e3,:f3,:a3,:d4,:c4,:b3,:a3,
                        :a3,:gs3,
    :d3,:e3,:f3,:a3,:d4,:c4,:b3,:a3],
      [1,1,1,1,
       0.5,0.5,0.5,0.5,1,1,
       1,1,1,1,
       0.5,0.5,0.5,0.5,2,
       0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,
       2,2,
       0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5], pan: -1, amp: 3
    play_pattern_timed [:a3,:gs3,:a3,:e3],[1,1,1,1], pan: -1, amp: 3
  end
end

define :pr_bass do
  use_octave 0
  with_fx :reverb, mix: 0.5, room: 0.9 do
    use_synth :sine#square #saw
    play_pattern_timed [
      :a2,
      :d3,
      :g2,
      :c3,
      :r,
      :e2,
      :r,
    :d2,:a2],
    [
      4,
      4,
      4,
      4,
      4,
      4,
    2,2], pan:1, attack: 0, amp: 2
  end
end
temp =175
use_bpm  temp

#=begin
#____1____
cuplet_solo 0

#___2___
in_thread do cuplet_solo 1 end
bass 1

#___3___
in_thread do cuplet_solo 1 end
in_thread do bass 1 end
drum

#___4___
in_thread do cuplet_solo 2 end
in_thread do bass 2 end
in_thread do accord_cuplet 2 end
drum

#__p1__
in_thread do pripev end
in_thread do pr_bass end
drum


#___5__
in_thread do cuplet_solo 1 end
in_thread do bass 1 end
in_thread do accord_cuplet end
drum

#___7__
in_thread do cuplet_solo 1 end
in_thread do bass 1 end
in_thread do bell_cuplet 1 end
drum

#___6__
in_thread do cuplet_solo 1 end
in_thread do bass 1 end
in_thread do bell_cuplet 1 end
in_thread do accord_cuplet 1 end
drum

#=end
in_thread do cuplet_solo 3 end
drum
2 Likes