Audio Crackling on Windows 10

Hey, I’m brand new to Sonic Pi, supercollider, and audio production in general, I just come from a programming background. Anyway, I’m having crackling in my audio even if I’m playing just one note. I don’t have a potato pc so this isn’t a performance issue. I’ve done some minor research and was not able to come to a fix, but from what I’m aware, this is probably a driver issue of some sort? The audio crackles on all of my output devices. I have a Realtek audio system by the way. Also, exporting seems to work fine. I appreciate any help anyone can provide, and I’m sorry that I’m very new to this.

2 Likes

Welcome to in_thread @tomomnom!
It’s quite alright. The goal of Sonic Pi is to try to make the experience as simple and beginner-friendly as possible, so if you’re having issues, I hope we can help you solve them! :slight_smile:

Audio driver issues are not exactly my strongest area of expertise, but to start off with, perhaps it might be helpful to share details of the audio devices that are available on your system? what do the contents of C:\Users\[you]\.sonic-pi\log\scsynth.log reveal?

Also, note that it may be due to Windows performance settings. Energy saving settings can interfere with Sonic Pi, as described in this topic for example:

It might be worth checking that if you haven’t already :slight_smile:

Can I hook into this thread? I have also this crackling problem on Win10 (Gaming laptop) and also on a Realtek audio system.

Because of this problem I started testing in TidalCycles and I have not run into any limitation using that program even when running it on 400 cycles. Because first I started to doubt my computer but that’s not the case.

Here you can listen to the problem: Video
I have uploaded my log file as well: Scsynth.log

Welcome to our forums :slightly_smiling_face:

It’s super interesting to hear that you’re not having the same sort of issues with TidalCycles - especially as it now uses SuperCollider for the audio engine which is the same as Sonic Pi. However, I should note that running large numbers of cycles may or may not produce a similar workload to your Sonic Pi example as the the real contributors to audio workload are number of simultaneous synths in the SuperCollider audio-graph and also considering their cost varies depending on what kind of audio processing they’re doing (for example, playing many short samples in quick succession is actually way cheaper than running multiple reverbs - lookup table vs fancy maths).

I’d be interested to know a few things:

  • Do you hear the audio glitches at all times (e.g. with the any of the examples in the help system) or is it only with certain bits of code?
  • Could you share the code you’re having issues with?
  • Do you know what SuperCollider flags TidalCycles is using on your system? I’d want to make sure these are the same as the ones Sonic Pi uses. Note, you can configure Sonic Pi’s use of SuperCollider in the config file ~/.sonic-pi/config/audio-settings.toml which Sonic Pi reads and converts to the appropriate SuperCollider args.
  • Could you share a copy of Sonic Pi’s SuperCollider log file found in ~/.sonic-pi/log/scsynth.log

Hopefully we’ll be able to quickly get to the bottom of this.

1 Like

Hi Sam thank you for the quick reply.

It started with certain bits of code, especially when applying effects to samples. I’m not sure where I can find my SuperCollider flags so I included my SC startup file and all the logfiles van Sonic-Pi and the code for the music ( Jam for Sam)

Hope you can see the folder with all the files, please let me know if you need anything extra.

Kind regards

Thanks for this.

Could you try commenting out the with_fx :reverb do and corresponding ends and see if that improves the glitchiness?

1 Like

I screen-recorded it… Flawless. Weird right?

Actually, it’s not weird at all. Take a look at Section 6.2 of the tutorial which explains what’s going on Sonic Pi - Tutorial (sonic-pi.net).

If this doesn’t make sense, please do ask more questions here and I’d be very happy to answer them :slight_smile:

1 Like

Wow, I bow my head in shame :sweat_smile:

That’s as logical as it can get. Thank you for you time and support.

Keep rocking!!

For people looking for the answer, this is what I did wrong:
original code:

live_loop :snap, sync: :driver2 do
  snappy = pattern "-----------*--*-"
  with_fx :reverb, room: 0.7 , amp: 1.5 do
    sample :perc_snap , rate: 1, cutoff: 110, amp: 0.15 if snappy
  end
  sleep 0.25
end

new code:

with_fx :reverb, room: 0.7 , amp: 1.5 do
  live_loop :snap, sync: :driver2 do
    snappy = pattern "-----------*--*-"
      sample :perc_snap , rate: 1, cutoff: 110, amp: 0.15 if snappy
    sleep 0.25
  end
end

In the original code I fire up FX (reverb) with each tick, even when the sample is not played, wasting my resources… So placing the FX on the live_loop itself, triggers it only one time.

1 Like