'SweepingSynth' - My best creation (so far)

Also posted to YouTube here: SweepingSynth - Sonic pi - YouTube
I thought I would post the code this time because it is more complex and can be changed to get other results easier, so have fun messing around with this!

with_fx :ixi_techno, cutoff_min: 125, cutoff_max: 70, mix: 0.75, phase: 8, res: 0.5 do
  with_fx :ixi_techno, cutoff_min: 125, cutoff_max: 70, mix: 0.75, phase: 16, res: 0.5 do
    live_loop :calmchords do
      use_synth :sine
      play chord(:F3, :major7), attack: 0.25, sustain: 1, release: 0.75
      sleep 2
      play chord(:C3, :major7), attack: 0.25, sustain: 1, release: 0.75
      sleep 2
      play chord(:G3, :minor7), attack: 0.25, sustain: 1, release: 0.75
      sleep 2
      play chord(:A3, :major), attack: 0.25, sustain: 1, release: 0.75
      sleep 2
    end
    with_fx :level, amp: 0.125 do
      live_loop :acompanynotes do
        use_synth :hoover
        8.times do
          play 89, amp: 0.05
          sleep 0.25
        end
        8.times do
          play 84, amp: 0.05
          sleep 0.25
        end
        8.times do
          play 91, amp: 0.05
          sleep 0.25
        end
        4.times do
          play 93, amp: 0.05
          sleep 0.5
        end
      end
    end
    #sleep 8
    with_fx :panslicer, wave: 3, phase: 2 do
      with_fx :level, amp: 3 do
        live_loop :peacemelody do
          a = 1
          b = 0.1
          use_synth :piano
          play_pattern_timed [88, 84, 81, 77], [0.25], sustain: a, attack: b
          play_pattern_timed [88, 84, 81, 77], [0.25], sustain: a, attack: b
          
          play_pattern_timed [84, 79, 76, 72], [0.25], sustain: a, attack: b
          play_pattern_timed [84, 79, 76, 72], [0.25], sustain: a, attack: b
          
          play_pattern_timed [90, 86, 83, 78], [0.25], sustain: a, attack: b
          play_pattern_timed [90, 86, 83, 78], [0.25], sustain: a, attack: b
          
          ##play_pattern_timed [88, 84, 81, 77], [0.25], sustain: 2
          ##play_pattern_timed [88, 84, 81, 77], [0.25], sustain: 2
          play chord(:A3, :major), sustain: 1, release: 1
          sleep 0.5
          play_pattern_timed [81, 85, 88], [0.5], sustain: 0, attack: 0.1
          sleep 0
          #sync "/live_loop/calmchords"
        end
      end
    end
    #sleep 8
    #############################################################
    with_fx :panslicer, wave: 2, phase: 2 do
      with_fx :level, amp: 2 do
        live_loop :pluckmelody do
          a = 2
          b = 0.1
          use_synth :pluck
          play_pattern_timed [88, 84, 81, 77], [0.25], sustain: a, attack: b
          play_pattern_timed [88, 84, 81, 77], [0.25], sustain: a, attack: b
          
          play_pattern_timed [84, 79, 76, 72], [0.25], sustain: a, attack: b
          play_pattern_timed [84, 79, 76, 72], [0.25], sustain: a, attack: b
          
          play_pattern_timed [90, 86, 83, 78], [0.25], sustain: a, attack: b
          play_pattern_timed [90, 86, 83, 78], [0.25], sustain: a, attack: b
          
          ##play_pattern_timed [88, 84, 81, 77], [0.25], sustain: 2
          ##play_pattern_timed [88, 84, 81, 77], [0.25], sustain: 2
          play chord(:A3, :major), sustain: 1, release: 1
          sleep 0.5
          play_pattern_timed [81, 85, 88], [0.5], sustain: 0, attack: 0.1
          sleep 0
          #sync "/live_loop/calmchords"
        end
      end
    end
  end
  
  live_loop :sweepbeat do
    sample :drum_tom_hi_soft, pan: 1
    sleep 0.5
    sample :drum_cymbal_closed, pan: -1
    sleep 0.5
  end
  live_loop :sweepbeat2 do
    48.times do
      sample :drum_snare_soft, amp: 0.25, pan: rrand_i(1, -1)
      sleep 0.125
    end
    sample :drum_snare_soft
    sleep 1
    sample :drum_cymbal_open, amp: 0.25
    sleep 1
  end
end


3 Likes

I did get this error -
Runtime Error: [buffer 0, line 111] - NameError
Thread death!
uninitialized constant SonicPi::RuntimeMethods::Reply
workspace_zero:111:in block (2 levels) in __spider_eval' C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:830:in eval’
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:830:in block (2 levels) in __spider_eval' C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:1093:in block (2 levels) in __in_thread’

Hmm. I have copied it and tried it with no errors. Also the end of the error message mentions the block “in_thread”, which is not in my code as it is all live loops. I don’t see why it would be giving this message. Maybe you copied it incorrectly? Sorry I can’t be more helpful, I’m not that experianced with in_thread or Sonic Pi.

Hi @dranz - I suspect that Callum’s code is fine - it works for me also.
The line in your error message:

uninitialized constant SonicPi::RuntimeMethods::Reply

…Seems to me to indicate that it’s possible the code that you attempted to run was different to the above in some way. Have you tried re-copying the above example into a fresh buffer?

@CallumPi - the __in_thread reference is pointing to an internal Sonic Pi command in the server code, rather than the user function in_thread - that’s why it might be a bit confusing about where it came from :slight_smile:

That makes more sense, thanks Ethan. As I said, I’m not that experienced :slight_smile:

1 Like

Thanks @ethancrawford. I’ll try again. BTW, after a bit of an absence from sonic.pi, I noticed in my latest installation (still 3.3.1), and having reinstalled Win10 on my i5 laptop that the server boot errors I was always getting have ceased. Any ideas? Seems to be working pretty consistently now.

If the Sonic Pi version is the same as previously, then all I can think of is that reinstalling Windows 10 has possibly reset something (like microphone permissions, or audio driver settings) to be more in line with what scsynth (Sonic Pi’s sound engine) is able to work with :man_shrugging:

1 Like