Linux HOWTOs

About | Home | Search


ERROR: Slooooow dooooown... this page load was delayed.

HOWTO: alsa
Description: Advanced Linux Sound Architecture
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# alsa
# ====
# alsa is the replacement sound drivers (and libraries, utils) for the
# OSS/free drivers in the 2.4 and down kernels.  These are already part of
# kernel 2.6.x  IMHO, the alsa drivers are on a similar level to the
# commercial version of oss (which is now free for personal use), and
# they're _much_ better than the oss/free drivers.  They include oss
# compatibility, so your apps that are hard set to use oss won't break.

# Create directories for source and tarballs:
mkdir -p -m 0700 ~/installed/alsa ~/src/alsa


# alsa-driver 1.0.16
# ==================
# Slackware 9.1's 'alsa-driver' package includes version 0.9.6, 10.0's
# includes version 1.0.5a, 10.1's includes 1.0.8, 10.2's includes 1.0.9b,
# 11.0's includes 1.0.11, and 12.0's includes 1.0.14

# As I write this, the current stable Linux kernel is 2.6.24.1 and it
# includes alsa 1.0.15, so this is newer.
#
# You can check what version is included in your kernel by looking at
# /usr/src/linux/include/sound/version.h
# If you have the latest already, you can skip this part.  Do look at
# the configuration notes below the build/install part though.

# Prerequisites (beyond those listed above):
# You need to have enabled "Sound Card Support" (CONFIG_SOUND) in the kernel.
#  Specifying M there is fine, none of the sub options are necessary.
# Remove the standard kernel-headers (kernel 2.4.x) package and replace it
#  with the one from "testing"
#  (kernel 2.6.x).

cd
test -f installed/alsa/alsa-driver-1.0.16.tar.bz2 &&
 mv installed/alsa/alsa-driver-1.0.16.tar.bz2 .
test ! -f alsa-driver-1.0.16.tar.bz2 &&
 wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.16.tar.bz2
cd src/alsa
find -maxdepth 1 -type d -name "alsa-driver-*" -exec rm -r {} \;
tar xjvf ~/alsa-driver-1.0.16.tar.bz2
cd alsa-driver-1.0.16
test $UID = 0 && chown -R root:root .

# To only build it with drivers for your card, specify
# --with-cards=driver where driver is the driver for your card (I use
# "--with-cards=cs46xx --with-card-options=cs46xx-new-dsp").  Otherwise
# it'll build all of them.

./configure
make

# Become root to install it
su

test -x /sbin/removepkg && /sbin/removepkg alsa-driver
make install

# These two lines will create all of the device files that alsa uses and will
# make them readable and writeable by everyone (666).  If you only want root
# to have access to the sound card, make it chmod 600, or you could use the
# 'audio' group and make them 660 and owned by root:audio so anyone in that
# group has access to it.  Skip this part if you use devfs or udev to manage
# /dev for you.  With udev, see /etc/udev/rules.d/* to make sure it has
# the correct ownership and permissions.
#
# I like to ssh into remote systems where I know they have a sound card and
# speakers connected, then play a wav file of a cricket or something like
# that.  ...or once I cranked up the volume and played the THX intro on my
# boss' computer when I was at home :-)  Keep that in mind as you ponder how
# to set the permissions.  It could save you from a heart attack one day.
./snddevices
chmod a+rw /dev/dsp /dev/mixer /dev/sequencer /dev/midi

# If you DON'T have the /etc/rc.d/init.d and /etc/rc.d/rc?.d directories
# created, create a /etc/rc.d/rc.alsa script to enable ALSA on boot-up. 
# Recent versions of Slackware will start this script out of rc.M  If yours
# doesn't, add something to rc.local to run '/etc/rc.d/rc.alsa start'.
# Slackware includes a rc.alsa script, but you'll loose that when you
# 'removepkg alsa-utils'.
test ! -d /etc/rc.d/init.d &&
 install -m 755 utils/alsasound /etc/rc.d/rc.alsa

