# Jumping off point: Resynthesis by Max Cooper

**URL:** https://in-thread.sonic-pi.net/t/jumping-off-point-resynthesis-by-max-cooper/7863
**Category:** Creations & Ideas
**Created:** [June 2, 2023, 9:10pm UTC](https://in-thread.sonic-pi.net/t/jumping-off-point-resynthesis-by-max-cooper/7863 "2023-06-02T21:10:26Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Relaxnow](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/relaxnow/32/2172_2.png) [@Relaxnow](https://in-thread.sonic-pi.net/u/Relaxnow)
#### Post date: [June 2, 2023, 9:10pm UTC](https://in-thread.sonic-pi.net/t/jumping-off-point-resynthesis-by-max-cooper/7863/1 "2023-06-02T21:10:26Z")

</div>

Jumping off point: Resynthesis by Max Cooper

```ruby
# 230602 2030 Sonic Pi cover of Resynthesis by Max Cooper
# Saved 230602 2030
# Created by linktr.ee/relaxnow

# Original: "Max Cooper - Resynthesis (official video by Kevin McGloughlin)"
# https://youtu.be/Kpm1l0HfkV0
# Amazing visuals from https://www.kevinmcgloughlin.com/world-passing-by

# Found notes and rythme here:
# How to make the keys for the Max Cooper 'Resynthesis'
# youtube.com/watch?v=QZQK7JYCy5w

set_volume! 2

with_fx :reverb, room: 0.7 do
  
  
  
  live_loop :a1 do
    tick
    
    
    / rythme /
    p = bools(1,1,0,0, 1,0,1,1, 1,1,0,1, 0,1,1,0,
              1,0,0,1, 0,0,1,0, 0,1,0,1, 0,1,1,0)
    
    
    / chords progression /
    n1 = [:gs2,:c3, :ds3,:fs4]
    n2 = [:gs2,:b2, :e3, :gs3, :b3,:fs4, :fs5]
    n3 = [:gs2,:cs3, :fs3,:gs4]
    n4 = [:e2,:as3, :b3,:fs4]
    l = 64
    n = knit(n1,l, n2,l, n3,l, n4,l).look
    #n = n4
    
    
    / synth /
    use_synth :saw # (Full sound) :saw :dsaw :dtri :square (thin sound) :blade
    c = line(60,100,steps: 32).mirror.look # Synth cutoff
    amp = line(-0.5,0.5,steps: 32).mirror.look # volume LFO on amp synth top chords
    
    
    / change synth "release" time here for tension effect /
    release = 1 #1 original
    # release = knit(1,64, 2,16,3,16).look
    # release = 3
    case release
    when 1 # long and smooth (original)
      use_synth_defaults cutoff: c, release: [0.16,0.25].choose
    when 2 # sometimes short
      use_synth_defaults cutoff: c, release: [0.16,0.25].choose-[0,0.05,0.1].choose
    when 3 # very short for tension
      use_synth_defaults cutoff: c, release: [0.16,0.25].choose-[0.09,0.11].choose
    end
    
    
    
    / change "synthVoices" here to explorer different synths /
    synthVoices = knit(5,64, 3,64, 2,64, 6,64, 7,64).look
    #synthVoices = 2 #2 #6arp 7arp
    
    case synthVoices
    when 0
      # No synth chords playing (only bass + drums)
    when 1 # "Single" chords
      use_synth :saw
      play n, amp: 1+amp, pan: rdist(0.25) if p.look
    when 2 # "Double up" on chords
      use_synth :saw
      play n, amp: 1+amp, pan: rdist(0.25) if p.look
      play n, amp: 1+amp, pitch: 12, pan: rdist(0.75) if p.look # extra copy to fill out chords sound
    when 3
      use_synth :dsaw
      play n, amp: 1+amp, pan: rdist(0.25) if p.look
      play n, amp: 1+amp, pitch: 12, pan: rdist(0.75) if p.look
    when 4
      use_synth :dtri
      play n, amp: 1+amp, pan: rdist(0.25) if p.look
      play n, amp: 1+amp, pitch: 12, pan: rdist(0.75) if p.look
    when 5
      use_synth :saw
      play n, amp: 1+amp, pan: rdist(0.25) if p.look
      use_synth :square
      play n, amp: 1+amp, pitch: 12, pan: rdist(0.75) if p.look
      
      # + ARP
    when 6
      #when 1 # "Single" chords
      use_synth :saw
      play n.pick(3), amp: 1+amp, pan: rdist(0.25) if p.look
      
    when 7 # +arp NICE
      # when 2 # "Double up" on chords + arp with PICK(3)
      use_synth :saw
      play n.pick(3), amp: 1+amp, pan: rdist(0.25) if p.look
      use_synth :square
      play n.look, amp: 0.7+amp, pitch: 12, pan: rdist(0.75) if p.look
      
    end
    
    
    
    / bass /
    bass = n.take(1).look-12 #if spread(1,32).look
    #puts note_info(bass) if spread(1,32).look # Which bassnote are playing?
    play bass, amp: 1.25 if p.look
    
    
    
    / drums /
    d = 64*2
    drums = knit(0,d,1,d/2,2,d/4,3,d,4,d*2).look
    #drums = 1
    #drums = 0
    case drums
    when 0
    when 1
      sample :bd_haus, cutoff: 70, amp: 1.5 if bools(1,0,0,0).look
      sample :bd_haus, cutoff: 80, amp: 1.75 if (bools(0,0,0,0)*15+bools(0,0,1,0)).look and one_in(2)
    when 2
      sample :glitch_perc3, beat_stretch: [0.25,0.5, 1,2,4].choose, rate: [2,4].choose, slice: rrand_i(1,10), amp: 2, pan: rdist(0.5) if bools(1).look and one_in(2)
    when 3
      sample :bd_haus, cutoff: 70, amp: 1.5 if bools(1,0,0,0).look
      sample :bd_haus, cutoff: 80, amp: 1.75 if (bools(0,0,0,0)*15+bools(0,0,1,0)).look and one_in(2)
      sample :glitch_perc3, beat_stretch: [0.25,0.5, 1,2,4].choose, rate: [2,4].choose, slice: rrand_i(1,10), amp: 2, pan: rdist(0.5) if bools(1).look and one_in(2)
    when 4
      sample :bd_haus, cutoff: 70, amp: 1.5 if bools(1,0,0,0).look
      sample :bd_haus, cutoff: 80, amp: 1.75 if (bools(0,0,0,0)*15+bools(0,0,1,0)).look and one_in(2)
      sample :glitch_perc3, beat_stretch: [0.25,0.5, 1,2,4].choose, rate: [2,4].choose, slice: rrand_i(1,10), amp: 2, pan: rdist(0.5) if bools(1).look and one_in(2)
      sample :sn_generic, slice: 1, rate: 3, amp: 1.5, pan: rdist(0.75) if bools(0,0,0,0, 1,0,0,0, 0,0,0,0, 0,0,0,0,).look #and one_in(2)
      sample :sn_generic, rate: [1,1.2,1.5].choose, finish: [0.15,0.25].choose, amp: 1.5, pan: rdist(0.75) if bools(0,0,0,0, 0,0,0,0, 0,0,0,0, 1,0,0,0,).look
    end
    
    
    sleep 0.125
    
  end
end

```

---

<div class="post-metadata">

### Author: ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)
#### Post date: [June 4, 2023, 5:29pm UTC](https://in-thread.sonic-pi.net/t/jumping-off-point-resynthesis-by-max-cooper/7863/2 "2023-06-04T17:29:46Z")

</div>

This is amazing work! Thanks so much for sharing!

---

<div class="post-metadata">

### Author: ![Berke](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/berke/32/2439_2.png) [@Berke](https://in-thread.sonic-pi.net/u/Berke)
#### Post date: [June 4, 2023, 10:05pm UTC](https://in-thread.sonic-pi.net/t/jumping-off-point-resynthesis-by-max-cooper/7863/3 "2023-06-04T22:05:07Z")

</div>

Hello @Relaxnow

This is really good work but it doesnt work on my computer. Im always encountering with this error on my console log:

```ruby
Timing error: can't keep up...
Timing warning: running slightly behind...
!! Out of time, skipping: synth :saw, etc.

```

Is it about my CPU power or do I skip something when I run this code?

---

<div class="post-metadata">

### Author: ![Relaxnow](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/relaxnow/32/2172_2.png) [@Relaxnow](https://in-thread.sonic-pi.net/u/Relaxnow)
#### Post date: [June 5, 2023, 4:17pm UTC](https://in-thread.sonic-pi.net/t/jumping-off-point-resynthesis-by-max-cooper/7863/4 "2023-06-05T16:17:30Z")

</div>

Guess you could try to add

```ruby
use_debug false

```

in front of the code so Sonic pi dont log so much during running.

> “Enable or disable messages created on synth triggers. If this is set to false, the synths will be silent until debug is turned back on. Silencing debug messages can reduce output noise and also increase performance on slower platforms. See with\_debug for setting the debug value only for a specific do/end block.”

Else perhaps turn off reverb.

I’m using a big gamer computer.

---

<div class="post-metadata">

### Author: ![Berke](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/berke/32/2439_2.png) [@Berke](https://in-thread.sonic-pi.net/u/Berke)
#### Post date: [June 5, 2023, 6:59pm UTC](https://in-thread.sonic-pi.net/t/jumping-off-point-resynthesis-by-max-cooper/7863/5 "2023-06-05T18:59:31Z")

</div>

Thank you very much for your answer, I tried to add `use_debug false` but it doesnt work for me. So I changed sleep time to 0.25 and it worked, just like slow version 😃

> [@Relaxnow](#):
>
> I’m using a big gamer computer.

I have gaming laptop but I think cpu power isnt enough for this kind of code and sometimes it is really annoying that I am seeing some code here but I cant run it 😅

---

<div class="post-metadata">

### Author: ![jonny](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jonny](https://in-thread.sonic-pi.net/u/jonny)
#### Post date: [May 3, 2024, 11:39am UTC](https://in-thread.sonic-pi.net/t/jumping-off-point-resynthesis-by-max-cooper/7863/6 "2024-05-03T11:39:09Z")

</div>

# THIS is _soooooo_ 🆒 ⭐⭐⭐⭐⭐

Thanks for sharing! Grrrrrrrr8 work🤘🏻

❓Can this be ran by anyone on windows?!

I also have to drop the bpm, even without the reverb fx, even though my rudimentary tick test show SP can tick pretty quick!

If yes, do you need anything in particular, like

- usb audio device
- any required config like ASIO/JACK?

Am wondering what about stuff like thresholds and limitations, and causes, and benchmarking, if SP\_linux (or mac or rasp) is better, or if it’s more CPU that’s needed (although I’ve read reports from other windows users with similar timing issues, with ample resources

I want this! **&&** More like this!

💡 test on other machines, other OS, and with other audio card.

Hi @samaaron, I guess this works on your old rasppi?  
I wondered if it’s worth trying to spin up an XP machine, or if SP’s won’t run on XP, or no reason why it should perform any better on that beloved relic.

Also wondered if we can get performance + benchmarking stats in debug mode, or if any recommendedations on test\_scripts to try - I just use a crude loop with lots of ticks, incrementing bpm to see how long before inevitable timing errors ensue, to try and establish if changing stuff like block\_size and sample\_rate in audio\_settings made a diff, like the proverbial optometrist.

Part of me assumes SP can and does run like a dream even on windows, as that’s likely to be the most common OS in academia, or am I wrong there too?!

# 🤘🏻

---

<div class="post-metadata">

### Author: ![jonny](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jonny](https://in-thread.sonic-pi.net/u/jonny)
#### Post date: [May 6, 2024, 12:04pm UTC](https://in-thread.sonic-pi.net/t/jumping-off-point-resynthesis-by-max-cooper/7863/7 "2024-05-06T12:04:46Z")

</div>

I’ve finally got this to work, even with the fx, with sched\_ahead\_time 8…  
I’m not sure exactly how long the loop should run before the most challenging bits kick in (faster rates etc).

I’ve been looking at sc and cpu stuff, and in gaming land I found lots of interesting stuff.

With instructions for [process lasso](https://www.reddit.com/r/flightsim/comments/ifle4x/huge_performance_booststutter_reduction_by/) I tried the script without fx and with increasing bpm, after elevating process priority (scsynth ruby sonicpi). I was going to try the cpu affinity bit, but first tested **disabling hyperthreading** on those. After success I eventually tried with reverb **and** with 60bpm, and it worked. With lower **sched\_ahead** like 4 I did get timing errors reported.

Now that thread mentions to processes in process lasso need re-configuring each time, and I’ve got this edge case bug that causes sc to stop making sounds after I stop in sp, so I restart a lot.

I retried and again saw no issues, so I’m retesting now to see if the issue is **msedge** (or anything else process lasso reports as consuming lots of system resources).

![image](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/b/bb90405989293f3c027201ab3184860b1c0509aa.png)

Even though I’d closed edge I still had processes in memory, but once removed sonicpi ran this “ok” (no timing errors reported in sp)

One (other!) thing that’s not clear is whether setting **disable hyperthreading** on sp and sc (and maybe ruby) persisted, or even had any effect…

but if nothing else running process lasso may help identify anything that may affect system responsiveness.

> **[Bitsum. Real-time CPU Optimization and Automation](https://bitsum.com/)**
>
> Real-Time CPU Optimization and Automation. Keep your PC responsive during high CPU loads and automate process settings with rules. Apps run YOUR WAY!
