I recently had a similar problem and wanted to comment on what the problem was and the solution in my case. Maybe it might help someone.
First off, I got a new PC and rearranged my recording setup. I have a Toneport KB37. When rearranging everything where I decided to put my Toneport KB37 the USB Cable that come with the KB37 was not long enough. So I had a usb midi cable that's about 3 times the length of the cable that was made for use with the KB37.
So I got everything setup, I kept getting pops, clicks, hum, static and my first thought was maybe it was the PC setup or Latency or drivers. It was none of that in my case.
Long story short, I switched back to the shorter cable that came with the KB37 and that completely fixed the problem.
What I had failed to realize or think of when I switched to that really long USB cable was the fact that my Toneport KB37 is powered from the USB Port, it doesn't have an independent power supply, so for whatever reason, possible voltage drop not powering or carrying the signal, using the really long USB Cable was my entire problem.
I even tried using the regular cable and a small usb extension cable only adding about 3 feet extra length and still had the problem, only it was not as bad.
So at least in my case switching to the factory length cable that came with the KB37 directly plugged into the USB port solved all of my problems.
Just wanted to mention my situation in case someone else might run into this issue in the future and not think of it.