Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
#######
#
# E-scripts about ALSA.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/alsa.e>
#           or at <http://angg.twu.net/e/alsa.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######






# «.multiple-cards»	(to "multiple-cards")
# «.snd-hda-intel»	(to "snd-hda-intel")
# «.snd-usb-audio»	(to "snd-usb-audio")
# «.multiple-cards-old»	(to "multiple-cards-old")
# «.alsamodules»	(to "alsamodules")
# «.unload-modules»	(to "unload-modules")
# «.alsaconf-cli»	(to "alsaconf-cli")
# «.pulseaudio»		(to "pulseaudio")
# «.alsaplayer»		(to "alsaplayer")

See:
  (find-es "music")
  (find-es "sound")



# http://www.alsa-project.org/main/index.php/Matrix:Module-usb-audio




# (find-zsh "installeddebs | sort | grep alsa")
# (find-zsh "availabledebs | sort | grep alsa")
# (find-sh "pstree")
# (find-sh "ps ax")




#####
#
# Multiple cards (for using the HeadRoom BitHead as default)
# 2012jun13
#
#####

# «multiple-cards»  (to ".multiple-cards")
# http://www.google.com/search?q=alsa+multiple+cards
#             http://www.alsa-project.org/main/index.php/Asoundrc
# (find-w3m "$S/http/www.alsa-project.org/main/index.php/Asoundrc")

# (find-fline "/usr/share/alsa/alsa.conf")
# (find-angg ".asoundrc")
# (find-sh "aplay -l")

# http://wiki.debian.org/ALSA





#####
#
# snd-hda-intel
# 2009jun27
#
#####

# «snd-hda-intel»  (to ".snd-hda-intel")
# http://www.alsa-project.org/main/index.php/Matrix:Main
# http://www.alsa-project.org/main/index.php/Matrix:Vendor-Intel
# http://www.alsa-project.org/main/index.php/Matrix:Module-hda-intel
# alsaconf reports this:
#   hda-intel Intel Corporation 82801G (ICH7 Family) High Definition Audio Con

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
sudo modinfo soundcore
sudo modprobe snd-hda-intel
sudo modprobe snd-pcm-oss
sudo modprobe snd-mixer-oss
sudo modprobe snd-seq-oss




#####
#
# snd-usb-audio
# 2009jun27
#
#####

# «snd-usb-audio»  (to ".snd-usb-audio")
# http://www.alsa-project.org/main/index.php/Matrix:Main
# http://www.alsa-project.org/main/index.php/Matrix:Module-usb-audio

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
sudo modinfo soundcore
sudo modprobe snd-usb-audio
sudo modprobe snd-pcm-oss
sudo modprobe snd-mixer-oss
sudo modprobe snd-seq-oss
# (find-sh "cat /proc/modules | sort")
cat /proc/modules | sort | grep ^s
cat /proc/modules | sort

R
w alsaconf
exit




#####
#
# Multiple cards
# 2009jun27
#
#####

# «multiple-cards-old»  (to ".multiple-cards-old")
# http://alsa.opensrc.org/index.php/Main_Page
# http://alsa.opensrc.org/index.php/MultipleCards
# soundcard selection

aplay -l
asoundconf list
alsaplayer -o alsa -d UA25    some_k00!.ogg
alsaplayer -o alsa -d hw:0,0  some_k00!.ogg

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: UA25 [EDIROL UA-25], device 0: USB Audio [USB Audio]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 1: Audio [USB Audio], device 0: USB Audio [USB Audio]
 Subdevices: 1/1
 Subdevice #0: subdevice #0

In this example the audio devices are named "UA25" and "Audio".

[edit] Example commands and options for selecting sound cards:

Note options: -d device | device_alias -- Please see man aplay and man alsaplayer for an explanation
of the options.

  " These two commands play the ogg on card 0 -- the ens1371 card:

alsaplayer -o alsa -d UA25  some_k00!.ogg
alsaplayer -o alsa -d hw:0,0  some_k00!.ogg

# (find-fline "~/NICOTINE/panda/MEDICINE/")
cd ~/NICOTINE/panda/MEDICINE/
alsaplayer -o alsa -d hw:0,0  heads.mp3

# (find-status   "alsaplayer-text")
# (find-vldifile "alsaplayer-text.list")
# (find-udfile   "alsaplayer-text/")
# (find-status   "alsaplayer-common")
# (find-vldifile "alsaplayer-common.list")
# (find-udfile   "alsaplayer-common/")
# (find-man "1 alsamixer")






#####
#
# alsamodules
# 2009jun27
#
#####

# «alsamodules»  (to ".alsamodules")
# http://alsa.opensrc.org/index.php/AlsaModules
# Doesn't work

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "/proc/")
# (find-fline "/proc/asound/version")

if [ -f /proc/asound/version ]; then
    cat /proc/asound/version
    echo
    cat /proc/asound/cards
    echo
