I am using either a Rode NT1A or an audio technical cardoid lapel mic but have the same problem with both. I also use a Focusrite Scarlett 2i2 . I have used this gear many times but have also had this problem many times. THis time all the stock answers I find by googling are not solving the problem which is I get:
Error while opening sound device. Please check the recording device setting and the project sample rate.
And this has also been added to that page in the upcoming 2.3.0 manual:
Windows WASAPI: Recording from a USB device
You may get this error if you set Audacity to record from a USB device and playback through your onboard soundcard with the Audio Host set to WASAPI.
We believe that this is likely to be a problem with Microsoft’s WASAPI not liking working with two devices at once. There may probably be no fix that we can make in Audacity, but this issue is logged as a bug in Audacity and will continue to research this.
Workarounds
Use MME or Windows Direct Sound as your Audio Host
Use your USB device for both input and output (not possible if recording from a USB turntable or USB tapedeck)
Have tried WASAPI MME and Windows Direct Sound. I have used Audacity for over 10 years and though occasionally seen this error usually found the solution quickly but not this time.
well you’ve got me foxed - those two new bits for adding to the 2.3.0 Manual are both what caught me out recently - apart from that I’m out of ideas, sorry.