To create four dummy sound cards on Ubuntu 24.04, load the snd-dummy kernel module with specific parameters using the command sudo modprobe snd-dummy enable=1,1,1,1 pcm_devs=4,4,4,4. This configuration initializes four independent virtual audio devices that function as standard ALSA sound cards, allowing applications to route audio streams to these non-existent hardware endpoints for testing or isolation purposes.
Understanding the snd-dummy Module
Thesnd-dummy driver is a built-in Linux kernel module designed to provide a software-only implementation of an audio device. Unlike physical hardware, it does not require any actual electronic components to operate. Instead, it captures audio data and discards it or processes it in memory, effectively simulating the presence of a sound card without producing audible output. This makes it invaluable for developers who need to test audio applications in environments where physical speakers are unavailable or when isolating audio processing pipelines from hardware-specific quirks.
In Ubuntu 24.04, which utilizes the latest LTS kernels, this module remains a stable and reliable component of the ALSA (Advanced Linux Sound Architecture) subsystem. It allows system administrators to create multiple virtual devices simultaneously, each capable of handling its own stream of audio data. By configuring the module correctly, you can ensure that your system recognizes exactly four distinct sound cards, each behaving like a real piece of hardware from the perspective of user-space applications.
For more information on troubleshooting general audio issues, see Solving No Sound Issue in Ubuntu: A Tech Support Guide.
Loading the Module with Specific Parameters
To instantiate four dummy sound cards, you must pass specific arguments to themodprobe command. The primary parameter controlling the number of devices is pcm_devs, which specifies the count of PCM (Pulse Code Modulation) subdevices to create. Setting pcm_devs=4,4,4,4 instructs the driver to create four separate cards, each containing four PCM subdevices. This structure ensures that each virtual card has enough capacity to handle playback and recording streams independently.
The second critical parameter is enable. By setting enable=1,1,1,1, you explicitly activate all four created cards. Without this flag, the modules might be loaded but remain inactive, preventing applications from detecting them. The syntax uses commas to separate values for each individual card instance, ensuring that the kernel applies the settings uniformly across all four virtual devices.
You can execute this by opening a terminal and running the following command:
sudo modprobe snd-dummy enable=1,1,1,1 pcm_devs=4,4,4,4
After executing this command, verify the installation by checking the list of available sound cards using aplay -l. You should see four entries labeled "dummy" in the output, confirming that the virtual hardware has been successfully registered with the ALSA system.
Making the Configuration Persistent
While themodprobe command works immediately, it does not survive a system reboot. To ensure that the four dummy sound cards are available every time Ubuntu starts, you need to configure the module loader permanently. This involves creating or editing a configuration file in the /etc/modprobe.d/ directory.
Create a new file named 99-snd-dummy.conf using a text editor with root privileges:
sudo nano /etc/modprobe.d/99-snd-dummy.conf
Add the following line to the file:
options snd-dummy enable=1,1,1,1 pcm_devs=4,4,4,4
Save the file and exit the editor. Next, update the initial RAM filesystem (initramfs) to include this configuration during the boot process:
sudo update-initramfs -u
This step ensures that the module is loaded early in the startup sequence, before other audio services initialize. Rebooting your system will now automatically load the four dummy sound cards without requiring manual intervention.
If you encounter difficulties after rebooting, check if the module is loaded correctly by running lsmod | grep snd_dummy. If the module is missing, ensure that no other audio manager is interfering with the initialization process. For further assistance with audio detection problems, refer to Can't get sound in Ubuntu despite detecting sound devices?.
Managing Audio Streams with Dummy Cards
Once the dummy cards are active, you can use them just like physical devices. Applications such as VLC, Spotify, or custom Python scripts can select these cards as their output destination. In GNOME-based environments, you may need to adjust the default sink usingpactl or the graphical sound settings.
Use pactl list short sinks to identify the PulseAudio names associated with the dummy cards. These names typically follow the pattern alsa_output.pci-0000_00_1f.3.analog-stereo but will reference the dummy driver instead. You can then set one of these sinks as the default for your session.
Be aware that since these are dummy devices, any audio played through them will not produce sound. However, CPU usage may increase slightly depending on the application's processing requirements, as the audio data is still being handled by the software stack. This behavior is useful for stress-testing audio pipelines or monitoring resource consumption without external hardware interference.
Frequently Asked Questions
Why is no sound coming out of my dummy cards?
This is expected behavior because dummy sound cards are software simulations that do not connect to physical speakers. They capture audio data and discard it rather than converting it into electrical signals for hardware playback. Use them for testing application logic or routing streams, not for listening to audio.
How do I remove the dummy sound cards if I made a mistake?
You can unload the module by running sudo modprobe -r snd-dummy. However, if applications are currently using the devices, the removal may fail. Close all audio-playing applications first, then attempt to remove the module again. To prevent auto-loading, delete or comment out the options line in /etc/modprobe.d/99-snd-dummy.conf.
Can I change the number of dummy cards after loading?
No, the number of devices is determined at module load time. You cannot dynamically add or remove cards while the module is active. To change the configuration, you must unload the existing module and reload it with the new parameters using modprobe.
Do dummy sound cards affect system performance significantly?
The performance impact is minimal for most modern systems. Since the audio data is processed in memory and discarded, there is no heavy encoding or hardware communication overhead. However, if many high-bandwidth applications write to these devices simultaneously, you may notice a slight increase in CPU usage due to buffer management.
How can I verify which applications are using the dummy cards?
You can use the pactl list short sinks command to view active sinks. Additionally, tools like pavucontrol (PulseAudio Volume Control) allow you to visually inspect which application is outputting audio to which device. Look for entries labeled "Dummy" in the output tab of this utility.