It's true that this may depend on the quality of your PC's sound hardware. A microphone signal is a lot weaker than an amplified keyboard output, so that might explain the noise! A headphone out --> line in connection should work, but maybe not --> microphone in.
You might anticipate a bit of lag if recording through a webcam, audio and video there isn't expected to be instant. A direct connection should give you no trouble.
You might anticipate a bit of lag if recording through a webcam, audio and video there isn't expected to be instant. A direct connection should give you no trouble.