# If you DO have those directories set up, 'make install' already installed
# the script as /etc/rc.d/init.d/alsasound, now create the sysvinit-style
# symlinks:
rm -f /etc/rc.d/rc.alsa
cd /etc/rc.d/rc0.d && ln -sf ../init.d/alsasound K14alsasound
cd /etc/rc.d/rc2.d && ln -sf ../init.d/alsasound S87alsasound
cd /etc/rc.d/rc3.d && ln -sf ../init.d/alsasound S87alsasound
cd /etc/rc.d/rc4.d && ln -sf ../init.d/alsasound S87alsasound
cd /etc/rc.d/rc5.d && ln -sf ../init.d/alsasound S87alsasound
cd /etc/rc.d/rc6.d && ln -sf ../init.d/alsasound K14alsasound

# The modules that were installed are in /lib/modules/`uname -r`/kernel/sound
# Don't forget, when you rebuild a new kernel, go through this again after
# you reboot.

# To actually configure it, you can run 'alsaconf' after you install
# alsa-utils, or manually configure modules.conf|modprobe.conf yourself.
#
## If you run a 2.4.x kernel, add something like this to your
## /etc/modules.conf, then run 'depmod -a' when you're done.  See the
## Sound Card Matrix on the alsa site for ideas.
## It's all commented out here so nobody will cut and paste it and run it as a
## command by mistake (which would set bash aliases).
#
## ALSA portion
#alias char-major-116 snd
#alias snd-card-0 snd-cs46xx
## OSS/Free portion
#alias char-major-14 soundcore
#alias sound-slot-0 snd-card-0
## card #1
#alias sound-service-0-0 snd-mixer-oss
#alias sound-service-0-1 snd-seq-oss
#alias sound-service-0-3 snd-pcm-oss
#alias sound-service-0-6 snd-pcm-oss
#alias sound-service-0-8 snd-seq-oss
#alias sound-service-0-12 snd-pcm-oss
## Other misc stuff
#alias snd-card-1 off
#alias snd-card-2 off
#alias snd-card-3 off
#
## When I ran generate-modprobe.conf to convert my /etc/modules.conf to a
## /etc/modprobe.conf for the 2.4.x to 2.6.x kernel upgrade, this is what
## it put in modprobe.conf:
#alias char-major-14-* soundcore
#alias char-major-116-* snd
#alias snd-card-0 snd-cs46xx
#alias sound-slot-0 snd-cs46xx
#alias sound-service-0-0 snd-mixer-oss
#alias sound-service-0-1 snd-seq-oss
#alias sound-service-0-3 snd-pcm-oss
#alias sound-service-0-6 snd-pcm-oss
#alias sound-service-0-8 snd-seq-oss
#alias sound-service-0-12 snd-pcm-oss
#install snd-card-1 /bin/true
#install snd-card-2 /bin/true
#install snd-card-3 /bin/true

# If you're currently running X, you'll probably want to shut it down so arts
# (KDE sound server) and similar software doesn't go crazy or something like
# that.  If this is a new installation run "/etc/rc.d/init.d/alsasound start"
# (or "/etc/rc.d/rc.alsa start" if you installed it). If this is an upgrade,
# run "/etc/rc.d/init.d/alsasound stop", make sure the modules are all
# unloaded (look at 'lsmod') then run it with start.

# Become yourself again
exit

cd
rm -f installed/alsa/alsa-driver-*.tar.*
mv alsa-driver-1.0.16.tar.bz2 installed/alsa/

# If you're only upgrading the drivers (and not -lib, -oss, and -utils too)
# skip down to the bottom for a note about all of the volumes being muted.


# alsa-lib 1.0.16
# ===============
# Slackware 9.1's 'alsa-lib' package includes version 0.9.6, 10.0's includes
# version 1.0.5, 10.1's includes 1.0.8, 10.2's includes 1.0.9, 11.0's
# includes 1.0.11, and 12.0's includes 1.0.14a

cd
test -f installed/alsa/alsa-lib-1.0.16.tar.bz2 &&
 mv installed/alsa/alsa-lib-1.0.16.tar.bz2 .
test ! -f alsa-lib-1.0.16.tar.bz2 &&
 wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.16.tar.bz2
