0

I'm using wsl version 2 and Xlaunch to connect with x11 server. The problem is when I'm running this code:

import sounddevice as sd
print(sd.query_devices())

It returns nothing or even running $python3 -m sounddevice ,again returns nothing. what can be the problem?

fatemeh_p
  • 21
  • 4

1 Answers1

0

You mention setting up Xlaunch (VcXsrv), but this only provides graphical support, not audio. PulseAudio is typically used to provide a connection between the Linux code running in WSL and the Windows audio source.

While you can configure PulseAudio manually, I would recommend simply using the WSLg feature of WSL2, since it's now available for both Windows 10 and 11 users. WSLg should automatically configure PulseAudio for you with no additional effort.

See this Ask Ubuntu answer where I cover how to upgrade your system (hopefully) to the latest Windows release and then upgrade WSL to use the 1.0.0 (or later) application package that includes this support.

NotTheDr01ds
  • 15,620
  • 5
  • 44
  • 70