Buzzing Noise When Using SDL_RenderPresent on Linux

I do not know if this is a bug in SDL or just my laptop playing tricks, hence I’m posting it here.

I’m using SDL 2.30.3-1 on Linux, and I’ve encountered a strange issue:

  • Problem Description:

    • Calling SDL_RenderPresent causes my laptop to make a buzzing noise.
    • The noise’s pitch increases with more frequent calls to SDL_RenderPresent.
    • No audio is being played, nor is the audio module loaded.
  • What I’ve Tried:

    • Changing or muting system sound did not affect the buzzing.
    • Killing the sound server had no effect.
    • Other SDL programs, (that is LÖVE2D) also produce the buzzing sound.
    • Non-SDL programs do NOT produce the buzzing sound.
    • The buzzing stops if I switch to a virtual desktop where the SDL window is not present.
    • No buzzing occurs when calling SDL_UpdateWindowSurface.
    • No buzzing occurs if I switch to Windows.
  • System Details:

    • SDL 2.30.3-1
    • Linux 6.8.9-arch1-2 x86_64
    • IdeaPad 5 Pro

Do you have any ideas about what might be causing this buzzing noise?

It would help us to see the code.
[edit out of 2 non-helpful questions that were already answered in OP]

When you say it’s a buzzing noise:

  1. Does the noise still happen on headphones or with bluetooth speakers? → (if the buzz stops then this points toward the sound card being an issue)
  2. Is the noise from the speakers strong and loud (full volume) or is it a lower volume than that?

Most likely due to the use of the video card. There’s a lot of articles in web about this, you should test your laptop with some GPU testing software to confirm this.

It’s using software rendering, probably confirms the theory about the video card :grin:

Like you said, you are not using audio and the problem is showing up in other SDL apps. Looks like a hardware issue for me, not critical though.

Non-SDL programs do produce the buzzing sound, but it’s barely noticeable at 60 FPS. I tested it with an empty GLFW program using OpenGL with high framerate, and the buzzing was very obvious.

Yes, but the buzzing is not effected. Even if I disable the audio device, the buzzing persists in the left build-in laptop speaker.

It is silent, and barely noticeable with the fans spinning.

It most certainly is, due to the buzzing not just appearing in SDL, and not present at all on Windows.


Thanks for the help!

Windows may use integrated videocard for your app, or just got a better videodriver. Good starting point for research is “coil whine” search query. I’ve found a reddit thread for your laptop (may not be the same model tho) https://www.reddit.com/r/AMDLaptops/comments/rsnrv3/lenovo_ideapad_5_pro_14_coil_whineelectrical/

My laptop does not have a dedicated graphics card. I suspect a faulty driver writing to audio memory, as suggested here: [SOLVED] - Graphics card buzzing noise when playing games | Tom's Hardware Forum.

I read about “coil whine” on wikipedia, and it suggests electromagnetic forces effecting other parts such as fans or speaker magnets.

If I recall correctly last time I have disassembled my laptop, those parts did not seem to be near enough APU to be effected.


Thanks for the help! I don’t see it as an issue thou, due to the buzzing being so quiet. It was noticeable because I forgot to limit the framerate of my game :sweat_smile:.

I think that it’s funny that the pitch can be controlled by setting different framerates.

1 Like