else
    CNT=0
    VER=`uname -r`
    SND=`find /lib/modules/$VER/kernel/sound -type f -name "snd-*" | \
        sed s/\.o$// | sed 's/^\/.*\///' | sort`

    for i in $SND; do
        CNT=$((CNT+1))
        [ $CNT -eq 1 ] && A=$i ; [ $CNT -eq 2 ] && B=$i
        [ $CNT -eq 3 ] && C=$i ; [ $CNT -eq 4 ] && D=$i
        [ $CNT -eq 4 ] && printf "%-18s %-18s %-18s %-18s\n" \
            $A $B $C $D && CNT=0
    done
    echo
    cat /proc/pci | grep "Multimedia audio controller"
    echo
fi



#####
#
# Unloading all sound modules
# 2009jun27
#
#####

# «unload-modules»  (to ".unload-modules")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "/usr/sbin/alsaconf" "# Try to unload all sound modules")
# (find-fline "/usr/share/linux-sound-base/")
# (find-fline "/usr/share/linux-sound-base/ALSA-module-list")
# (find-fline "/usr/share/linux-sound-base/OSS-module-list")
# (find-man "8 modprobe" "-r --remove")
# Try to unload all sound modules
for S in OSS ALSA ; do
	L="/usr/share/linux-sound-base/${S}-module-list"
	if [ -r "$L" ] ; then
		for M in $(sed -e 's/#.*//' -e '/^[[:space:]]*$/d' "$L") ; do
			[ "$M" ] && /sbin/modprobe -r "$M" >/dev/null 2>&1 || :
		done
	fi
done

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "/usr/sbin/alsaconf" "# Try to unload all sound modules")
# (find-fline "/usr/share/linux-sound-base/")
# (find-fline "/usr/share/linux-sound-base/ALSA-module-list")
# (find-fline "/usr/share/linux-sound-base/OSS-module-list")
# (find-man "8 modprobe" "-r --remove")
# (find-man "8 modprobe" "-q --quiet")
sudo /sbin/modprobe -v -q -r $(cat /usr/share/linux-sound-base/{ALSA,OSS}-module-list)

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
sudo modinfo soundcore
sudo modprobe snd-usb-audio
# sudo modprobe snd-hda-intel
sudo modprobe snd-pcm-oss
sudo modprobe snd-mixer-oss
sudo modprobe snd-seq-oss

p /home/music/horses/04._free_money.wav

# FATAL: Module snd_seq is in use.







#####
#
# Running parts of alsaconf interactively
# 2009jun27
#
#####

# «alsaconf-cli»  (to ".alsaconf-cli")
# (find-fline "/usr/sbin/alsaconf")
# (find-fline "/usr/sbin/alsaconf" "# Try to unload all sound modules")
# (find-fline "/usr/sbin/alsaconf" "Soundcard Selection")
# (find-fline "/usr/sbin/alsaconf" "probe_cards ()")
# (find-fline "/usr/sbin/alsaconf" "build_card_db ()")
# (find-fline "/sys/bus/pnp/")
# (find-fline "/proc/bus/pci/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
sudo bash
rm -Rv /tmp/alsa/
mkdir  /tmp/alsa/
cd     /tmp/alsa/
cp -v  /usr/sbin/alsaconf .
# (find-fline "/usr/sbin/alsaconf" "# main part continued..")
head -n 1414 < alsaconf > alsaconf-functions

cd     /tmp/alsa/
source alsaconf-functions

# (find-fline "/usr/sbin/alsaconf" "build_card_db $CARDID_DB")
CARDID_DB=/tmp/alsa/card_db
build_card_db $CARDID_DB
ncards=`grep '^snd-.*\.o$' $CARDID_DB | wc -w`
# (find-fline "/tmp/alsa/card_db")

echo $ncards


# (find-fline "/usr/sbin/alsaconf" "# Try to unload all sound modules")






#####
#
# pulseaudio
# 2009jun27
#
#####

# «pulseaudio»  (to ".pulseaudio")
# (find-angg ".emacs" "pulseaudio")
# (find-es "sound" "pulseaudio")
# (find-fline "/etc/init.d/aumix")

# (find-status   "pulseaudio-utils")
# (find-vldifile "pulseaudio-utils.list")
# (find-udfile   "pulseaudio-utils/")
# (find-status   "padevchooser")
# (find-vldifile "padevchooser.list")
# (find-udfile   "padevchooser/")
pulseaudio-native
pulseaudio-simple
pulseaudio-cli
pulseaudio-http
esound

# (find-zsh "dmissing pulseaudio")
# (find-man "pulseaudio")
# (find-sh "pulseaudio -h")
# (find-sh "pulseaudio --dump-conf")
# (find-sh "pulseaudio --dump-modules")

# (find-man "pulseaudio-simple")
# (find-man "pulseaudio-cli")

