For best results with WASAPI it may be best to set Audacity project rate to 44100 Hz and also to set Default Sample Format in Windows “Sound” to 44100 Hz. Also you may need to start playing the stream before you press “Record” in Audacity. See: Audacity Manual .
The hints I wrote above apply to WASAPI rather than MME or Windows DirectSound. If your computer sound card has Stereo Mix or What U Hear (which you can use under MME or Windows DirectSound), you can always press Record before starting the stream.
WASAPI could have quality issues if resampling occurs between playback and recording or between Windows and Audacity when recording.
In my opinion, sample format doesn’t matter greatly for such quality as a built-in sound device will provide, but if you are recording an online stream it will very likely only be 16-bit. In that case, the following arrangement will probably minimise (but not totally eliminate) bit depth conversions and eliminate sample rate conversions:
16-bit 44100 Hz Default Format in Windows (for both Playback and Recording)
both “Exclusive Mode” boxes enabled in Windows
in Audacity, either Windows DirectSound host with Stereo Mix or Windows WASAPI host with loopback
44100 Hz Project Rate bottom left of Audacity
Default Sample Format in Audacity’s Quality Preferences set to 32-bit float (it already is set to that by default).
Audacity always forces recording to 32-bit float resolution, hence the suggestion not to downconvert that by choosing 16-bit Default Sample Format.
Windows will (as I understand it) upconvert to 32-bit to process samples before downconverting to 24-bit or 16-bit, unless you choose Windows WASAPI with Exclusive Mode enabled. On Vista and later, Windows will still convert to and from 32-bit under Windows DirectSound even with Exclusive Mode enabled, because Windows DirectSound is emulated and still goes through the “audio stack” rather than having direct access to the kernel. On XP, DirectSound actually has direct kernel access.
Again as I understand it, choosing Exclusive Mode with Windows DirectSound host in Audacity will mean there will be no sample rate conversions during the recording, even on Vista or later - Audacity will receive the sample rate set in Project Rate. Sample rate behaviour under WASAPI is somewhat buggy and inconsistent. WASAPI may resample to the Default Format (or to 44100 Hz) even if Exclusive Mode is on, hence the recommendation to set 44100 Hz project rate in Audacity if using WASAPI loopback.
So as you can see, the answer to your question is very complex.
All recordings are generally made in 16 bit.
Wasapi and Wdm-KS are the only hosts that provide 24 bit recordings. Thus, I would certainly enable this bit depth (in the sound control panel).
It is in that context not important that the internet stream has only 16 bit.
24 bit is for instance an advantage if you make a real-time commentary, i.e. if a microphone is connected and hardware overdubbing enabled.
Most built-in sound cards these days claim to support 24-bit recording, if the Default Format settings in Windows are to be believed.
I believe the DIrectSound API supports 24-bit recording, but unfortunately not with the PortAudio interface that Audacity uses.
I think it’s relevant if the objective is to minimise bit depth conversions. As you point out, you won’t get real 24-bit recording in Audacity in any case unless you use WASAPI loopback.
I recently read a technical review article for an inexpensive audio device that claimed 24 bit recording (sorry I can’t find the article now). The test results showed that the audio device did indeed produce 24 bit data, but the final 8 bits were all zeros!