First time building a PC and I'm having a couple of issues

This is my first thread not sure what I'm doing but I'm hoping someone can help me with my issue. Ok so, I recently just finished building my first gaming PC and everything was running smoothly until I started hearing a buzzing sound in the audio when I play games, and the games are Valorant, Apex Legends, and phasmophobia. Then another issue is when I play games like valorant and phasmophia the screen turns black for a few seconds ( can still hear the audio and the buzzing) then the screen comes back and it does all the time. This only happens when I play games everything else runs perfectly fine, that I know of at least.
My specs are:
CPU: RYZEN 5 2600 6-core 3.4 GHz(3.9GHz Max Boost)
GPU: MSI Radeon Rx 580 Directx 12 RX 580 ARMOR
Motherboard: ASRock B450M steel Legend Micro ATX AM4
SSD: Western Digital Blue 500GB m.2-ss80
RAM: G.Skill Ripjaws v 16 GB(2x8GB) DDR4-3600 CL16
Case: Darkflash DLM 21 MicroATX mid-tower case
Power supply: Thermaltake smart 500W White

I really hope someone can help me I would really appreciate it :)