# (find-zsh "grep-available -i pulseaudio")
http://www.pulseaudio.org/wiki/Daemon
http://www.pulseaudio.org/wiki/FirstSteps

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
pulseaudio -C
help
list-modules
list-sinks
list-sources
list-clients

# (find-man "1 paplay")
# (find-zsh "dmissing libsndfile")
libsndfile

apti libsndfile1-dev
# (find-status   "libsndfile1-dev")
# (find-vldifile "libsndfile1-dev.list")
# (find-udfile   "libsndfile1-dev/")
# (find-fline "/usr/share/doc/libsndfile1-dev/html/")
# (find-fline "/usr/share/doc/libsndfile1-dev/examples/")

# (find-sh "pulseaudio --dump-modules")

http://www.pulseaudio.org/wiki/FAQ
http://www.pulseaudio.org/wiki/PerfectSetup

# (find-fline "/etc/pulse/")
# (find-fline "/etc/pulse/default.pa")
# (find-man "5 pulse-daemon.conf")

# (find-sh "dmesg")
# (find-sh "lsusb")

08bb:2900 Texas Instruments Japan PCM2900 Audio Codec
http://ubuntuforums.org/showthread.php?p=7482328
http://ubuntuforums.org/showthread.php?t=1130384

# (find-fline  "/proc/")
# (find-fline  "/proc/modules")
# (find-sh "cat /proc/modules | sort")

asoundconf set-default-card NameOfCard

http://alsa.opensrc.org/index.php/How_to_use_softvol_to_control_the_master_volume




# (find-fline "~/.asoundrc")

asoundconf
asoundconf list
aplay track02.cdda.wav
asoundconf set-default-card default
aplay track02.cdda.wav
asoundconf set-default-card usb
aplay track02.cdda.wav
asoundconf set-default-card hw:1,0
aplay track02.cdda.wav
asoundconf set-default-card Intel
aplay track02.cdda.wav
asoundconf list
asoundconf set-default-card default
aplay track02.cdda.wav

# (find-man "1 asoundconf")

# (find-efunction 'eepitch-shell)


* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
asoundconf is-active
asoundconf get|delete PARAMETER
asoundconf set PARAMETER VALUE
asoundconf list
asoundconf set-default-card CARD
asoundconf reset-default-card

aplay
aplay -h
# (find-sh "aplay -h")
# (find-sh "aplay -l")
# (find-sh "aplay -L")
# (find-sh "aplay -L" "USB Audio CODEC")


# (find-man "asound")
# (find-fline "~/.asoundrc")
# (find-fline "~/.asoundrc.asoundconf")

# (find-zsh "dmissing asound")
# (find-fline "/usr/share/alsa/")
# (find-fline "/usr/share/alsa/cards/")
# (find-fline "/usr/share/alsa/cards/USB-Audio.conf")
# (find-man "alsa.conf")

libasound2-doc


http://alsa.opensrc.org/index.php/AlsaModules

#pulseaudio

<edrx> hello - I am a newbie to pulseaudio - and btw I'm mostly a
       CLI/Emacs person, and my knowledge (and use) of the sound
       devices is quite basic... and I have a newbie question, here
       it goes: I just got an external phone amplifier that was
       supposed to be automatically recognized as an external USB
       soundcard... lsusb lists it as "Bus 002 Device 003: ID
       08bb:2900 Texas Instruments Japan PCM2900 Audio Codec", but
       alsaconf do
<edrx> esn't list it as an option... any hints? also, is there a
       way to make pulseaudio ask alsa to use a specific soundcard?
       (I also have an on-board intel 82801G soundcard)...
<edrx> I'm learning to use the "pulseaudio -C" CLI, but it seems
       (?) to expect device names given as "/dev/..." for choosing
       sound sinks...
<edrx> so my question may be an alsa question 8-\
!!! irc.freenode.net: deleted (closed)


# (find-fline "/etc/init.d/alsa-utils")




#####
#
# alsaplayer
# 2009sep09
#
#####

# «alsaplayer»  (to ".alsaplayer")
# (find-man "1 alsaplayer")

# (find-status   "alsaplayer-common")
# (find-vldifile "alsaplayer-common.list")
# (find-udfile   "alsaplayer-common/")
# (find-status   "alsaplayer-text")
# (find-vldifile "alsaplayer-text.list")
# (find-udfile   "alsaplayer-text/")

http://alsa.opensrc.org/index.php/Alsaplayer
http://www.alsaplayer.org/
http://www.alsaplayer.org/features.php

# (find-zsh "availabledebs | sort | grep jack")

jack






#  Local Variables:
#  coding:               raw-text-unix
#  ee-delimiter-hash:    "\n#*\n"
#  ee-delimiter-percent: "\n%*\n"
#  ee-anchor-format:     "«%s»"
#  End: