ALSA Api: How to play two wave files simultaneously?
ALSA does not provide a mixer. If you need to play multiple audio streams at the same time, you need to mix them together on your own.
The easiest way this can be accomplished is by decoding the WAV files to float
samples, add them, and clip them when converting them back to integer samples.
Alternatively, you can try to open the default audio device (and not a hardware device like "hw:0") multiple times, once for each stream you wish to play, and hope that the dmix ALSA plugin is loaded and will provide the mixing functionality.
ALSA configuration to enable device sharing between multiple processes
As far as I have searched and checked, there is apparently no concrete way to do this in ALSA. I can share the built-in default
device between multiple processes, but any other configuration didn't provide this functionality. Also, I couldn't find any programmatic way to configure an ALSA device. The configuration file seems to be the only way to do this.
Related Topics
In Linux, How to Find Find Directory with The Most Subdirectories or Files
Checking Shared Libraries for Non Default Loaders
How to Set Control Register 0 (Cr0) Bits in X86-64 Using Gcc Assembly on Linux
Any Good Guides on Using Ptrace_Sysemu
Finding Threading Bottlenecks and Optimizing for Wall-Time with Perf
Is Swarm Required for Using Multi-Host Networking Feature Using Overlay in Docker
Eclipse Doesn't Use The Path Set in .Bashrc
Linux: Checking If a Socket/Pipe Is Broken Without Doing a Read()/Write()
Automatically Sync Two Amazon S3 Buckets, Besides S3Cmd
How to Send Esc/Pos Commands to Thermal Printer in Linux
Linux of Equivalent Cryptprotectmemory
Execute a Script After Every Git Push
How to Grep for The Exact Word If The String Has Got Dot in It
Linux: How to Enable Execute in Place (Xip) for Ramfs/Tmpfs
How to Parse Http Headers Using Bash
Visual Studio Code on Linux Xwindow Forwarding