ALSA and PulseAudio Refresher: Difference between revisions

Created page with "...just some quick notes on commonly used commands. Sourced from other page and useful when not having used ALSA or PulseAudio for a couple of months when needing to get some stuff accomplished quickly === General === Show information about Audio Devices: <code>aplay -l OR aplay -L</code> Play via ALSA (forget PulseAudio and MPD): <code>aplay -D hw:0,0 -c 6 BeeGees.wav -vv</code> (...don't forget: <code>service pulseaudio stop</code>) === Dual Physical Audio Devices..."
 
Line 1: Line 1:
...just some quick notes on commonly used commands.  Sourced from other page and useful when not having used ALSA or PulseAudio for a couple of months when needing to get some stuff accomplished quickly
...just some quick notes on commonly used commands.  Sourced from other page and useful when not having used ALSA or PulseAudio for a couple of months when needing to get some stuff accomplished quickly


=== General ===
===General===
Show information about Audio Devices: <code>aplay -l OR aplay -L</code>
Show information about Audio Devices: <code>aplay -l OR aplay -L</code>


Play via ALSA (forget PulseAudio and MPD): <code>aplay -D hw:0,0 -c 6 BeeGees.wav -vv</code> (...don't forget: <code>service pulseaudio stop</code>)
Play via ALSA (forget PulseAudio and MPD): <code>aplay -D hw:0,0 -c 6 BeeGees.wav -vv</code> (...don't forget: <code>service pulseaudio stop</code>)


=== Dual Physical Audio Devices ===
=== References ===
https://www.alsa-project.org/wiki/Asoundrc


==== An Insane Side Story ====
https://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
 
===Dual Physical Audio Devices===
Below are the configuration items for /etc/asound.conf, /etc/pulse/system.pa, and /etc/mpd.conf.  Notice how the ''left'' and ''right'' audio channels are used by each device to provide a stereo sound;<syntaxhighlight lang="text">
/etc/asound.conf;
 
pcm.DualSound {
    type multi
    slaves.a.pcm "hw:0,0"
    slaves.a.channels 2
    slaves.b.pcm "hw:1,0"
    slaves.b.channels 2
    bindings.0.slave a
    bindings.0.channel 0
    bindings.1.slave b
    bindings.1.channel 1
}
 
pcm.!default {
    type plug
    slave.pcm "DualSound"
}
 
 
 
/etc/pulse/system.pa (among other 'generic' directives needed in the file, this is the one specific to Dual Audio, yup, that's it);
 
load-module module-alsa-sink device=DualSound name=ALSA.DualSound
 
 
 
/etc/mpd.conf (if playing files from MPC / MPD, and note how PulseAudio appends a prefix automatically);
 
audio_output {
type            "pulse"
name            "DualAudio"
sink "alsa_output.ALSA.DualSound"
}
</syntaxhighlight>According to documentation on https://www.alsa-project.org/wiki/Asoundrc, the sound synchronization may 'drift' or become unsynchronized after some unknown period of time.  But then again, the stereo thing should mask that for quite some time.  Plus on that same page they have several examples that just don't work at all, so how much can they be trusted, right?  After all, they're just the ones that programmed the darn software.
 
====An Insane Side Story====
What if two Audio Cards each support a different default rate?
What if two Audio Cards each support a different default rate?