In Windows “Sound” you have to enable stereo mix by right-clicking over it. It can help also to make it default device (another right-click over stereo mix). Single-click selecting a device does not enable it or make it default.
Having enabled stereo mix and made it default in Windows, restart Audacity then choose stereo mix as input device in Device Toolbar .
You need to play the sound you want to record on the built-in sound card. Listening to it on USB headphones means you cannot record it with stereo mix.
You have to be able to hear the computer playback or it won’t record.
You can try SoundLeech (free) or Total Recorder (costs money).
Then it’s not an Audacity problem. You can try SoundLeech or Total Recorder as mentioned before.
If you have a branded computer (like one made by Dell, HP or Lenovo) it may not be the best decision to get a sound card driver direct from the motherboard manufacturer. It could be the reason for your problem. A branded computer may have dependencies on a sound device using a particular sound card with its particular control panel. That sound device may not necessarily be Realtek.
What is the make and model number of the computer? Did you build it yourself?
recording function of my Thinkpad X201T is disable by Lenovo.
This is what I did。
I bought an Asus Xonar U3 USB sound card ， 3.5mm audio cable both end。
After installing the USB sound card， click Speaker （Asus Xonar U3） as output device，
click Line in （Asus Xonar U3） as input device。
Plug 3.5 cable into the headphone and microphone on the USB sound card。
Recording was nice and clear， except the volume could have been louder。