1 TITLE: Installing the ALSA Sounddriver
3 AUTHOR: Alex Kloss <l.x.@gmx.de>
6 Short Guide how to set up the ALSA Sounddriver and optionally
7 timidity++ as midi client for those cards w/o midi device.
10 There are some tricky bits when installing the ALSA Sounddriver
11 and TiMidity++ as a midi client - especially when using version
12 0.9.0 (currently 0.9.0rc6).
13 Thanks to Mark Hymers <markh@linuxfromscratch.org> for the
17 Look at http://www.alsa-project.org for the packages you need
18 alsa-driver-<version>.tar.bz2 [Drivers, Startup Script]
19 alsa-lib-<version>.tar.bz2 [Library for ALSA-enabled Programs]
20 alsa-utils-<version>.tar.bz2 [Mixer, Control Program]
21 alsa-oss-<version>.tar.bz2 [OSS Compatibilty Library, for
22 developers who wants to convert their software from OSS to alsa]
23 alsa-tools-<version>.tar.bz [ac3dec for ALSA, some Soundcard
24 Control Programs, not everyone will need that]
26 If your card doesn't support midi by itself, you may want to use
27 timidity as a alsa sequencer client, meaning that every midi file sent
28 to the alsa sequencer emulated by timidity should be played through
29 the normal DSP (digital sound processor). Therefore you need:
31 http://www.goice.co.jp/member/mo/timidity/ [Download the most recent
32 version of TiMidity++] and
33 http://www.i.h.kyoto-u.ac.jp/~shom/timidity/ or
34 ftp://ftp.cdrom.com/pub/gus/sound/patches/files/ [Download the
35 necessary patch files - those are files that contain datas about the
36 frequency and amplitude modulation of the virtual midi sequencer]
38 If you're using ALSA 0.9.0rc6, which is strongly recommended,
39 you'll need a patch to install timidity:
40 http://www.alsa-project.org/~iwai/timidity-2.11.2-alsa9.dif.gz
41 This patch was originally meant for timidity 2.11.2, but since
42 timidity 2.11.3 is the most recent version, we'll go around the
43 error it causes during the installation.
49 ./configure --with-sequencer=yes \
50 --with-moddir=/lib/modules/$(uname -r)/kernel/driver/sound/ \
51 --with-kernel=/usr/src/linux-$(uname -r) \
52 --with-oss=yes --with-cards=<sounddrivers to compile> &&
56 replace <sounddrivers to compile> with the card names you need
57 drivers for (read the SOUNDCARDS Appendix at the end of this hint);
58 otherwise "./configure --help" gives you a list of drivers you can
59 compile. "--with-moddir" and "--with-kernel" can be omitted if
60 the default settings should be used.
62 There are two ways of setting up the modules. The easiest way is
63 the "let the kernel module loader load them automatically"-way, the
64 other one is to use the bootscript.
66 For the first alternative, edit your /etc/modules.conf and
69 cat >> /etc/modules.conf << "EOF"
70 alias char-major-116 snd
71 options snd major=116 cards_limit=1
72 alias snd-card-0 snd-<soundcard>
73 alias sound-slot-0 snd-card-0
74 alias sound-service-0-0 snd-mixer-oss
75 alias sound-service-0-3 snd-pcm-oss
76 post-install snd-card-<soundcard> /usr/sbin/alsactl restore
77 pre-remove snd-card-<soundcard> /usr/sbin/alsactl store
80 replace <soundcard> with the appropriate Driver name you found
81 in the SOUNDCARDS Appendix.
83 If you want the driver to be loaded on startup, you can use the
84 alsasound script you find in the alsa-driver-<version>/utils
87 cp utils/alsasound /etc/init.d &&
88 ln -s /etc/init.d/alsasound /etc/rc{2,3,4,5}.d/S200alsasound &&
89 ln -s /etc/init.d/alsasound /etc/rc{0,1,6,S}.d/K200alsasound
91 Since this bootscript is designed for redhat, LFS users may be
92 discontent with it, like Mark Hymers, who designed a replacement:
94 cat > /etc/rc.d/init.d/alsa << EOF
96 # Begin $rc_base/init.d/alsa
98 # Based on sysklogd script from LFS-3.1 and earlier.
99 # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
100 # ALSA specific parts by Mark Hymers - markh@linuxfromscratch.org
102 source /etc/sysconfig/rc
105 if [ -f /etc/sysconfig/alsa ]
107 source /etc/sysconfig/alsa
112 echo "Please create an /etc/sysconfig/alsa file containing"
113 echo "a CONF value (usually /etc/asound.conf)"
118 echo -n "Starting alsa... Restoring volumes..."
119 loadproc /usr/sbin/alsactl -f $CONF restore
120 #echo -n " Loading MIDI font..."
121 #loadproc sfxload $FONT
125 echo -n "Stopping alsa... Saving volumes......"
126 loadproc /usr/sbin/alsactl -f $CONF store
127 #echo -n " Removing MIDI font.........."
138 echo "Usage: $0 {start|stop|restart}"
144 # End $rc_base/init.d/alsa
146 chmod 755 /etc/init.d/alsa &&
147 ln -s /etc/init.d/alsa /etc/rc{2,3,4,5}.d/S200alsa &&
148 ln -s /etc/init.d/alsa /etc/rc{0,1,6,S}.d/K200alsa
150 Note that the Loading and Removing MIDI font lines are commented out.
151 This is because they are only needed for certain soundcards and also
152 require an additional program (sfxload). If your soundcard is unable
153 to play midi files, you might want to look for timidity, a midi to
154 wav converter that's also able to act as an virtual alsa midi device.
156 Beware. All channels of your soundcard are muted by default.
157 You can use the alsamixer (in alsa-utils, requires alsa-lib) or
158 any other OSS mixer program (like kmix, gmix, aumix) to unmute
161 If you get an error like
163 alsamixer: failed to open mixer #0/#0: No such file or directory
165 try the snddevices script in the alsa-driver directory.
168 alsa-lib/utils/oss/tools:
173 for each of them. You wouldn't need the tools, except if you
174 have some very old/expensive card which needs more control
175 tools (e.g. multichannel cards).
178 Configuring other software:
180 There is software out there to look at /dev/sndstat to find out
181 wether a sound driver is installed. If you have such software
182 sniggering at you "no soundcard found", try the following
186 ln -s /proc/asound/sndstat /dev/sndstat
188 If you are using the 0.9.x drivers, it is possible that older
189 software fails to compile for ALSA. This is because it'd need
190 the older API to connect to the driver. Don't bother about ALSA
191 support then, rather try the OSS driver emulation (it's in some
192 cases better than 4Fronts OSS driver itself).
194 If the software is complaining about having no access to the
195 devices with your current UID, you need to set the proper
196 permissions (as root):
198 chmod a+rw /dev/mi* /dev/dsp* /dev/seq*
200 This should do the job. The README in the driver directory has some
201 extra information on how you could configure the driver for the use
202 with certain programs.
205 Installing TiMidity++:
207 Many OnBoard-Cards doesn't have a midi sequencer device. When you want
208 to play midi sounds anyhow on this cards, you have two choices: when
209 you're only looking for a program that plays midi files without
210 actually using a midi device, you may easily install TiMidity++ and
211 use it just like a midi player. If you want to use other programs like
212 Brahms or else that supports an alsa midi sequencer client, you'll have
217 cat timidity-2.11.2-alsa9.dif | patch -Np1 &&
218 ./configure --prefix=/usr --enable-alsa [--enable-spectrogram] \
219 [--enable-spline=no|linear|cubic|lagrange] [--enable-alsaseq] \
220 [--enable-server] [--enable-ncurses] --enable-xaw [--enable-gtk] \
221 [--enable-network] &&
222 make ENABLE_PLUGIN_TRUE=0 &&
223 make ENABLE_PLUGIN_TRUE install
227 --prefix=/usr binaries and stuff should go to /usr.
228 --enable-alsa usage of alsa driver.
229 WARNING: as of the current version (2.11.3)
230 timidity is incompatible with the new ALSA
231 API of version 0.9.X - you should rather use
232 the OSS emulation and don't use that option!
233 --enable-spectrogram usage of a spectrogram (graphic output).
234 --enable-spline=... no: spectrogram w/o splines (looks dotted)
235 linear: standard spectrogram
236 cubic: better quality, more CPU load
237 lagrange: optimal quality, heavy load.
238 --enable-alsaseq usage as ALSA sequencer client.
239 WARNING: as of the current version (2.11.3)
240 the alsa sequencer client doesn't work with
241 the 0.9.X-branch of the alsa driver!
242 --enable-server ALSA client server (look above).
243 --enable-ncurses usage of ncurses interface (console).
244 --enable-xaw usage of XAW (Athena Widgets, these are
245 included in every usual XFree86 release)
247 --enable-gtk If you've got gtk+ 1.2.10 or higher (not
248 gtk+ 2.0!), you may have this nice interface,
250 --enable-network network transparency.
254 The "ENABLE_PLUGIN_TRUE=0" fixes an error of the configure script
255 which is triggered by the alsa9-patch.
257 Now extract the midi patch files to /usr/share/timidity. After that,
258 timidity <file.mid> should play your midi files.
260 To start the sequencer interface, execute:
262 timidity -iA -B2,8 -Os -EFreverb=0
264 that should output something like:
266 TiMidity starting in ALSA server mode
267 Opening sequencer port: 128:0 128:1
269 Now you can use the midi port 128:0 and 128:1 for midi output.
270 For example, to play a midi file through that sequencer using
271 pmidi, you'll have to type
273 pmidi -p128:0 test.mid
275 Or to play around with your midi keyboard:
279 To get best sound quality, you may want to start timidity as
280 root. If you want to start it on every reboot, you may add it
281 to your boot script, but it will slow down your system.
285 try "cat /proc/pci | grep audio" and look for the PCI ID:
288 EMU10k1 Soundblaster SB Live! (or else) emu10k1
289 10b9:5451 ALi 5451 Onboard ali5451
290 ES1371 Ensoniq 1371 (Soundblaster) ens1371
291 ES1370 Ensoniq 1370 (Soundblaster) ens1370
292 ES1983S ESS Maestro 3 es1983
293 VIA VIA AC97 Audio Controller 686A via686a
294 ES1986 ESS Maestro 2 es1986
295 Vortex 2 Aureal Vortex II *
296 ALS4000 Avance Logic ALS 4000 als4000
298 *Aureal is dead. So development of an ALSA driver is beyond
299 reach. Try the sourceforge project.
301 For further cards look at CARDS-Status (0.9.x-version), the
302 doc/CARDS file (older Version), or the homepage. Please send me
303 an email about what you'd got on "cat /proc/pci | grep audio"
304 and what driver you used. If that Appendix grows big enough, I'll
305 use it for a fully automatic installation script.
307 Hope this was helpful!