I have a program that runs in wsl that uses ALSA for its input and output devices and those devices lists are showing up empty inside of my program. How do I configure wsl or whatever to know my devices?
Assistant
User
(seeder) meow@Anbernic-Win600:~
Assistant
User
ok well I need to use ALSA how do I get ALSA to see my devices?
Assistant
When running Linux programs via WSL (Windows Subsystem for Linux) that rely on ALSA (Advanced Linux Sound Architecture) for audio input/output, you often encounter an issue where the ALSA device list appears empty or no sound devices are found. This happens because WSL does not provide direct access to the host machine's ALSA devices by default — WSL doesn't have direct access to the physical sound hardware or the ALSA drivers that run on the Windows host.
Why does this happen?
WSL1/WSL2 does not natively support ALSA or direct sound hardware access.
ALSA is usually for Linux kernel-level sound management, but WSL does not use a Linux kernel that interacts directly with the hardware.
Windows uses its own Windows Audio drivers and APIs — ALSA devices don't normally show up inside WSL.
How to fix or work around this?
There are two main approaches:
Option 1: Use PulseAudio or PipeWire in WSL with sound forwarding service on Windows
Since ALSA devices are not accessible, typically people use a sound server like PulseAudio or PipeWire inside WSL, which talks to the PulseAudio server running on Windows (or vice versa) to achieve sound.
Steps:
Install PulseAudio server on Windows
You can install a Windows PulseAudio server implementation, for example:
Redirect your program to use PulseAudio instead of direct ALSA
Most Linux applications support PulseAudio out of the box.
Option 2: Use WSLg (Windows Subsystem for Linux GUI) with built-in sound support
If you are running Windows 11 and the latest WSL version (WSL2 with GUI support enabled):
WSLg includes integrated sound support via PulseAudio and Wayland.
Sound apps running in WSLg should have sound "just work" transparently.
No ALSA devices appear, but PulseAudio devices will.
To check if you have WSLg:
bash
echo $WAYLAND_DISPLAY
If this environment variable is set, you are likely using WSLg.
In this setup, apps use PulseAudio, not ALSA directly, so your program would need to support PulseAudio or be adapted to use PulseAudio.
Option 3: Access Windows audio devices from WSL by passing through Windows drivers (advanced / experimental)
Currently, there is no native support to expose ALSA devices directly inside WSL because hardware pass-through support for audio devices especially in WSL2 is limited.
You could try using USB sound card passthrough via USB/IP but it's complex and usually not recommended.
Alternatively trying to use WASAPI bridge software that converts Windows audio to ALSA inside WSL is complicated and rare.
Summary:
ALSA devices do not show up in WSL because WSL does not expose Linux ALSA sound devices; it uses a virtualization layer instead.
You need to use a Linux sound server (PulseAudio) in combination with a Windows PulseAudio server or WSLg's built-in sound support.
Configure your app to use PulseAudio instead of direct ALSA.
If your program insists on ALSA devices, run it on a real Linux installation or inside a VM.
N: [pulseaudio] main.c: User-configured server at tcp:localhost:4713, refusing to start/autospawn.
means that you have told PulseAudio (with your PULSE_SERVER environment variable) to connect to an already running server at tcp:localhost:4713, so it is refusing to start its own server.
Why?
When you set PULSE_SERVER=tcp:localhost:4713, pulseaudio assumes there is already a PulseAudio server running on Windows listening at TCP port 4713.
Hence it does not start a new local pulseaudio daemon, since it expects the server to be remote (in this case, Windows host).
This is normal behavior — it tries to connect as a client to the Windows PulseAudio server.
What you need to do:
Make sure a PulseAudio server is running on Windows
The environment variable you have tells the WSL client to connect to a PulseAudio server on Windows on localhost port 4713.
But first, you need to install and run a PulseAudio server on Windows that listens on TCP port 4713!
This is not built-in by default.
How to run PulseAudio server on Windows:
Here’s a minimal guide:
1. Download PulseAudio for Windows:
You can find Windows builds (unofficial) here, for example:
Or launch PulseAudio manually with TCP enabled like:
bash
pulseaudio.exe -nF default.pa --exit-idle-time=-1
Make sure the module-native-protocol-tcp is loaded, it allows clients to connect via TCP.
3. Run pulseaudio.exe on Windows before starting your app in WSL
Open Command Prompt or PowerShell, run pulseaudio.exe with config.
Summary workflow:
Start PulseAudio server on Windows (with TCP enabled)
In WSL, set:
bash
export PULSE_SERVER=tcp:localhost:4713
Run your Linux program in WSL which will connect to the PulseAudio server on your Windows host.
Alternative:
If you are on Windows 11 with WSLg (GUI and sound enabled WSL), you usually don't need to do all this — sound "just works" using the integrated PulseAudio server. Make sure you are using WSLg by running GUI apps and checking echo $WAYLAND_DISPLAY is set.
Additional notes:
PulseAudio on Windows cannot directly access ALSA devices, but will access Windows sound devices.
For security, do not expose TCP sound server to external networks without authentication.
You can test PulseAudio server connectivity from WSL using paplay or pavucontrol.
If you want, I can also help you with step-by-step instructions to install and configure PulseAudio server on your Windows machine. Just let me know!
Short answer: WSL (especially WSL2) does not support direct ALSA device access because it lacks direct Linux kernel hardware drivers for sound devices. ALSA devices won't show up inside WSL because the subsystem virtualizes hardware differently, and sound hardware usually isn't passed through to the Linux side.
Why ALSA devices don't appear in WSL:
ALSA depends on Linux kernel sound drivers to detect and access physical sound hardware.
WSL2 runs a lightweight Linux kernel in a virtualized environment and does not pass through audio hardware or ALSA drivers.
Windows itself manages audio hardware with its own drivers, separate from Linux ALSA.
As a result, ALSA "sees" no devices and returns empty sound card and device lists.
Possible Workarounds and Options to "Get ALSA Devices":
1. Use a real Linux environment or a full Linux VM
If your app critically depends on ALSA and must detect ALSA devices, run it in:
A native Linux install.
Or a full virtual machine (e.g., VirtualBox, VMware) where Linux kernel drivers have full hardware access.
2. Run USB sound devices through to WSL (very complex)
Theoretically, you can try to pass USB audio devices into WSL using USB/IP or other passthrough tools.
This is very complex, fragile, and generally unsupported.
Documentation on this is sparse and mostly experimental.
Even if successful, ALSA drivers may still face limitations inside WSL.
3. Use PulseAudio or PipeWire bridges (recommended for sound apps in WSL)
Instead of forcing ALSA access, run PulseAudio in WSL and connect it (using PULSE_SERVER) to a Windows PulseAudio server.
This provides Linux sound apps with a usable sound backend.
PulseAudio has ALSA plugins which can simulate ALSA devices.
4. Modify your application to work with PulseAudio
Many Linux audio applications support multiple backends: ALSA, PulseAudio, JACK.
Running via PulseAudio inside WSL is often the best “native” solution since WSLg and newer WSL versions support this well.
This way, you don't rely on ALSA hardware devices at all.
5. WSLg (Recommended if you use Windows 11 and latest WSL)
WSLg includes built-in audio support using a PulseAudio server integrated with Windows audio.
ALSA layers won’t show devices, but PulseAudio clients work flawlessly.
If your program can be built/ configured to use PulseAudio (or at least output sound through it) you get working audio.
Summary
Goal
WSL Capability
Recommendation
Direct ALSA hardware
Not supported
Use real Linux, or VM
Sound in WSL
Supported via PulseAudio only
Use PulseAudio bridge or WSLg
ALSA compatible app
Needs ALSA visible devices
Run outside WSL or modify app for PulseAudio
TL;DR
You cannot reliably get ALSA devices listed in WSL.
You must either:
Run your program outside WSL, on real Linux or VM, or
Change your setup to use PulseAudio sound forwarding instead of ALSA.
If you want, I can help you convert your app or environment to work with PulseAudio sound forwarding for WSL sound support. Otherwise, direct ALSA access inside WSL is effectively not feasible today.
Let me know what your app is and what audio features it needs, and I can try to suggest best practical ways to run it on WSL or Windows.