2004.07_Alsa-Setting Up the Advanced Linux Sound Architecture.pdf

(824 KB) Pobierz
Layout 1
KNOW HOW
Alsa
Free Sound Dimensions
There are many good reasons
tions. If you are not forced
to use a specific sound
card, because your Win-
dows based music pro-
gram requires the specific
functionality of the card, a
cheap card and Alsa are
probably your best
options.
It is often possible
to use OSS-based ap-
plications, by installing
the compatibility library,
ALSA-oss , which is also
available from the Alsa
homepage [1].
The recommended
approach is to install the
Alsa packages supplied
with your distro first.
You can avoid downloads
and complicated modifi-
cations of your configuration in this way.
Once you have the drivers and audio
programs working to your satisfaction,
there is no real reason to update. As not
all Alsa tools and applications are
installed by default, you may need to
add one or two programs.
The current SuSE 9.0 and Mandrake
9.2 distributions have Alsa version 0.96 –
which was released in the fall of 2003 –
including a number of tools. 0.x versions
of Alsa are not under active develop-
ment. Currently, the Alsa homepage [1]
has a stable version 1.02 for kernel ver-
to install the Advanced Linux
Sound Architecture, Alsa, by
default on modern distribu-
tions. They include a variety of
Alsa-based audio applications
ranging from simple CD play-
ers to professional studio
programs.
BY WOLFGANG BONGERTZ
Figure 1: The Alsaplayer is versatile, and handles everything from MP3 files to
audio CDs as audio streams. It can also visualize signals. The spectral water-
fall (center of image) may be more appealing, but the spectrum analyzer
(bottom right) provides more information.
utions to opt for a GPL-licensed
software rather than a commercial
OSS. The first, and most obvious, advan-
tage is that the user does not need to
spend money just to install a sound card,
assuming that it has Alsa support. This is
true of many cards, including some quite
exotic models that you won’t find down
at your local hardware dealers. To find
out if Alsa supports your card, check out
the database at [1].
If your card is not listed, it doesn’t
automatically mean that you will be
unable to use it with Alsa, but it might
take a while to check what standards
your card supports and to tweak out the
best setings.
In many cases you might actually save
money by buying a new sound card,
rather than opting for a seemingly
inevitable OSS, as a surcharge may be
payable if you want to enable the card on
Linux. Yours truly first purchased an OSS
license for a sound card with the Aureal
Vortex chipset, only to discover that I
was expected to pay an additional fee for
enabling even the basic chipset func-
Box 1: Updating to Alsa from OSS
The first thing to do is to make sure that OSS
(if it is still installed) does not take command
of your sound card and is not automatically
loaded when you boot your machine. su to
root in the command line and halt the OSS
driver as follows:
soundoff
Then call soundconf to open the OSS config-
uration menu. Select the Disable automatic
startup at boot time option below Automatic
Boot Setup .You should see a message to the
effect that the OSS driver has been removed
successfully. Don’t forget to save and exit,
when quitting the configuration menu, to
prevent the OSS driver from launching auto-
matically in future.
Older OSS versions may use an entry in
/etc/init.d/boot.local to start the OSS driver.
In this case, remove the line with the
/usr/bin/local/soundon entry.
You can now use your distribution’s installa-
tion manager to install Alsa if you have not
already done so. After installing Alsa, you
should have a script called alsasound in your
/etc/init.d directory. Again working with
super user privileges, type
/etc/init.d/alsasound restart
in the command line to launch, or re-launch,
the driver.
Suse and Mandrake installation tools can
autodetect internal sound cards. If required,
you can finish off the configuration with
Ya ST on Suse 9.0 (see Figure 2), and with
draksound on Mandrake. The installation
procedure should also automatically start
the sound daemon.
If you installed the latest Alsa version from
the source code (see Box 2: Installing Alsa
from the Sources), avoid installing a sound
card via YaST or draksound as this would
overwrite the new drivers.
44
July 2004
www.linux-magazine.com
Alsa soundscapes, not just for musicians
I t seems quite logical for Linux distrib-
592692257.004.png 592692257.005.png 592692257.006.png 592692257.007.png
Alsa
KNOW HOW
sions 2.2, 2.4, and 2.6. Beta version 1.03
is just around the corner.
The following sections assume that
you have a working Alsa driver installa-
tion. Users moving from OSS should
check out the notes in the boxes. Box 2
provides instructions on installing Alsa
from the sources.
a Jack interface. In this case,
Jack controls the synthe-
sizer indirectly, as the MIDI
sequencer which controlling
the synthesizer is running
as a Jack client – synchro-
nously with the multi-track
recorder client.
Thanks to the efforts of a
continually growing com-
munity of audio developers,
most of whom work with
Alsa applications, there is a
large selection of “jackified”
software available, and the
collection continues to
grow. Box 3: Applications,
lists a number of programs that rely on
Jack functionality.
Jack Connects
The Jack Audio Connection Kit (Jack)
[3] allows multiple applications to work
with the Alsa audio drivers at the same
time. Jack is included with most current
distributions, and will automatically be
installed if you set up an application
such as alsaplayer .
Jack is an audio server that connects
various audio applications to the hard-
ware and makes sure that applications
can exchange data. See Figure 3. For
example, a MIDI sequencer simply
records control data which are fed to a
sound generator on the sound card, or
an external instrument, which in turn
takes care of producing the required
sounds. If you want to add an echo, Alsa
Figure 2: Suse Linux uses YaST to for Alsa sound configuration.
Users can set the volume at the same time.
will transport your midi data to the chip
that generates the sound, and Jack will
take the sound produced by the chip to
the echo processor, and hand it back to
the sound card. It can even take a detour
via a software based audio mixer, if
required.
Of course, this assumes that the appli-
cations are “jackified”. Figure 4 shows a
software synthesizer that does not have
LADSPA versus VST
LADSPA (Linux Audio Developers Sim-
ple Plugin Architecture) is the Open
Source equivalent of Steinberg’s VST
standard for audio plug-ins in Cubase or
Nuendo. Synthesizers, sequencers, audio
workstations, and a multitude of pro-
Box 2: Installing Alsa from the Sources
Before you start, make sure that the kernel
source code is installed to fulfill all of the
Alsa drivers’ dependencies. Then you need to
type
modinfo soundcore
If the response tells you that this module is
available, you can assume that you will not
need to re-compile the kernel. The database
of supported cards on the Alsa hompage [1]
typically has detailed guidelines on individ-
ual cards, and links to distribution specific
tutorials.
Packages that you downloaded from the
homepage need to be unpacked in separate
directories. They include both the drivers,
and a collection of libraries, tools, and mod-
ules for special cards like the Aureal Vortex,
Tur tle Beach Multisound Pinnacle/Fuji,
Sek’D/Marian Prodif Plus, or Advantage.
After unpacking the archive files in /opt, for
example, you should have a few subdirecto-
ries called alsa-driver , alsa-lib , alsa-firmware ,
alsa-oss , alsa-utils , and alsa-tools plus the
version number suffix for the version you are
installing.
Step by Step
The following example is for a Terratec
128iPCI card, which uses a es1938 driver mod-
ule. This driver is referred to by its module
name during configuration and when added
to the kernel. You may need to refer to the
installation guide on the Alsa homepage [1]
to find out the module name for your sound
card.
In a command line window, change to the
driver directory
cd /opt/alsa-driver-xx
and then type the following
./configure -with-sequencer= U
yes with--isapnp=no; U
make; make install
to build the software in a single operation.
configure options always start with --with
and are located in the INSTALL file. In this
case, we simply enabled sequencer support,
and removed ISA PnP sound card support,
which we will not need. If you prefer, you can
tell configure to configure the driver module
for your card by stipulating --with-cards=
es1938 .Alsa versions prior to 0.94 need to
run a script to be able to assign privileges for
snddevices.
Before you turn to the lib package, first type
chmod a+rw /dev/mixer U
/dev/dsp /dev/sequencer /dev/mid
Then working in the /opt/alsa-lib-xx direc-
tory, follow the normal steps to complete the
install: /configure; make; make install .Follow
the same approach for the utilities and OSS
compatibility packages in /alsa-utils-xx , and
/alsa-oss-xx . Change to the directory, config-
ure, compile, and install all in a single quick
action.
Time to add the modules to the kernel. The
Alsa hardware database at [1] tells you the
right module(s) for your sound card(s). This is
snd-es-1938 for the Terratec 128i PCI in our
case:
modprobe /dev/snd-es1938; U
modprobe /dev/snd-mixer; U
modprobe /dev/snd-seq-oss
After completing the install, you may find
that the volume controllers for the sound
card are muted. You can use the alsamixer
from the utilities package to set the volume.
Assuming that the install worked out OK,
you should also be able to use other mixers
such as gamix or kmix .
You can use the user-specific .asoundrc file to
update plug-ins for converting PCM formats
or routing to distribution specific variants for
Alsa. Alsa will work perfectly well without
.asoundrc ,but it does give you more control
over your own soundcard(s). Check out the
tutorial [2] for more info on generating an
.asoundrc .
www.linux-magazine.com
July 2004
45
592692257.001.png 592692257.002.png
KNOW HOW
Alsa
Figure 4: amSynth brings back the classical sound
of analog synthesizers. You need to twiddle but-
tons to control it, just like on a true analog
synthesizer.
Figure 3: This diagram by Jörn Nettingsmeier shows how Jack works.The jackd daemon hovers like a spi-
der in its web, and provides stable routing of the audio streams in the background.
INFO
grams for musicians and sound engi-
neers all work with LADSPA plug-ins. In
fact, there are any number of quite
impressive plug-ins available from vari-
ous sources.
The Agnula project distributions,
which are tailored to meet the needs of
musicians and studio owners, all rely
heavily on a combination of Trio Alsa,
Jack, and LADSPA.
self-installing and configuring versions,
DeMuDi and ReHMuDi, were due to be
completed on 31.3.2004. the Agnula
homepage had a downloadable ISO CD
image of both distributions ready by the
deadline. Unfortunately, neither of the
CDs was bootable, and both lacked a
simple installation routine. The packages
these distros contain are older than those
provided by generic distributions in most
cases.
This said, the approach is interesting.
The Agnula distributions provide a col-
lection of apps for musicians and sound
engineers, and this gives DeMuDi and
ReHMuDi a fighting chance against com-
mercial applications for Mac and
Windows in this professional market.
[1] The Alsa project: http://alsa-project.org
[2] Tutorial .asoundrc: http://alsa-project.
org/alsa-doc/doc-php/asoundrc.php3
[3] Jack homepage:
http://jackit.sourceforge.net/
[4] Introduction to Alsa, Jack, and LADSPA:
http://www.agnula.org/documentation/
dp_tutorials/alsa_jack_ladspa/
[5] Alsa applications:
http://alsa-project.org/applications.php3
[6] Jazz++ MIDI sequencer: http://www.
jazzware.com/cgi-bin/Zope.cgi/jazzware
[7] Amsynth synthesizer: http://amsynthe.
sourceforge.net/amSynth/
[8] Ardour homepage: http://ardour.org/
[9] Simsam MIDI Sample Player:
http://simsam.sourceforge.net
[10] MusE “Professional Music Maker” Linux
Magazine, Issue 37, December 2003, p20
[11] The BEAST: http://beast.gtk.org/
[12] AlsaModularSynth:
http://alsamodular.sourceforge.net/
[13] FluidSynth: http://www.fluidsynth.org/
[14] Rosegarden “On a Bed of Roses” Linux
Magazine, Issue 37, December 2003, p25
Agnula and EU Sponsorship
The European Commission invested 1.7
million Euro over a period of two years
in the Agnula project [4], giving the pro-
ject the task of developing a customized,
Debian and Red Hat-based Linux distrib-
ution for audio applications. The
Box 3: Applications
Free and commercial applications for Alsa
and Jack can easily hold their sway with
more established audio applications. Check
out the list of applications and short descrip-
tions later on in this article. For a more
detailed list, check out the Applications sec-
tion [5] on the Alsa hompage.
Most popular distributions include the
Alsaplayer , and an audio media player that
handles and plays almost everything, from
audio CDs, through various PCM formats, to
MP3 as audio streams. The program also has
visual gimmicks such as a waterfall spectral
display or level indicators. See Figure 1 for an
example.
Jazz++ is a free MIDI sequencer with all the
features that you need to produce stunning
professional results. Jazz++ also runs on
Windows. [6]
amSynth is targeted at fans of classical ana-
log synthesizers. Just like in the good old
days of MiniMoogs, you can twiddle knobs
to modify the sound. [7]
Ardour is a multi-track recording program
for professional applications.[8]
Simsam is a simple MIDI sample player,
which can be controlled via a MIDI keyboard.
DJs in particular might be interested in this
app. [9]
The Audio/MIDI sequencer, MusE [10], the
BEAST [11], AlsaModularSynth [12], and Flu-
idSynth [13] synthesizers, and the MIDI
sequencer and note editor, Rosegarden [14],
are all worthy of note.
After studying communications engi-
neering at the technical university in
Brunswick, Germany, Wolfgang
Bongertz went into journalism, writ-
ing for special-interest publications
for musicians and studio staff. He has
worked with Linux for several years
now, specializing in exchanging data
with Mac and Windows machines,
and applications for musicians.
46
July 2004
www.linux-magazine.com
592692257.003.png
Zgłoś jeśli naruszono regulamin