cd src/alsa
find -maxdepth 1 -type d -name "alsa-lib-*" -exec rm -r {} \;
tar xjvf ~/alsa-lib-1.0.16.tar.bz2
cd alsa-lib-1.0.16
test $UID = 0 && chown -R root:root .

# With previous versions, I had to change a line in
# src/conf/cards/CS46xx.conf to get Skype to work with
# my microphone.  That has already been changed in this version.

./configure
make

# Become root to install it
su

test -x /sbin/removepkg && /sbin/removepkg alsa-lib
rm -f /usr/lib/libasound.*
make install
ldconfig
chown -R $USER .

## If you're upgrading a Slackware-installed alsa-lib, you may also want to
## remove libsound lines from /var/adm/packages/*elflibs* if you're really
## anal (like me) about keeping things cleaned up.  Here's an example line
## from Slackware 10.2's aaa_elflibs package file:
# usr/lib/libasound.so.2.0.0

# Become yourself again
exit

cd
rm -f installed/alsa/alsa-lib-*.tar.*
mv alsa-lib-1.0.16.tar.bz2 installed/alsa/


# alsa-oss 1.0.15
# ===============
# Slackware 9.1's 'alsa-oss' package includes version 0.9.6, 10.0's includes
# 1.0.5, 10.1's includes 1.0.8, 10.2's includes 1.0.9, 11.0's includes
# 1.0.11, and 12.0's includes 1.0.14

# Prerequisites (beyond those listed above):
# libasound >= 0.9.0 (alsa-lib)

cd
test -f installed/alsa/alsa-oss-1.0.15.tar.bz2 &&
 mv installed/alsa/alsa-oss-1.0.15.tar.bz2 .
test ! -f alsa-oss-1.0.15.tar.bz2 &&
 wget ftp://ftp.alsa-project.org/pub/oss-lib/alsa-oss-1.0.15.tar.bz2
cd src/alsa
find -maxdepth 1 -type d -name "alsa-oss-*" -exec rm -r {} \;
tar xjvf ~/alsa-oss-1.0.15.tar.bz2
cd alsa-oss-1.0.15
test $UID = 0 && chown -R root:root .
./configure --sysconfdir=/etc
make

# Become root to install it
su

test -x /sbin/removepkg && /sbin/removepkg alsa-oss
rm -f /usr/lib/libaoss.*
make install
ldconfig
chown -R $USER .

# Become yourself again
exit

cd
rm -f installed/alsa/alsa-oss-*.tar.*
mv alsa-oss-1.0.15.tar.bz2 installed/alsa/


# alsa-utils 1.0.16
# =================
# Slackware 9.1's 'alsa-utils' package includes version 0.9.6, 10.0's
# includes version 1.0.5, 10.1's includes 1.0.8, 10.2's includes 1.0.9a,
# 11.0's includes 1.0.11, and 12.0's includes 1.0.14

# Prerequisites (beyond those listed above):
# libasound >= 0.9.0 (alsa-lib)

cd
test -f installed/alsa/alsa-utils-1.0.16.tar.bz2 &&
 mv installed/alsa/alsa-utils-1.0.16.tar.bz2 .
test ! -f alsa-utils-1.0.16.tar.bz2 &&
 wget ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.0.16.tar.bz2
cd src/alsa
find -maxdepth 1 -type d -name "alsa-utils-*" -exec rm -r {} \;
tar xjvf ~/alsa-utils-1.0.16.tar.bz2
cd alsa-utils-1.0.16
test $UID = 0 && chown -R root:root .
./configure --sysconfdir=/etc
make

# Become root to install it
su

test -x /sbin/removepkg && /sbin/removepkg alsa-utils
make install

# Become yourself again
exit

cd
rm -f installed/alsa/alsa-utils-*.tar.*
mv alsa-utils-1.0.16.tar.bz2 installed/alsa/


# Alsa volumes are all set to 0 (muted) by default.  Start up alsamixer (or
# rexima or aumix), set the volume as you like, then run 'alsactl store'.  The
# startup script will restore the volume when you reboot.

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>