There is a lot of work done to convert analog sound into digital data, which is what happens when you run audio output from an external keyboard into your computer. That process is called Analog/Digital conversion, or A/D conversion. The digital data would get stored on the computer as ones and zeros, rather than as actual sound.
When you load up a wave file on your computer, into a music program that can play that file, such as Windows Media Player, all of that digital data has to get converted back into audio data, from the digital data stored into the file. That process is called Digital to Analog conversion, or D/A conversion.
For a simple song file, your computer can handle doing the work of these conversions, but if you are working with multiple tracks of data, it will become too much work for your computer's CPU to handle doing all of that conversion in real-time, and you end up with noisy crackly horrible sound, even with dropouts, because the CPU is not really designed to have to do that much work in real-time. After all, it is also doing all the work of running the OS, and any programs you are running, etc.
Sooooo, the concept of transferring all of the conversion work A/D D/A was built into what we call an Audio Interface. An audio interface has circuitry and software drivers that are purpose-built to handle all of the conversion back and forth from analog and digital, removing the need for you CPU to have to do that. These audio interfaces are a critical component of a digital audio workstation (DAW) for running software like Sonar.
An audio interface with good quality converters and pre-amps and such can run around $150 on up to $500 or more, depending on features.
So, with an audio interface plugged into your computer, there are also software drivers needed so that the computer can talk to and control the audio interface. The drivers will take on the work of telling the audio interface to convert a song file back to analog sound that can go to speakers connected to the audio interface, and those same drivers also would tell the interface to convert any data from inputs connected to the interface from analog to digital, and then pass that digital data to whatever music program you are using with the audio interface. So, for all of the conversions in both directions, your CPU is spared.
So to get Windows to have your audio interface DO all of that work, you need to tell your music program to use the drivers for your audio interface - which will probably by a driver mode of 'ASIO'.
On MY computer, I have programs like Sonar, or stand-alone versions of Dimension Pro or Kontakt, all set to use the ASIO drivers of my audio interface, but I ONLY allow those kinds of programs to be accessing the ASIO drivers of the audio interface. I have my Windows Default Audio Device set to use the on-board sound drivers of the computer's motherboard, and NOT to use the ASIO drivers of the audio interface. I do this because of the way ASIO works - I let Windows Media Player, or songs played through YouTube, or other internet pages with audio clips all get handled by the computer's on-board sound. Trying to share ASIO between Sonar and Windows Media Player or YouTube or whatever, leads to conflicts and just doesn't work.
So, for general settings for using an audio interface and ASIO drivers in Sonar, I do recording with the following settings: for the audio interface - Sample Rate 48 K, ASIO Buffer Size of 128. For Sonar, settings for recording are: Driver Mode = ASIO, Sample Rate of 48 K, Record Bit Depth of 24 bits. With these settings, I get a great quality of sound recorded, and low latency - meaning do discernible delay between singing or playing a note, and hearing it back through input echo on the track in Sonar.
Something you are going to want to do AFTER you finish recording, and are ready to load up a bunch of heavy duty effects, is to alter the settings. This is because once you are mixing or mastering, you don't care about latency any more - you need to have a large enough ASIO Buffer so that things like a convoluted reverb can their look-ahead processing. So, for mixing/mastering, I change my settings to: ASIO Buffer Size 1024 or even 2048, leaving the other settings the way they were. That larger buffer adds a bunch of latency, but for mixing/mastering who cares?
For the rest of time, you will find yourself adjusting that ASIO Buffer Size back and forth, small (128) for recording, and large for mixing/mastering (1024 or 2048).
OK, so give the above a try and post back with your results. :)
Bob Bone