# CPU issues on Mac

**URL:** <https://in-thread.sonic-pi.net/t/cpu-issues-on-mac/314>\
**Category:** General\
**Created:** [October 24, 2017, 1:40pm UTC](https://in-thread.sonic-pi.net/t/cpu-issues-on-mac/314 "2017-10-24T13:40:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sten](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/sten/32/223_2.png) [@Sten](https://in-thread.sonic-pi.net/u/Sten)\
**Post date:** [October 24, 2017, 1:40pm UTC](https://in-thread.sonic-pi.net/t/cpu-issues-on-mac/314/1 "2017-10-24T13:40:46Z")

</div>

Hello All!  
I’ve a question about the CPU consumed. I’ve run a popular code found on internet, but my MacBook Pro Retina Mid 2014 with 128gb SSD, i5, 8gb ram and OSX Sierra 10.12.6 have serious audio glitches. The code is about a dub/techno song. Is it a problem of my slow computer or maybe the code?

Thanks

---

<div class="post-metadata">

**Author:** ![Martin](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/martin/32/157_2.png) [@Martin](https://in-thread.sonic-pi.net/u/Martin)\
**Post date:** [October 24, 2017, 3:17pm UTC](https://in-thread.sonic-pi.net/t/cpu-issues-on-mac/314/2 "2017-10-24T15:17:59Z")

</div>

Hi Sten,

could you provide the code/a link to it so that others can try it out themselves?

I have a Lenovo with i7, 16 GB Ram but with enough creativity and live\_loops it is not to hard to overload it and produce xruns. (I always try to embrace this limitation as a hint that I have to do it some other way. With more or less success.)

Martin

---

<div class="post-metadata">

**Author:** ![Sten](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/sten/32/223_2.png) [@Sten](https://in-thread.sonic-pi.net/u/Sten)\
**Post date:** [October 24, 2017, 5:26pm UTC](https://in-thread.sonic-pi.net/t/cpu-issues-on-mac/314/3 "2017-10-24T17:26:53Z")

</div>

of course! the code is in the following link:

> <https://gist.github.com/jindrichmynarz/f233f75c719abe6a6c81>

I can listen it but i can’t do anything else without generate audio glitches…even just scroll the code…

Thank you!

---

<div class="post-metadata">

**Author:** ![jaqviolet](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@jaqviolet](https://in-thread.sonic-pi.net/u/jaqviolet)\
**Post date:** [November 19, 2017, 6:14am UTC](https://in-thread.sonic-pi.net/t/cpu-issues-on-mac/314/4 "2017-11-19T06:14:41Z")

</div>

I’m having a similar issue with a macbook retina mid 2014. mine is an i-7 2.2ghz with 16g of ram. It seems to run fine on it’s own, but as soon as I try to open any other software (streaming software, I start getting the audio glitches. I had a lot of weird problems with the Atom text editor as well, and that was specific to this range of macbooks.

Starting to hate my macbook lol

---

<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:** [November 19, 2017, 11:36pm UTC](https://in-thread.sonic-pi.net/t/cpu-issues-on-mac/314/5 "2017-11-19T23:36:11Z")

</div>

Please check out section 6.2 of the built-in tutorial.

It’s likely that you’re triggering a lot of current FX that when added together consume all your CPU. The thing to be aware of is that every time with\_fx is called, a new FX synth is triggered that has its own life span.

---

<div class="post-metadata">

**Author:** ![tommi](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/tommi/32/321_2.png) [@tommi](https://in-thread.sonic-pi.net/u/tommi)\
**Post date:** [December 14, 2017, 1:35pm UTC](https://in-thread.sonic-pi.net/t/cpu-issues-on-mac/314/6 "2017-12-14T13:35:19Z")

</div>

I’m running a MacBook Pro Mid 2017, 13", 16 GB RAM, 3,1GHz i5 and Mac OS Sierra 10.12.6. I can easily run the above mentioned dub techno code without any problems.

I noticed one other thing though: When Sonic Pi GUI is drawn on the retina display of my laptop it is significantly slower (some noticeable latency when typing / sluggish scrolling) than using an external monitor. If I move the Sonic Pi GUI to my external monitor (just with basic 1080p resolution) it gets much smoother again. This is with audio running in the background.

I didn’t have this problem with my old non-retina MacBook Pro MID 2012 (also with Mac OS Sierra). So it seems the retina display and Intel graphics chips can slow things down a lot…

---

<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:** [December 14, 2017, 1:48pm UTC](https://in-thread.sonic-pi.net/t/cpu-issues-on-mac/314/7 "2017-12-14T13:48:32Z")

</div>

Yep, I’ve noticed the extra latency with the latest MacBook Pro - I’m not entirely sure what’s causing it yet, but it’s definitely frustrating.

---

<div class="post-metadata">

**Author:** ![robin.newman](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@robin.newman](https://in-thread.sonic-pi.net/u/robin.newman)\
**Post date:** [December 15, 2017, 7:24pm UTC](https://in-thread.sonic-pi.net/t/cpu-issues-on-mac/314/8 "2017-12-15T19:24:58Z")

</div>

Runs fine on my MBP i7 2.8GHz with 16Gb RAM. I do notice that the scope display freezes momentarily when I scroll the SP buffer screen, but plays fine. I think you are fairly near the limit with lots of nested fx, especially in live\_loop :synth  
I tried the external monitor, and didn’t detect much difference, but I think is was perhaps slightly more responsive.

I think this would have difficulties running on a Pi!

---

<div class="post-metadata">

**Author:** ![TonnyStampert](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/tonnystampert/32/269_2.png) [@TonnyStampert](https://in-thread.sonic-pi.net/u/TonnyStampert)\
**Post date:** [December 16, 2017, 4:22pm UTC](https://in-thread.sonic-pi.net/t/cpu-issues-on-mac/314/9 "2017-12-16T16:22:07Z")

</div>

,

#RattleBladeBase

use\_bpm 120

live\_loop :SinkIt do  
sleep dice  
end

live\_loop :BaseKick do  
kick\_cutoffs = range(80, 120, 4).mirror  
zempel = [:bd\_tek, :bd\_fat, :drum\_cymbal\_pedal].choose  
with\_fx [:ixi\_techno, :reverb].choose, reps: 4 do  
sample zempel,  
amp: rrand(0.4,0.8),  
release: 0.125,  
cutoff: kick\_cutoffs.look  
#sleep [0.25, 0.5].choose  
sleep 1  
end  
end

sleep dice

live\_loop :SleepKick do  
sync :SinkIt  
kick\_cutoffs = range(60, 110, 8).mirror  
zempel = [:drum\_bass\_hard, :drum\_bass\_soft].choose  
zompel = [:drum\_cymbal\_open, :drum\_cymbal\_pedal].choose  
with\_fx [:ixi\_techno, :reverb].choose, reps: 4 do  
sample [zempel, zompel].choose,  
amp: rrand(0.6,1.1),  
release: dice,  
cutoff: kick\_cutoffs.look  
#sleep [0.25, 0.125, 0.5, 0.125, 0.125, 0.5, 0.25,2].choose  
sample [zempel, zompel].choose,  
amp: rrand(0.8,1.4),  
release: [0.25, 0.125, 0.5, 0.125, 0.125, 0.5, 0.25,2].choose,  
cutoff: kick\_cutoffs.look  
sleep dice  
end  
end

sleep dice

live\_loop :HollowWaveAmbience do  
sync :BaseKick  
if (spread 3, 8).tick then  
# (spread 3, 8) produces this pattern: \* \_ \_ \* \_ \_ \* \_  
with\_fx [:ixi\_techno, :reverb].choose, reps: 4, cutoff: 125, res: 0.8 do  
with\_synth [:hollow, :dark\_ambience].choose do  
play :d3, amp: rrand(0.4,0.8),  
attack: 0.15, decay: 0.28, release: dice  
end  
end  
end  
sleep dice  
end

dchord = chord(:d2, :minor, num\_octaves: 3)  
synth\_cutoffs = range(70, 110, 2.5).mirror  
synth\_rhythm = (ring 1.5, 2.5, 1)  
synth\_transpositions = (stretch 0, 36) + (stretch -12, 6) + (stretch 12, 6)  
synth\_phases = (stretch 0.75, 15) + [0.25]  
synth\_pans = (ring -0.5, 0.5)  
live\_loop :Sintje do  
sync :SinkIt  
ch = invert\_chord(dchord, rand\_i(3))  
sleep synth\_rhythm.tick  
with\_fx :echo, amp: rrand(0.2,0.8), mix: 0.3,  
decay: 8, phase: synth\_phases.look do  
with\_fx :pan, pan: synth\_pans.look do  
with\_fx :reverb, room: 0.7, amp: rrand(0.2,1.2) do  
with\_synth\_defaults attack: 0.05, release: 0.3 do  
with\_transpose synth\_transpositions.look do  
with\_synth :fm do  
play\_chord ch  
end  
cutoff = synth\_cutoffs.look  
with\_fx :ixi\_techno, cutoff\_min: cutoff,  
cutoff\_max: cutoff - 30, phase: 1, res: 0.3 do  
with\_synth :blade do  
play\_chord ch, attack: 0.1  
end  
end  
end  
end  
end  
end  
end  
end

sleep dice

live\_loop :NoiseHats do  
sync :BaseKick

# Create hi-hats by slicing continuous noise

with\_fx :slicer, mix: 1, phase: 0.25, pulse\_width: 0.1, reps: 8 do  
with\_fx :hpf, cutoff: 130, reps: 8 do  
with\_synth :gnoise do  
play 28, decay: 1, amp: 1  
end  
end  
end  
sleep dice+dice  
end

sleep 4

live\_loop :OpenHatCut do  
sync :BaseKick  
ohc = range(108, 128, 2).mirror  
with\_fx :echo, amp: 1,  
mix: 0.4, decay: 4, phase: 0.75 do  
with\_fx :hpf, cutoff: ohc.tick, reps: 4 do  
with\_fx :reverb, mix: 0.4, room: 0.8, reps: 4 do  
sleep 0.5  
sample :drum\_heavy\_kick, start: 0.12, finish: 0.38, amp: rrand(1.2,2.2)  
sleep 0.5  
end  
end  
end  
sleep dice  
end

sleep dice

beep\_notes = (ring :d2, :d3, :f2, :e2, :d3, :g2)  
live\_loop :BiepsA do  
sync :SinkIt  
sleep 0.5  
with\_fx :reverb do  
with\_synth :blade do  
play beep\_notes.tick, amp: rrand(0.01,0.6),  
decay: 0.2, release: rrand(0.01,0.35)  
end  
end  
sleep 0.5  
end

beep\_notes = (ring :d3, :d2, :f3, :e3, :d2, :g3)  
live\_loop :BiepsB do  
sync :SinkIt  
sleep dice  
with\_fx :reverb do  
with\_synth :fm do  
play beep\_notes.tick, amp: rrand(0.01,0.6),  
decay: rrand(0.2,0.4), release: rrand(0.01,0.45)  
end  
end  
sleep dice  
end

beep\_notes = (ring :d2, :d3, :f2, :e2, :d3, :g2)  
live\_loop :BiepsC do  
sync :SinkIt  
sleep dice  
with\_fx :distortion do  
with\_synth :beep do  
play beep\_notes.tick, amp: rrand(0.1,0.8),  
decay: rrand(0.1,0.3), release: rrand(0.01,0.35)  
end  
end  
sleep dice  
end

,
