Weird distorted noises in playback, not present in recordings


#1

Hi,

I’m gettin some very weird distorted noises on sonic pi during playback on my Lenovo x280 laptop. They aren’t present in the recording of the performance, nor do I get them when running with my 2012 Macbook pro. First I thought they might be due to performance issues, as they do happen more seldom when I remove some live-loops, but unfortunately I cannot find my cpu-usage as my work computer is quite controlled by central management. Also it doesn’t seem to be dependent on any of the loops specifically. However I would think that also the recording would be affected if this was a performance issue.

Here’s the code and a youtube link to a video where the sounds can be heard. Any help would be appreciated.

Youtube: Weird noises from sonic pi

use_bpm 70
live_loop :heartbeat do
  with_fx :reverb, room: 0.8, mix: 0.5 do
    with_fx :lpf, cutoff: 70 do #leikataan korkeat taajuudet
      with_fx :reverb do
        sample :drum_bass_soft, amp: 1.5, pan: -0.65 unless one_in(10) #välillä voi uupua isku
        sleep 0.35
        sample :drum_bass_soft, amp: 1.0, pan: 0.65 unless one_in(6) #useammin voi uupua 2. isku
        sleep 1.65
      end
    end
  end
end

live_loop :synth_chord do
  with_fx :reverb, room: 1, mix: 0.7 do
    if one_in(4)
      sointu = synth :fm, note: [:g5, :c6, :g6], release: 2, sustain: 8, cutoff: 50, cutoff_slide: 7
    else
      sointu = synth :fm, note: [:C4, :g4, :b4, :e5], release: 2, sustain: 8, cutoff: 40, cutoff_slide: 7
    end
    sleep 1
    control sointu, cutoff: 75
    sleep 7
  end
end

live_loop :industrial_noise do
  with_fx :reverb, room: 0.6, mix: 0.4 do
    sample :loop_industrial, rate: 0.3, beat_stretch: 4, amp: 0.4
    sleep 4
  end
end

live_loop :moon_rise do
  with_fx :reverb, room: 1, mix: 0, mix_slide: 8 do |fx|
    control fx, mix: 1
    sn = synth :prophet , sustain: 8, note: :c1, cutoff: 20, cutoff_slide: 8, amp: 0.1
    control sn, cutoff: 70, amp: 0.1
    sleep 2
  end
end

live_loop :bell do
  with_fx :echo, phase: 1.5, mix: 0.3 do 
    with_fx :bitcrusher, bits: 12 do 
      sample [:perc_bell, :perc_bell2].choose,
        pitch: [-7,-5,-4,-2,0,2,4,5,7].choose, 
        rate: [0.3, 0.2, 0.4, 0.5, 0.6, -0.2,0.7,-0.7,-0.3,-0.4].choose, 
        amp: 0.7, lpf: 80,
        pan: [-0.3, 0.3].choose
      sleep [3,5,7, 4,11].choose
    end
  end
end

#2

Hi there,

are you running on linux or Windows?

If it’s Windows, it’s quite likely you have all the energy saving preferences turned on.

These preferences essentially turns parts of the computer off as much as possible to save on energy consumption. Unfortunately whilst turning the CPU on and off can often save energy in a way that typical users won’t notice (whether a particular computation takes <1ms or 20-30ms is not typically noticeable) it can have a dramatic impact on live audio manipulation. When the CPU is sleeping and conserving energy, it’s not able to manipulate and generate audio in real time. Of course, computers aren’t really ‘real time’ in that they firstly make operations discrete and then batch a bunch of similar operations together for computational efficiency (to make better usage of caches etc.). However, when the CPU sleeps for longer than the acceptable time duration for a typical batch of operations, things can go awry.

Could you try and turn off the energy saving preferences (if you have permission) and see if that helps things?


#3

Hiya,

Sam constantly reminds us that putting with_fx’s inside live_loops
triggers multiple copies of the fx which can eat up CPU…

As an example, your 1st loop might be more efficient as:

use_bpm 70

with_fx :reverb, room: 0.8, mix: 0.5 do
  with_fx :lpf, cutoff: 70 do #leikataan korkeat taajuudet
    with_fx :reverb do
      live_loop :heartbeat do
        
        sample :drum_bass_soft, amp: 1.5, pan: -0.65 unless one_in(10) #välillä voi uupua isku
        sleep 0.35
        sample :drum_bass_soft, amp: 1.0, pan: 0.65 unless one_in(6) #useammin voi uupua 2. isku
        sleep 1.65
      end
    end
  end
end

Try it and see if it makes a difference?

Eli…


#4

Hi all!

Thanks to you both, again Sam was right, coding with out my power supply on windows - > energy saving policies in effect -> crackling noises.

Cheers,
Jouni