There are several posts out there regarding this topic, but none accurately present the solution to the problem of a VMware Workstation on a Windows Host having the following problem with connecting the virtual sound card under a Linux guest (the message appears under Windows Guests as well, but the sound just happens to work properly):
"The default sound device cannot be opened: A device ID has been used that is out of range for your system. Failed to connect virtual device sound."
Here is the real solution.
The problem is that the "Stereo Mix" option has to be enabled. This is an option with Realtek AC'97 compatible sound cards. You are likely having this problem in the first place if you have a Realtek-compatible sound card. The problem doesn't lie in the guest Linux installation of ALSA, PulseAudio, OSS, or any other feature under Linux like many have suggested provided that you are using the recommended sound setup for your distribution.
In order to solve the problem, enable the "Stereo Mix" option:
1. Right-click on the sound card volume icon in the tray.
2. Select "Recording Devices"
3. In a blank or "white" space where the recording devices are listed, right-click and enable "Show disabled devices".
4. The "Stereo Mix" option should appear.
5. Right-click on the "Stereo Mix" option, and select Enable.
6. Make sure that the virtual sound card is set to connect at startup for the guest VM in question.
7. Enjoy working sound in your Guest VMs.
If the "Stereo Mix" option doesn't appear in the recording devices panel, then you need to install the latest Realtek AC'97 codec drivers here:
After installation of the updated drivers, repeat steps #1-#7.
Hope this helps and makes the solution official.
Finally! A fix.
The key was getting the actual realtek drivers installed instead of the default Windows basic driver I had. Then the "stereo mix" becomes available to enable. worked like a charm.
Many, many belated thanks for this solution! Since I mostly worked with server VMs, I have always ignored that annoying sound device warning. However, as I am now exploring various Linux desktop solutions, I decided to once and for all find a fix.
3-1/2 years later and this solution is still valid. The steps outlined fixed the issue on a Windows 10 Professional host and CentOS 7 Desktop VM. Once the latest and greatest Reltek driver replaced Microsoft's default, I could enable Sound Mix, resulting in a beautifully clear audio prompt upon logging onto CentOS 7 with Cinnamon.
After years of putting up with this issue a lucky Google search picked up this thread and I tried it. I have Win 10 1703, Workstation 14 (Just upgraded from 12 trying to fix the issue, did not.) ASUS X99-A II and followed the instructions and just like that, sound from my Linux Mint 18.1 and 18.2 Vm's.
This solution worked great on my Linux Mint 18.3 guest until I upgraded Windows 10 64 Pro to the spring creator 1803 update. After that upgrade, I get an unspecified error message that is not resolved with the "Stereo Mix" enabled. I've gone to my motherboard vendor's site (ASUS) and downloaded and installed the latest Realtek audio updates, to no avail. Also deleted all audio drivers and reinstalled the latest Realtek drivers. The funny thing is that a Windows 10 guest audio works great !! Even without "Stereo Mix" enabled.
With the Linux guest, if I don't enable the "Stereo Mix" in the Windows 10 host, I get the usual "out of range" message from VM Ware Player. However, when enabling "Stereo Mix" instead of the problem going away, I get a message that states an "unspecified" error has occurred.
I hope this issues can be looked into and resolved so that I can get audio working again on my Linux guest.
This problem in Windows 10 is related to your privacy settings. I faced the exact same issue and figured out that the use of the sound device was denied because of my Privacy settings in my Windows 10 x64 system running build 1803. When I allow applications to access my audio related devices (like Camera, Microphone), then audio device will no longer disconnect in Linux guest OS and audio will be working fine!
Unfortunately currently there appears no way to make an exception for VMware Workstation in privacy settings...
If the sound stops working in the Linux Virtual Machine due to error "A device ID has been used that is out of range for your system." then install pavucontrol
> sudo apt install pavucontrol
select Configuration tab
select Profile: Analog Stereo Output
If the sound doesn't immediately come back on, then go to VMware Workstation Menu Bar and select VM > Removable Devices > Sound Card > Connect
This was the root of the issue on my machine. I generally lock down privacy settings as far as I can and had disallowed microphone access to apps. I didn't even think that it could be related. Thanks for the tip!!
Ok, today is December 2, 2020 and I just tried this fix and it worked on my Ubuntu 20.04 install. Putting the date in there so hopefully the crawlers will pick it up for those of you having this same issue.
This article helped me clue into another possible cause which was the actual issue on my desktop machine.
I never use the inputs on my desktop, so all of the devices in the Recording tab of the Windows 10 sound control panel were showing as "no plugged in". I plugged a dummy 3.5mm plug into my microphone jack (no actual microphone, just a cord) and it enabled the device. This immediately fixed the issue in the Ubuntu guest.
There might be a better way somewhere (forcing them enabled via software instead of plugging in a jack). This works for now.